[Mesa-dev] [Bug 35268] initial-exec TLS model breaks dlopen'ed libGL
https://bugs.freedesktop.org/show_bug.cgi?id=35268 Alexander Monakov amona...@gmail.com changed: What|Removed |Added CC||amona...@gmail.com --- Comment #10 from Alexander Monakov amona...@gmail.com --- Nowadays nVidia- and AMD-supplied libGL.so's use initial-exec TLS as well (at least on 32-bit x86). Does LD_PRELOAD'ing libGL.so.1 for Firefox work with musl? -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 35268] initial-exec TLS model breaks dlopen'ed libGL
https://bugs.freedesktop.org/show_bug.cgi?id=35268 --- Comment #11 from Natanael Copa natanael.c...@gmail.com --- (In reply to comment #10) Nowadays nVidia- and AMD-supplied libGL.so's use initial-exec TLS as well (at least on 32-bit x86). the closed source libGL.sos are linked to GNU libc and is not really expected to work on musl libc systems anyways. Does LD_PRELOAD'ing libGL.so.1 for Firefox work with musl? yes. That makes it work. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 35268] initial-exec TLS model breaks dlopen'ed libGL
https://bugs.freedesktop.org/show_bug.cgi?id=35268 --- Comment #12 from Natanael Copa natanael.c...@gmail.com --- Created attachment 92975 -- https://bugs.freedesktop.org/attachment.cgi?id=92975action=edit gltest.c testcase. To reproduce, dlopen ./gltest.so and call gltest(). -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 35268] initial-exec TLS model breaks dlopen'ed libGL
https://bugs.freedesktop.org/show_bug.cgi?id=35268 --- Comment #13 from Natanael Copa natanael.c...@gmail.com --- Created attachment 92976 -- https://bugs.freedesktop.org/attachment.cgi?id=92976action=edit app.c app that call gltest() in a dlopened gltest.so -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 35268] initial-exec TLS model breaks dlopen'ed libGL
https://bugs.freedesktop.org/show_bug.cgi?id=35268 --- Comment #14 from Natanael Copa natanael.c...@gmail.com --- Created attachment 92977 -- https://bugs.freedesktop.org/attachment.cgi?id=92977action=edit Makefile Makefile for app.c and gltest.c -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] R600/SI: Fix fneg for 0.0
From: Michel Dänzer michel.daen...@amd.com V_ADD_F32 with source modifier does not produce -0.0 for this. Just manipulate the sign bit directly instead. Also add a pattern for (fneg (fabs ...)). Fixes a bunch of bit encoding piglit tests with radeonsi. Signed-off-by: Michel Dänzer michel.daen...@amd.com --- lib/Target/R600/SIInstructions.td | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Target/R600/SIInstructions.td b/lib/Target/R600/SIInstructions.td index 912b59a..43fe63c 100644 --- a/lib/Target/R600/SIInstructions.td +++ b/lib/Target/R600/SIInstructions.td @@ -1684,15 +1684,18 @@ def : Pat ; def : Pat + (fneg (fabs f32:$src)), + (V_OR_B32_e32 $src, (V_MOV_B32_e32 0x8000)) /* Set sign bit */ +; + +def : Pat (fabs f32:$src), - (V_ADD_F32_e64 $src, (i32 0 /* SRC1 */), - 1 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 0 /* NEG */) + (V_AND_B32_e32 $src, (V_MOV_B32_e32 0x7fff)) /* Clear sign bit */ ; def : Pat (fneg f32:$src), - (V_ADD_F32_e64 $src, (i32 0 /* SRC1 */), - 0 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 1 /* NEG */) + (V_XOR_B32_e32 $src, (V_MOV_B32_e32 0x8000)) /* Toggle sign bit */ ; /** == **/ -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/10] glsl: memory_writer helper class for data serialization
Class will be used by the shader binary cache implementation. Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/glsl/memory_writer.h | 188 +++ 1 file changed, 188 insertions(+) create mode 100644 src/glsl/memory_writer.h diff --git a/src/glsl/memory_writer.h b/src/glsl/memory_writer.h new file mode 100644 index 000..979169f --- /dev/null +++ b/src/glsl/memory_writer.h @@ -0,0 +1,188 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2013 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#pragma once +#ifndef MEMORY_WRITER_H +#define MEMORY_WRITER_H + +#include stdlib.h +#include unistd.h +#include string.h + +#include main/hash_table.h + +#ifdef __cplusplus +/** + * Helper class for writing data to memory + * + * This class maintains a dynamically-sized memory buffer and allows + * for data to be efficiently appended to it with automatic resizing. + */ +class memory_writer +{ +public: + memory_writer() : + memory(NULL), + curr_size(0), + pos(0) + { + data_hash = _mesa_hash_table_create(0, int_equal); + hash_value = _mesa_hash_data(this, sizeof(memory_writer)); + } + + ~memory_writer() + { + free(memory); + _mesa_hash_table_destroy(data_hash, NULL); + } + + /* user wants to claim the memory */ + char *release_memory(size_t *size) + { + /* final realloc to free allocated but unused memory */ + char *result = (char *) realloc(memory, pos); + *size = pos; + memory = NULL; + curr_size = 0; + pos = 0; + return result; + } + +/** + * write functions per type + */ +#define DECL_WRITER(type) void write_ ##type (const type data) {\ + write(data, sizeof(type));\ +} + + DECL_WRITER(int32_t); + DECL_WRITER(int64_t); + DECL_WRITER(uint8_t); + DECL_WRITER(uint32_t); + + void write_bool(bool data) + { + uint8_t val = data; + write_uint8_t(val); + } + + /* write function that reallocates more memory if required */ + void write(const void *data, int size) + { + if (!memory || pos (curr_size - size)) + if (!grow(size)) +return; + + memcpy(memory + pos, data, size); + + pos += size; + } + + void overwrite(const void *data, int size, int offset) + { + if (offset 0 || offset + size pos) + return; + memcpy(memory + offset, data, size); + } + + /* length is written to make reading safe */ + void write_string(const char *str) + { + uint32_t len = str ? strlen(str) : 0; + write_uint32_t(len); + + if (str) + write(str, len + 1); + } + + unsigned position() + { + return pos; + } + + /** +* check if some data was written +*/ + bool data_was_written(void *data, uint32_t id) + { + hash_entry *entry = + _mesa_hash_table_search(data_hash, hash_value, +(void*) (intptr_t) id); + + if (entry entry-data == data) + return true; + + return false; + } + + /* mark that some data was written */ + void mark_data_written(void *data, uint32_t id) + { + _mesa_hash_table_insert(data_hash, hash_value, + (void*) (intptr_t) id, data); + } + +private: + + /* reallocate more memory */ + bool grow(int size) + { + unsigned new_size = 2 * (curr_size + size); + char *more_mem = (char *) realloc(memory, new_size); + if (more_mem == NULL) { + free(memory); + memory = NULL; + return false; + } else { + memory = more_mem; + curr_size = new_size; + return true; + } + } + + /* allocated memory */ + char *memory; + + /* current size of the whole allocation */ + int curr_size; + + /* write position / size of the data written */ + int pos; + + /* this hash can be used to refer to data already written +* to skip sequential writes of the
[Mesa-dev] [PATCH 05/10] glsl: export populate_symbol_table function
Binary shader cache needs this to allocate and fill gl_shader symbol table. Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/glsl/linker.cpp | 2 +- src/glsl/linker.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 93b4754..dfe431d 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -839,7 +839,7 @@ interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog) /** * Populates a shaders symbol table with all global declarations */ -static void +void populate_symbol_table(gl_shader *sh) { sh-symbols = new(sh) glsl_symbol_table; diff --git a/src/glsl/linker.h b/src/glsl/linker.h index 130915d..f0a947b 100644 --- a/src/glsl/linker.h +++ b/src/glsl/linker.h @@ -26,6 +26,9 @@ #ifndef GLSL_LINKER_H #define GLSL_LINKER_H +void +populate_symbol_table(gl_shader *sh); + extern bool link_function_calls(gl_shader_program *prog, gl_shader *main, gl_shader **shader_list, unsigned num_shaders); -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/10] glsl: add MESA_SHADER_CACHE_MAGIC string for shader binary cache
Patch adds a string that can be used by binary cache to identify that shader binaries were generated with exact same Mesa library. Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/glsl/shader_cache_magic.h | 36 1 file changed, 36 insertions(+) create mode 100644 src/glsl/shader_cache_magic.h diff --git a/src/glsl/shader_cache_magic.h b/src/glsl/shader_cache_magic.h new file mode 100644 index 000..b4e99e2 --- /dev/null +++ b/src/glsl/shader_cache_magic.h @@ -0,0 +1,36 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2013 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#ifndef SHADER_CACHE_MAGIC_H +#define SHADER_CACHE_MAGIC_H + +#define MESA_SHADER_CACHE_MAGIC __DATE__ __TIME__ + +inline const char * +mesa_get_shader_cache_magic() +{ + return MESA_SHADER_CACHE_MAGIC; +} + +#endif -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 00/10] GL_OES_get_program_binary extension
Hi; Here's the binary shader patch-set, I've fixed issues Paul found in the review earlier. There are lots of little changes but mainly: - more validation done when reading, also a special validation structure is introduced to bail out early if things do not seem to match, reading checks that we are not attempting to read over the blob boundary - smaller blob size, now uniform storage is not serialized but gets generated as zero and constant initializer values are set if needed - each user glsl type is serialized only once (requested by Paul) - no more LinkShader call, now there is enough post-link information (this tested for Intel driver, others might require more) branch with changes: http://cgit.freedesktop.org/~tpalli/mesa/log/?h=oes_get_program_binary branch that automatically caches linked programs and loads them on link: http://cgit.freedesktop.org/~tpalli/mesa/log/?h=automatic_cache (experiment to validate the extension functionality with any app) I've been testing this set with a particular gles2 engine that supports binary caching. Also I've run automatic_cache on glbenchmark and some other random applications. I'm planning to make changes for Piglit shaderrunner to support cache so that Piglit could be used for the validation. I know that Paul is very busy ATM so I would appreciate if someone else has time to go through some of this, thanks! Tapani Pälli (10): glsl: memory_writer helper class for data serialization glsl: serialize methods for IR instructions glsl: memory_map helper class for data deserialization glsl: add MESA_SHADER_CACHE_MAGIC string for shader binary cache glsl: export populate_symbol_table function glsl: add MAX_NUM_STATE_SLOTS and check against builtin uniform variables glsl: ir_deserializer class for the binary shader cache mesa: iterate method for string_to_uint_map glsl: functions to serialize gl_shader and gl_shader_program mesa: OES_get_program_binary extension functionality src/glsl/Makefile.sources | 3 + src/glsl/builtin_variables.cpp | 3 + src/glsl/ir.h | 45 ++ src/glsl/ir_deserializer.cpp | 910 + src/glsl/ir_deserializer.h | 133 ++ src/glsl/ir_serialize.cpp | 407 ++ src/glsl/ir_serialize.h| 36 ++ src/glsl/linker.cpp| 2 +- src/glsl/linker.h | 3 + src/glsl/memory_map.h | 171 src/glsl/memory_writer.h | 188 + src/glsl/shader_cache.cpp | 734 + src/glsl/shader_cache.h| 58 +++ src/glsl/shader_cache_magic.h | 36 ++ src/mesa/main/config.h | 4 + src/mesa/main/shaderapi.c | 47 ++- src/mesa/program/hash_table.h | 8 + 17 files changed, 2781 insertions(+), 7 deletions(-) create mode 100644 src/glsl/ir_deserializer.cpp create mode 100644 src/glsl/ir_deserializer.h create mode 100644 src/glsl/ir_serialize.cpp create mode 100644 src/glsl/ir_serialize.h create mode 100644 src/glsl/memory_map.h create mode 100644 src/glsl/memory_writer.h create mode 100644 src/glsl/shader_cache.cpp create mode 100644 src/glsl/shader_cache.h create mode 100644 src/glsl/shader_cache_magic.h -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/10] glsl: memory_map helper class for data deserialization
Class will be used by the shader binary cache implementation. Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/glsl/memory_map.h | 171 ++ 1 file changed, 171 insertions(+) create mode 100644 src/glsl/memory_map.h diff --git a/src/glsl/memory_map.h b/src/glsl/memory_map.h new file mode 100644 index 000..dbfa48e --- /dev/null +++ b/src/glsl/memory_map.h @@ -0,0 +1,171 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2013 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#pragma once +#ifndef MEMORY_MAP_H +#define MEMORY_MAP_H + +#include stdint.h +#include string.h +#include ralloc.h + +#ifdef __cplusplus + +/** + * Helper class to read data + * + * Class reads data from user given memory. + */ +class memory_map +{ +public: + memory_map() : + error(false), + cache_size(0), + cache_mmap(NULL), + cache_mmap_p(NULL) + { + /* only used by read_string() */ + mem_ctx = ralloc_context(NULL); + } + + /* read from memory */ + void map(const void *memory, size_t size) + { + cache_mmap_p = cache_mmap = (char *) memory; + cache_size = size; + } + + /* wrap a portion from another map */ + void map(memory_map map, size_t size) + { + cache_mmap_p = cache_mmap = map.cache_mmap_p; + cache_size = size; + map.ffwd(size); + } + + ~memory_map() { + ralloc_free(mem_ctx); + } + + /* move read pointer forward */ + inline void ffwd(int len) + { + cache_mmap_p += len; + } + + inline void jump(unsigned pos) + { + cache_mmap_p = cache_mmap + pos; + } + + /** +* safety check to avoid reading over cache_size, +* returns bool if it is safe to continue reading +*/ + bool safe_read(unsigned size) + { + if (position() + size cache_size) + error = true; + return !error; + } + + /* position of read pointer */ + inline uint32_t position() + { + return cache_mmap_p - cache_mmap; + } + + inline char *read_string() + { + uint32_t len = read_uint32_t(); + + /* NULL pointer is supported */ + if (len == 0) + return NULL; + + /* verify that string is terminated after reported length */ + if (*(cache_mmap_p + len) != '\0') { + error = true; + return NULL; + } + + char *str = ralloc_strdup(mem_ctx, cache_mmap_p); + ffwd(len+1); + return str; + } + +/** + * read functions per type + */ +#define DECL_READER(type) type read_ ##type () {\ + if (!safe_read(sizeof(type)))\ + return 0;\ + ffwd(sizeof(type));\ + return *(type *) (cache_mmap_p - sizeof(type));\ +} + + DECL_READER(int32_t); + DECL_READER(int64_t); + DECL_READER(uint8_t); + DECL_READER(uint32_t); + + inline uint8_t read_bool() + { + return read_uint8_t(); + } + + inline void read(void *dst, size_t size) + { + if (!safe_read(size)) + return; + memcpy(dst, cache_mmap_p, size); + ffwd(size); + } + + /* total size of mapped memory */ + inline int32_t size() + { + return cache_size; + } + + inline bool errors() + { + return error; + } + +private: + + void *mem_ctx; + + /* if errors have occured during reading */ + bool error; + + unsigned cache_size; + char *cache_mmap; + char *cache_mmap_p; +}; +#endif /* ifdef __cplusplus */ + +#endif /* MEMORY_MAP_H */ -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/10] glsl: serialize methods for IR instructions
Patch adds a new virtual function for ir_instruction base class which has to be implemented by each instruction. This data will be used by the shader binary cache implementation. Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/glsl/Makefile.sources | 1 + src/glsl/ir.h | 45 + src/glsl/ir_serialize.cpp | 407 ++ src/glsl/ir_serialize.h | 36 4 files changed, 489 insertions(+) create mode 100644 src/glsl/ir_serialize.cpp create mode 100644 src/glsl/ir_serialize.h diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources index e69c1ac..24bb70f 100644 --- a/src/glsl/Makefile.sources +++ b/src/glsl/Makefile.sources @@ -45,6 +45,7 @@ LIBGLSL_FILES = \ $(GLSL_SRCDIR)/ir_reader.cpp \ $(GLSL_SRCDIR)/ir_rvalue_visitor.cpp \ $(GLSL_SRCDIR)/ir_set_program_inouts.cpp \ + $(GLSL_SRCDIR)/ir_serialize.cpp \ $(GLSL_SRCDIR)/ir_validate.cpp \ $(GLSL_SRCDIR)/ir_variable_refcount.cpp \ $(GLSL_SRCDIR)/linker.cpp \ diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 19e8383..1e31d70 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -35,6 +35,7 @@ #include ir_visitor.h #include ir_hierarchical_visitor.h #include main/mtypes.h +#include memory_writer.h #ifdef __cplusplus @@ -107,6 +108,10 @@ public: /** ir_print_visitor helper for debugging. */ void print(void) const; + /* serialization */ + void serialize(memory_writer mem); + virtual void serialize_data(memory_writer mem) = 0; + virtual void accept(ir_visitor *) = 0; virtual ir_visitor_status accept(ir_hierarchical_visitor *) = 0; virtual ir_instruction *clone(void *mem_ctx, @@ -167,6 +172,8 @@ public: virtual ir_rvalue *clone(void *mem_ctx, struct hash_table *) const; + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -379,6 +386,8 @@ public: return this; } + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -769,6 +778,8 @@ public: ir_function_signature *clone_prototype(void *mem_ctx, struct hash_table *ht) const; + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -900,6 +911,8 @@ public: return this; } + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -974,6 +987,8 @@ public: return this; } + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -998,6 +1013,8 @@ public: virtual ir_loop *clone(void *mem_ctx, struct hash_table *ht) const; + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -1033,6 +1050,8 @@ public: virtual ir_constant *constant_expression_value(struct hash_table *variable_context = NULL); + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -1459,6 +1478,8 @@ public: */ static ir_expression_operation get_operator(const char *); + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -1497,6 +1518,8 @@ public: return this; } + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -1583,6 +1606,8 @@ public: return value; } + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -1617,6 +1642,8 @@ public: virtual ir_loop_jump *clone(void *mem_ctx, struct hash_table *) const; + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -1657,6 +1684,8 @@ public: virtual ir_discard *clone(void *mem_ctx, struct hash_table *ht) const; + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -1729,6 +1758,8 @@ public: virtual ir_constant *constant_expression_value(struct hash_table *variable_context = NULL); + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -1840,6 +1871,8 @@ public: */ static ir_swizzle *create(ir_rvalue *, const char *, unsigned vector_length); + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -1943,6 +1976,8 @@ public: return this-var; } + virtual void serialize_data(memory_writer mem); + virtual void accept(ir_visitor *v) { v-visit(this); @@ -1992,6 +2027,8 @@ public: */ virtual
[Mesa-dev] [PATCH 06/10] glsl: add MAX_NUM_STATE_SLOTS and check against builtin uniform variables
Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/glsl/builtin_variables.cpp | 3 +++ src/mesa/main/config.h | 4 2 files changed, 7 insertions(+) diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index d6bc3c0..3e660af 100644 --- a/src/glsl/builtin_variables.cpp +++ b/src/glsl/builtin_variables.cpp @@ -494,6 +494,9 @@ builtin_variable_generator::add_uniform(const glsl_type *type, uni-state_slots = slots; + /* see main/config.h */ + assert(uni-num_state_slots = MAX_NUM_STATE_SLOTS); + for (unsigned a = 0; a array_count; a++) { for (unsigned j = 0; j statevar-num_elements; j++) { struct gl_builtin_uniform_element *element = statevar-elements[j]; diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 0c1782a..03fd9b3 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -290,5 +290,9 @@ */ #define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1) +/** + * Maximum number of builtin state backing up a uniform variable. + */ +#define MAX_NUM_STATE_SLOTS 96 #endif /* MESA_CONFIG_H_INCLUDED */ -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/10] glsl: functions to serialize gl_shader and gl_shader_program
These utility functions can be used to (de)serialize gl_shader and gl_shader_program structures. This makes it possible to implement a shader compiler cache for individual shaders and functionality required by OES_get_program_binary and ARB_get_program_binary extensions. Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/glsl/Makefile.sources | 1 + src/glsl/shader_cache.cpp | 734 ++ src/glsl/shader_cache.h | 58 3 files changed, 793 insertions(+) create mode 100644 src/glsl/shader_cache.cpp create mode 100644 src/glsl/shader_cache.h diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources index 3c49a58..f4a6eb2 100644 --- a/src/glsl/Makefile.sources +++ b/src/glsl/Makefile.sources @@ -103,6 +103,7 @@ LIBGLSL_FILES = \ $(GLSL_SRCDIR)/opt_tree_grafting.cpp \ $(GLSL_SRCDIR)/opt_vectorize.cpp \ $(GLSL_SRCDIR)/s_expression.cpp \ + $(GLSL_SRCDIR)/shader_cache.cpp \ $(GLSL_SRCDIR)/strtod.c # glsl_compiler diff --git a/src/glsl/shader_cache.cpp b/src/glsl/shader_cache.cpp new file mode 100644 index 000..c0675ff --- /dev/null +++ b/src/glsl/shader_cache.cpp @@ -0,0 +1,734 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2013 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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 main/shaderobj.h +#include main/uniforms.h +#include main/macros.h +#include program/hash_table.h +#include program/prog_parameter.h +#include ir_serialize.h +#include ir_deserializer.h +#include shader_cache_magic.h + + +static void +write_header(gl_shader *shader, memory_writer blob) +{ + GET_CURRENT_CONTEXT(ctx); + + blob.write_string(mesa_get_shader_cache_magic()); + blob.write_string((const char *)ctx-Driver.GetString(ctx, GL_VENDOR)); + blob.write_string((const char *)ctx-Driver.GetString(ctx, GL_RENDERER)); + blob.write_uint32_t(shader-Version); + blob.write_uint32_t(shader-Type); + blob.write_uint8_t(shader-IsES); +} + + +/* gl_program contains post-link data populated by the driver */ +static void +serialize_gl_program(struct gl_shader *shader, memory_writer blob) +{ + blob.write(shader-Program, sizeof(struct gl_program)); + blob.write_string((const char *)shader-Program-String); +} + + +static void +serialize_shader_postlink_data(struct gl_shader *shader, memory_writer blob) +{ + blob.write_uint32_t(shader-num_samplers); + blob.write_uint32_t(shader-active_samplers); + blob.write_uint32_t(shader-shadow_samplers); + blob.write_uint32_t(shader-num_uniform_components); + blob.write_uint32_t(shader-num_combined_uniform_components); + blob.write_uint8_t((uint8_t)shader-uses_builtin_functions); + + /* ARB_get_program_binary supports geometry shaders */ + blob.write(shader-Geom, sizeof(shader-Geom)); + + for (unsigned i = 0; i MAX_SAMPLERS; i++) + blob.write_uint8_t(shader-SamplerUnits[i]); + + for (unsigned i = 0; i MAX_SAMPLERS; i++) + blob.write_int32_t((int32_t)shader-SamplerTargets[i]); +} + + +/** + * Serializes gl_shader structure, writes shader header + * information and exec_list of instructions + */ +extern C char * +mesa_shader_serialize(struct gl_shader *shader, size_t *size) +{ + *size = 0; + + memory_writer blob; + + int32_t start_pos = blob.position(); + uint32_t shader_data_len = 0; + uint32_t shader_type = shader-Type; + + blob.write_uint32_t(shader_data_len); + blob.write_uint32_t(shader_type); + + write_header(shader, blob); + + /* misc required post-link data */ + serialize_shader_postlink_data(shader, blob); + + /* gl_program structure */ + serialize_gl_program(shader, blob); + + /* dump all shader instructions */ + serialize_list(shader-ir, blob); + + shader_data_len = blob.position() - + start_pos - sizeof(shader_data_len); + blob.overwrite(shader_data_len, sizeof(shader_data_len), start_pos); + + return
[Mesa-dev] [PATCH 07/10] glsl: ir_deserializer class for the binary shader cache
ir_deserializer fills existing gl_shader structure's ir exec_list from binary data, this will be used by shader binary cache implementation. Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/glsl/Makefile.sources| 1 + src/glsl/ir_deserializer.cpp | 910 +++ src/glsl/ir_deserializer.h | 133 +++ 3 files changed, 1044 insertions(+) create mode 100644 src/glsl/ir_deserializer.cpp create mode 100644 src/glsl/ir_deserializer.h diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources index 24bb70f..3c49a58 100644 --- a/src/glsl/Makefile.sources +++ b/src/glsl/Makefile.sources @@ -33,6 +33,7 @@ LIBGLSL_FILES = \ $(GLSL_SRCDIR)/ir_clone.cpp \ $(GLSL_SRCDIR)/ir_constant_expression.cpp \ $(GLSL_SRCDIR)/ir.cpp \ + $(GLSL_SRCDIR)/ir_deserializer.cpp \ $(GLSL_SRCDIR)/ir_equals.cpp \ $(GLSL_SRCDIR)/ir_expression_flattening.cpp \ $(GLSL_SRCDIR)/ir_function_can_inline.cpp \ diff --git a/src/glsl/ir_deserializer.cpp b/src/glsl/ir_deserializer.cpp new file mode 100644 index 000..c383f61 --- /dev/null +++ b/src/glsl/ir_deserializer.cpp @@ -0,0 +1,910 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2013 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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 ir_deserializer.h +#include shader_cache_magic.h + + +/** + * Searches for ir_function with matching signature from exec_list + */ +static ir_function * +search_func(struct _mesa_glsl_parse_state *state, struct exec_list *list, + const char *name, struct exec_list *parameters) +{ + foreach_list_safe(node, list) { + ir_function *func = ((ir_instruction *) node)-as_function(); + if (func strcmp(name, func-name) == 0 + func-matching_signature(state, parameters)) + return func; + } + return NULL; +} + +/** + * Helper function to read a list of instructions + */ +bool +ir_deserializer::deserialize_list(exec_list *list) +{ + uint32_t list_len = map-read_uint32_t(); + for (unsigned k = 0; k list_len; k++) + if (!read_instruction(list)) + return false; + return true; +} + + +const glsl_type * +ir_deserializer::read_glsl_type() +{ + char *name = map-read_string(); + uint32_t type_size = map-read_uint32_t(); + const glsl_type *ret_type = glsl_type::error_type; + + const glsl_type *existing_type = + state-symbols-get_type(name); + + /* if type exists, move read pointer forward and return type */ + if (existing_type) { + map-ffwd(type_size); + return existing_type; + } + + /* has this user type been read and stored to hash already? */ + uint8_t user_type_exists = map-read_uint8_t(); + uint32_t hash_sum = map-read_uint32_t(); + + if (user_type_exists) { + hash_entry *entry = _mesa_hash_table_search(type_ht, hash_value, + (void*) (uintptr_t) hash_sum); + + /* return already read type from the hash */ + if (entry entry-data) + return (const glsl_type *) entry-data; + else + return glsl_type::error_type; + } + + uint32_t length = map-read_uint32_t(); + uint8_t base_type = map-read_uint8_t(); + uint8_t interface_packing = map-read_uint8_t(); + + if (base_type = GLSL_TYPE_ERROR) + return glsl_type::error_type; + + /* array type has additional element_type information */ + if (base_type == GLSL_TYPE_ARRAY) { + const glsl_type *element_type = read_glsl_type(); + if (!element_type) { + CACHE_DEBUG(error reading array element type\n); + return NULL; + } + + ret_type = glsl_type::get_array_instance(element_type, length); + goto return_type; + } + + /* structures have fields containing of names and types */ + else if (base_type == GLSL_TYPE_STRUCT || + base_type == GLSL_TYPE_INTERFACE) { + glsl_struct_field *fields = ralloc_array(mem_ctx, + glsl_struct_field, length);
[Mesa-dev] [PATCH 08/10] mesa: iterate method for string_to_uint_map
Shader binary cache requires this to be able to cache hash data from the gl_shader_program structure. Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/mesa/program/hash_table.h | 8 1 file changed, 8 insertions(+) diff --git a/src/mesa/program/hash_table.h b/src/mesa/program/hash_table.h index e95fc49..ece43a1 100644 --- a/src/mesa/program/hash_table.h +++ b/src/mesa/program/hash_table.h @@ -229,6 +229,14 @@ public: } /** +* Runs a passed callback for the hash +*/ + void iterate(void (*func)(const void *, void *, void *), void *closure) + { + hash_table_call_foreach(this-ht, func, closure); + } + + /** * Get the value associated with a particular key * * \return -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/10] mesa: OES_get_program_binary extension functionality
Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/mesa/main/shaderapi.c | 47 +-- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 61ac0e3..582dfe2 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -57,6 +57,7 @@ #include ../glsl/ir.h #include ../glsl/ir_uniform.h #include ../glsl/program.h +#include ../glsl/shader_cache.h /** Define this to enable shader substitution (see below) */ #define SHADER_SUBST 0 @@ -1618,8 +1619,25 @@ _mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, if (length != NULL) *length = 0; - (void) binaryFormat; - (void) binary; + size_t size = 0; + char *data = mesa_program_serialize(shProg, size); + + /* we have more data that can fit to user given buffer */ + if (size bufSize) { + _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__); + free(data); + return; + } + + if (data) + memcpy(binary, data, size); + + free(data); + + if (length != NULL) + *length = size; + + *binaryFormat = 0; } void GLAPIENTRY @@ -1633,10 +1651,27 @@ _mesa_ProgramBinary(GLuint program, GLenum binaryFormat, if (!shProg) return; - (void) binaryFormat; - (void) binary; - (void) length; - _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__); + if (length = 0) + goto errors; + + /* free possible existing data and initialize structure */ + _mesa_free_shader_program_data(ctx, shProg); + _mesa_init_shader_program(ctx, shProg); + + /* fill structure from a binary blob */ + if (mesa_program_deserialize(shProg, binary, length)) + goto errors; + + assert(shProg-LinkStatus == GL_TRUE); + + return; + +errors: + /* on error set link status to false and clear the info log */ + shProg-LinkStatus = GL_FALSE; + if (shProg-InfoLog) + ralloc_free(shProg-InfoLog); + shProg-InfoLog = ralloc_strdup(shProg, ); } -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/dri: Allow creating OpenGL 3.3. core contexts
From: Michel Dänzer michel.daen...@amd.com Enables OpenGL 3.3 piglit tests. Signed-off-by: Michel Dänzer michel.daen...@amd.com --- src/gallium/state_trackers/dri/common/dri_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index 6b4c069..7a6dcb2 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.c +++ b/src/gallium/state_trackers/dri/common/dri_screen.c @@ -455,7 +455,7 @@ dri_init_screen_helper(struct dri_screen *screen, if (screen-st_api-profile_mask ST_PROFILE_DEFAULT_MASK) screen-sPriv-max_gl_compat_version = 30; if (screen-st_api-profile_mask ST_PROFILE_OPENGL_CORE_MASK) - screen-sPriv-max_gl_core_version = 32; + screen-sPriv-max_gl_core_version = 33; if (screen-st_api-profile_mask ST_PROFILE_OPENGL_ES1_MASK) screen-sPriv-max_gl_es1_version = 11; if (screen-st_api-profile_mask ST_PROFILE_OPENGL_ES2_MASK) -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 35268] initial-exec TLS model breaks dlopen'ed libGL
https://bugs.freedesktop.org/show_bug.cgi?id=35268 --- Comment #15 from Rich Felker bug...@aerifal.cx --- Hi. I'm the maintainer of musl and I'd like to confirm that we don't have plans to work around this on our side. musl aims to support extremely minimal thread stacks if desired by the application, and reserving a large amount of additional space like glibc does for late-loaded initial-exec TLS is contrary to that goal. I believe it's already possible for users to work around this issue by LD_PRELOAD'ing the library so that it gets assigned initial-exec TLS space at startup, but this has symbol visibility issues if the application only intended to use RTLD_LOCAL at dlopen time; we may consider adding another environment variable like LD_PRELOAD but which preloads the library with RTLD_LOCAL-like semantics, but this would still be an ugly hack and not a proper solution. Note that, at least as I understand it, the current approach that works with glibc is already fragile; if another library with large TLS needs gets loaded via dlopen before libGL.so, this may cause libGL.so to fail to load/work. What I'd like to propose as the solution is eliminating the use of __attribute__((tls_model(initial-exec))) and instead using -mtls-dialect=gnu2 on targets where it's supported. The gnu2 TLS dialect, documented at http://www.fsfla.org/~lxoliva/writeups/TLS/paper-gcc2006.pdf, http://www.fsfla.org/~lxoliva/writeups/TLS/RFC-TLSDESC-x86.txt, etc., allows libraries loaded at startup to achieve TLS access performance roughly equivalent to initial-exec despite using general-dynamic model. This level of performance is also possible via dlopen if the implementation is able to put the library's TLS in extra space reserved at startup (like glibc does in most cases). In all other cases, a variant of traditional general-dynamic model is used, so performance is sub-optimal, but it's still moderately better (IIRC, 15-30% less time for access) than the original general-dynamic model. So in summary, using gnu2 and leaving off the tls_model attribute instead of using initial-exec gives: - Essentially same performance when the library is pulled in at load time. - Essentially same performance when the library is dlopen'd and there's extra initial TLS space that can be assigned to it. - Working but with reduced performance, instead of complete failure, when the library is dlopen'd and there's no room in the initial TLS space to put its TLS there. Note that musl does not yet support the gnu2 TLS dialect, so for the time being, a way to turn off both the initial-exec hack AND the gnu2 dialect would be needed to solve the problem. But it's on our agenda, and having this issue with GL fixed via gnu2 dialect would draw more attention to getting it added. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2] R600/SI: Fix fneg for 0.0
From: Michel Dänzer michel.daen...@amd.com V_ADD_F32 with source modifier does not produce -0.0 for this. Just manipulate the sign bit directly instead. Also add a pattern for (fneg (fabs ...)). Fixes a bunch of bit encoding piglit tests with radeonsi. Signed-off-by: Michel Dänzer michel.daen...@amd.com --- v2: Fix up lit tests. lib/Target/R600/SIInstructions.td | 11 +--- test/CodeGen/R600/fabs.ll | 14 +- test/CodeGen/R600/fneg-fabs.ll| 55 +++ test/CodeGen/R600/fneg.ll | 14 +- 4 files changed, 76 insertions(+), 18 deletions(-) create mode 100644 test/CodeGen/R600/fneg-fabs.ll diff --git a/lib/Target/R600/SIInstructions.td b/lib/Target/R600/SIInstructions.td index 912b59a..43fe63c 100644 --- a/lib/Target/R600/SIInstructions.td +++ b/lib/Target/R600/SIInstructions.td @@ -1684,15 +1684,18 @@ def : Pat ; def : Pat + (fneg (fabs f32:$src)), + (V_OR_B32_e32 $src, (V_MOV_B32_e32 0x8000)) /* Set sign bit */ +; + +def : Pat (fabs f32:$src), - (V_ADD_F32_e64 $src, (i32 0 /* SRC1 */), - 1 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 0 /* NEG */) + (V_AND_B32_e32 $src, (V_MOV_B32_e32 0x7fff)) /* Clear sign bit */ ; def : Pat (fneg f32:$src), - (V_ADD_F32_e64 $src, (i32 0 /* SRC1 */), - 0 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 1 /* NEG */) + (V_XOR_B32_e32 $src, (V_MOV_B32_e32 0x8000)) /* Toggle sign bit */ ; /** == **/ diff --git a/test/CodeGen/R600/fabs.ll b/test/CodeGen/R600/fabs.ll index a5f5df9..2cd3a4f 100644 --- a/test/CodeGen/R600/fabs.ll +++ b/test/CodeGen/R600/fabs.ll @@ -9,7 +9,7 @@ ; R600-CHECK-NOT: AND ; R600-CHECK: |PV.{{[XYZW]}}| ; SI-CHECK-LABEL: @fabs_free -; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0 +; SI-CHECK: V_AND_B32 define void @fabs_free(float addrspace(1)* %out, i32 %in) { entry: @@ -23,8 +23,8 @@ entry: ; R600-CHECK: |{{(PV|T[0-9])\.[XYZW]}}| ; R600-CHECK: |{{(PV|T[0-9])\.[XYZW]}}| ; SI-CHECK-LABEL: @fabs_v2 -; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0 -; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0 +; SI-CHECK: V_AND_B32 +; SI-CHECK: V_AND_B32 define void @fabs_v2(2 x float addrspace(1)* %out, 2 x float %in) { entry: %0 = call 2 x float @llvm.fabs.v2f32(2 x float %in) @@ -38,10 +38,10 @@ entry: ; R600-CHECK: |{{(PV|T[0-9])\.[XYZW]}}| ; R600-CHECK: |{{(PV|T[0-9])\.[XYZW]}}| ; SI-CHECK-LABEL: @fabs_v4 -; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0 -; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0 -; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0 -; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0 +; SI-CHECK: V_AND_B32 +; SI-CHECK: V_AND_B32 +; SI-CHECK: V_AND_B32 +; SI-CHECK: V_AND_B32 define void @fabs_v4(4 x float addrspace(1)* %out, 4 x float %in) { entry: %0 = call 4 x float @llvm.fabs.v4f32(4 x float %in) diff --git a/test/CodeGen/R600/fneg-fabs.ll b/test/CodeGen/R600/fneg-fabs.ll new file mode 100644 index 000..d95e131 --- /dev/null +++ b/test/CodeGen/R600/fneg-fabs.ll @@ -0,0 +1,55 @@ +; RUN: llc %s -march=r600 -mcpu=redwood | FileCheck %s --check-prefix=R600-CHECK +; RUN: llc %s -march=r600 -mcpu=SI -verify-machineinstrs | FileCheck %s --check-prefix=SI-CHECK + +; DAGCombiner will transform: +; (fabs (f32 bitcast (i32 a))) = (f32 bitcast (and (i32 a), 0x7FFF)) +; unless isFabsFree returns true + +; R600-CHECK-LABEL: @fneg_fabs_free +; R600-CHECK-NOT: AND +; R600-CHECK: |PV.{{[XYZW]}}| +; R600-CHECK: -PV +; SI-CHECK-LABEL: @fneg_fabs_free +; SI-CHECK: V_OR_B32 + +define void @fneg_fabs_free(float addrspace(1)* %out, i32 %in) { +entry: + %0 = bitcast i32 %in to float + %1 = call float @fabs(float %0) + %2 = fsub float -0.00e+00, %1 + store float %2, float addrspace(1)* %out + ret void +} + +; R600-CHECK-LABEL: @fneg_fabs_v2 +; R600-CHECK: |{{(PV|T[0-9])\.[XYZW]}}| +; R600-CHECK: -PV +; R600-CHECK: |{{(PV|T[0-9])\.[XYZW]}}| +; R600-CHECK: -PV +; SI-CHECK-LABEL: @fneg_fabs_v2 +; SI-CHECK: V_OR_B32 +; SI-CHECK: V_OR_B32 +define void @fneg_fabs_v2(2 x float addrspace(1)* %out, 2 x float %in) { +entry: + %0 = call 2 x float @llvm.fabs.v2f32(2 x float %in) + %1 = fsub 2 x float float -0.00e+00, float -0.00e+00, %0 + store 2 x float %1, 2 x float addrspace(1)* %out + ret void +} + +; SI-CHECK-LABEL: @fneg_fabs_v4 +; SI-CHECK: V_OR_B32 +; SI-CHECK: V_OR_B32 +; SI-CHECK: V_OR_B32 +; SI-CHECK: V_OR_B32 +define void @fneg_fabs_v4(4 x float addrspace(1)* %out, 4 x float %in) { +entry: + %0 = call 4 x float @llvm.fabs.v4f32(4 x float %in) + %1 = fsub 4 x float float -0.00e+00, float -0.00e+00, float -0.00e+00, float -0.00e+00, %0 + store 4 x float %1, 4 x float addrspace(1)* %out + ret void +} + +declare float @fabs(float ) readnone +declare 2 x float @llvm.fabs.v2f32(2 x float ) readnone +declare 4 x float @llvm.fabs.v4f32(4 x float ) readnone
[Mesa-dev] [Bug 35268] initial-exec TLS model breaks dlopen'ed libGL
https://bugs.freedesktop.org/show_bug.cgi?id=35268 --- Comment #16 from Natanael Copa natanael.c...@gmail.com --- (In reply to comment #15) Note that, at least as I understand it, the current approach that works with glibc is already fragile; if another library with large TLS needs gets loaded via dlopen before libGL.so, this may cause libGL.so to fail to load/work. This should be fairly easy to test. If we add a dlopen of a dso that allocates slightly less than TLS_STATIC_SURPLUS before we dlopen the libGL we should trigger an dlopen error. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 35268] initial-exec TLS model breaks dlopen'ed libGL
https://bugs.freedesktop.org/show_bug.cgi?id=35268 --- Comment #17 from Natanael Copa natanael.c...@gmail.com --- Created attachment 92987 -- https://bugs.freedesktop.org/attachment.cgi?id=92987action=edit dso.c test dso that allocates big enough TLS variable. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 35268] initial-exec TLS model breaks dlopen'ed libGL
https://bugs.freedesktop.org/show_bug.cgi?id=35268 Natanael Copa natanael.c...@gmail.com changed: What|Removed |Added Attachment #92976|0 |1 is obsolete|| --- Comment #18 from Natanael Copa natanael.c...@gmail.com --- Created attachment 92988 -- https://bugs.freedesktop.org/attachment.cgi?id=92988action=edit updated app.c updated app.c that dlopens the dso.so before gltest. This should trigger the issue on glibc too. (I tested it on uclibc which has an NPTL implementation that is a copy of old version of glibc and it triggers it there). -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 35268] initial-exec TLS model breaks dlopen'ed libGL
https://bugs.freedesktop.org/show_bug.cgi?id=35268 Natanael Copa natanael.c...@gmail.com changed: What|Removed |Added Attachment #92977|0 |1 is obsolete|| --- Comment #19 from Natanael Copa natanael.c...@gmail.com --- Created attachment 92989 -- https://bugs.freedesktop.org/attachment.cgi?id=92989action=edit updated Makefile -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/dri: Allow creating OpenGL 3.3. core contexts
Reviewed-by: Marek Olšák marek.ol...@amd.com Marek On Wed, Jan 29, 2014 at 10:27 AM, Michel Dänzer mic...@daenzer.net wrote: From: Michel Dänzer michel.daen...@amd.com Enables OpenGL 3.3 piglit tests. Signed-off-by: Michel Dänzer michel.daen...@amd.com --- src/gallium/state_trackers/dri/common/dri_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index 6b4c069..7a6dcb2 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.c +++ b/src/gallium/state_trackers/dri/common/dri_screen.c @@ -455,7 +455,7 @@ dri_init_screen_helper(struct dri_screen *screen, if (screen-st_api-profile_mask ST_PROFILE_DEFAULT_MASK) screen-sPriv-max_gl_compat_version = 30; if (screen-st_api-profile_mask ST_PROFILE_OPENGL_CORE_MASK) - screen-sPriv-max_gl_core_version = 32; + screen-sPriv-max_gl_core_version = 33; if (screen-st_api-profile_mask ST_PROFILE_OPENGL_ES1_MASK) screen-sPriv-max_gl_es1_version = 11; if (screen-st_api-profile_mask ST_PROFILE_OPENGL_ES2_MASK) -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure: Enable large file support for the 32-bit platforms
On Tue, 14 Jan 2014 11:55:05 +0200 Lauri Kasanen c...@gmx.com wrote: 32-bit use is on the increase due to Steam; avoid any surprises and make Mesa LFS-aware. CC: 10.0 mesa-sta...@lists.freedesktop.org Signed-off-by: Lauri Kasanen c...@gmx.com --- configure.ac | 1 + 1 file changed, 1 insertion(+) Ping. Having this done in autoconf is much better than the current hardcoding done in vmware svga build files. It could be wrong for some systems, but as vmware only emulates x86 afaik it's merely ugly to have it hardcoded. - Lauri ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] dri2: Trust our own driver name lookup over the server's. breaks r600
Hi, Current master is broken for me starting from commit 7bd95ec437a5b1052fa17780a9d66677ec1fdc35 Author: Eric Anholt e...@anholt.net Date: Thu Jan 23 10:21:09 2014 -0800 dri2: Trust our own driver name lookup over the server's. I build without libudev, so it falls back to the kernel driver name radeon, which is obviously wrong (should be r600). Since apparently ARM platforms have the names in sync, how about a blacklist somewhere (ignore radeon)? - Lauri ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] r600g: Removed unnecessary positivity check for unsigned int variable.
Reviewed-by: Marek Olšák marek.ol...@amd.com Marek On Thu, Dec 12, 2013 at 3:58 PM, Siavash Eliasi siavashser...@gmail.com wrote: --- src/gallium/drivers/r600/r600_asm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 86f79e2..c5922a8 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -387,7 +387,7 @@ static int reserve_cfile(struct r600_bytecode *bc, struct alu_bank_swizzle *bs, static int is_gpr(unsigned sel) { - return (sel = 0 sel = 127); + return (sel = 127); } /* CB constants start at 512, and get translated to a kcache index when ALU -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallivm: fix opcode and function nesting
Am 28.01.2014 23:08, schrieb Zack Rusin: gallivm soa code supported only a single level of nesting for control flow opcodes (if, switch, loops...) but the d3d10 spec clearly states that those are nested within functions. To support nesting of conditionals inside functions we need to store the nesting data inside function contexts and keep a stack of those. Furthermore we make sure that if nesting for subroutines is deeper than 32 then we simply ignore all subsequent 'call' invocations. Hmm I thought nesting worked just fine, except for the fact that when using just one stack we'd have needed a much larger one. Wasn't that true? (Not arguing about using per-function stacks, just curious.) Signed-off-by: Zack Rusin za...@vmware.com --- src/gallium/auxiliary/gallivm/lp_bld_tgsi.h | 72 ++--- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 377 2 files changed, 292 insertions(+), 157 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h index 4f988b8..839ab85 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h @@ -260,49 +260,51 @@ struct lp_exec_mask { LLVMTypeRef int_vec_type; - LLVMValueRef cond_stack[LP_MAX_TGSI_NESTING]; - int cond_stack_size; - LLVMValueRef cond_mask; - - /* keep track if break belongs to switch or loop */ - enum lp_exec_mask_break_type break_type_stack[LP_MAX_TGSI_NESTING]; - enum lp_exec_mask_break_type break_type; + LLVMValueRef exec_mask; - struct { - LLVMValueRef switch_val; - LLVMValueRef switch_mask; - LLVMValueRef switch_mask_default; - boolean switch_in_default; - unsigned switch_pc; - } switch_stack[LP_MAX_TGSI_NESTING]; - int switch_stack_size; - LLVMValueRef switch_val; + LLVMValueRef ret_mask; + LLVMValueRef cond_mask; LLVMValueRef switch_mask; /* current switch exec mask */ - LLVMValueRef switch_mask_default; /* reverse of switch mask used for default */ - boolean switch_in_default;/* if switch exec is currently in default */ - unsigned switch_pc; /* when used points to default or endswitch-1 */ - - LLVMBasicBlockRef loop_block; LLVMValueRef cont_mask; LLVMValueRef break_mask; - LLVMValueRef break_var; - struct { - LLVMBasicBlockRef loop_block; - LLVMValueRef cont_mask; - LLVMValueRef break_mask; - LLVMValueRef break_var; - } loop_stack[LP_MAX_TGSI_NESTING]; - int loop_stack_size; - LLVMValueRef ret_mask; - struct { + struct function_ctx { int pc; LLVMValueRef ret_mask; - } call_stack[LP_MAX_TGSI_NESTING]; - int call_stack_size; - LLVMValueRef exec_mask; - LLVMValueRef loop_limiter; + LLVMValueRef cond_stack[LP_MAX_TGSI_NESTING]; + int cond_stack_size; + + /* keep track if break belongs to switch or loop */ + enum lp_exec_mask_break_type break_type_stack[LP_MAX_TGSI_NESTING]; + enum lp_exec_mask_break_type break_type; + + struct { + LLVMValueRef switch_val; + LLVMValueRef switch_mask; + LLVMValueRef switch_mask_default; + boolean switch_in_default; + unsigned switch_pc; + } switch_stack[LP_MAX_TGSI_NESTING]; + int switch_stack_size; + LLVMValueRef switch_val; + LLVMValueRef switch_mask_default; /* reverse of switch mask used for default */ + boolean switch_in_default;/* if switch exec is currently in default */ + unsigned switch_pc; /* when used points to default or endswitch-1 */ + + LLVMValueRef loop_limiter; + LLVMBasicBlockRef loop_block; + LLVMValueRef break_var; + struct { + LLVMBasicBlockRef loop_block; + LLVMValueRef cont_mask; + LLVMValueRef break_mask; + LLVMValueRef break_var; + } loop_stack[LP_MAX_TGSI_NESTING]; + int loop_stack_size; + + } *function_stack; + int function_stack_size; }; struct lp_build_tgsi_inst_list diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index f01b50c..52e1b51 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -66,6 +66,10 @@ #include lp_bld_sample.h #include lp_bld_struct.h +/* SM 4.0 says that subroutines can nest 32 deep and + * we need one more for our main function */ +#define LP_MAX_NUM_FUNCS 33 + #define DUMP_GS_EMITS 0 /* @@ -98,38 +102,108 @@ emit_dump_reg(struct gallivm_state *gallivm, lp_build_print_value(gallivm, buf, value); } +static INLINE struct function_ctx * +func_ctx(struct lp_exec_mask *mask) +{ + assert(mask-function_stack_size 0); + assert(mask-function_stack_size = LP_MAX_NUM_FUNCS); + return
[Mesa-dev] [PATCH] nv30: report the correct max varying limit
nvfx_fragprog_assign_generic only allows for up to 10/8 texcoords for nv40/nv30. This fixes compilation of the varying-packing tests (although they still fail). Signed-off-by: Ilia Mirkin imir...@alum.mit.edu Cc: 9.1 9.2 10.0 mesa-sta...@lists.freedesktop.org --- src/gallium/drivers/nouveau/nv30/nv30_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 26ad33d..9ce10a4 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -219,7 +219,7 @@ nv30_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH: return 0; case PIPE_SHADER_CAP_MAX_INPUTS: - return (eng3d-oclass = NV40_3D_CLASS) ? 12 : 10; + return (eng3d-oclass = NV40_3D_CLASS) ? 10 : 8; case PIPE_SHADER_CAP_MAX_CONSTS: return (eng3d-oclass = NV40_3D_CLASS) ? 224 : 32; case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] egl/glx: Remove egl_glx driver
On 01/29/2014 09:25 AM, Chad Versace wrote: Mesa now has a real, feature-rich EGL implementation on X11 via xcb. Therefore I believe there is no longer a practical need for the egl_glx driver. Furthermore, egl_glx appears to be unmaintained. The most recent nontrivial commit driver was 6baa5f1 on 2011-11-25. Signed-off-by: Chad Versace chad.vers...@linux.intel.com Acked-by: Kenneth Graunke kenn...@whitecape.org signature.asc Description: OpenPGP digital signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] dir-locals.el: Set indent-tabs-mode true for makefile-mode
Makefiles need hard tabs, let's not make that harder than it needs to be. Signed-off-by: Kristian Høgsberg k...@bitplanet.net --- .dir-locals.el | 1 + 1 file changed, 1 insertion(+) diff --git a/.dir-locals.el b/.dir-locals.el index 4f0ad7a..04a1a2c 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -8,4 +8,5 @@ (c-set-offset 'innamespace '0) (c-set-offset 'inline-open '0))) ) + (makefile-mode (indent-tabs-mode . t)) ) -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] dir-locals.el: Set indent-tabs-mode true for makefile-mode
On Wed, Jan 29, 2014 at 10:30 AM, Kristian Høgsberg k...@bitplanet.net wrote: Makefiles need hard tabs, let's not make that harder than it needs to be. Signed-off-by: Kristian Høgsberg k...@bitplanet.net --- .dir-locals.el | 1 + 1 file changed, 1 insertion(+) diff --git a/.dir-locals.el b/.dir-locals.el index 4f0ad7a..04a1a2c 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -8,4 +8,5 @@ (c-set-offset 'innamespace '0) (c-set-offset 'inline-open '0))) ) + (makefile-mode (indent-tabs-mode . t)) ) -- 1.8.4.2 Yes, thanks. Reviewed-by: Matt Turner matts...@gmail.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] glcpp: Allow integer expression for #line directive.
Matt Turner matts...@gmail.com writes: -| LINE_EXPANDED integer_constant integer_constant NEWLINE { +| LINE_EXPANDED expression integer_constant NEWLINE { shouldn't this should be LINE_EXPANDED expression expression NEWLINE Yes. Thanks for the catch. I'll expand the testing and follow up with a new set of patches. -Carl -- carl.d.wo...@intel.com pgpqoxoIeXe9J.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallivm: fix opcode and function nesting
- Original Message - Am 28.01.2014 23:08, schrieb Zack Rusin: gallivm soa code supported only a single level of nesting for control flow opcodes (if, switch, loops...) but the d3d10 spec clearly states that those are nested within functions. To support nesting of conditionals inside functions we need to store the nesting data inside function contexts and keep a stack of those. Furthermore we make sure that if nesting for subroutines is deeper than 32 then we simply ignore all subsequent 'call' invocations. Hmm I thought nesting worked just fine, except for the fact that when using just one stack we'd have needed a much larger one. Wasn't that true? (Not arguing about using per-function stacks, just curious.) The issue is that d3d10 spec is very specific about the nesting requirement being per-subroutine. So just increasing those nesting levels wouldn't really work, because 63 levels in one subroutine and 65 in another doesn't necessarily equal code path that has 64 levels in two subroutines (even both have technically 64 levels) - we get away with it for conditionals but not for function calls. It's also worth noting that the patch handles overflows which whck explicitly tests for and we were just crashing on those. The overflow behavior is unidentified only for conditionals, subroutine calls above the level 32 /have/ to be ignored (again whck tests for it). + ctx-loop_stack[ctx-loop_stack_size].loop_block = ctx-loop_block; + ctx-loop_stack[ctx-loop_stack_size].cont_mask = mask-cont_mask; + ctx-loop_stack[ctx-loop_stack_size].break_mask = mask-break_mask; I am confused why some assignments use the variables from ctx and some from mask here. The masks are in general global (the 'call' opcode could have been inside switch'es, loops or/and conditionals) so the function contexts push/pop the global masks and need to operate on those. Things that are not masks are in general per-function-context, which means that we can just store them in function contexts. As mentioned inline, I don't quite get when the values from mask or ctx are used. This might well be correct as this is tricky stuff and the diff is difficult to understand. Otherwise this looks good to me. Would that also help when we'd switch to not always inline all functions? Yea, I think it would, but then we would need a lot of other changes (storing those masks in some struct inside some global object that each function can reference). But yea, this code isn't the cleanest but function calls, conditionals, loops and switches are inherently difficult in SoA mode so there's not a lot we can do. We need to store the nesting data inside something that resembles function context because d3d is very clear that that's what it wants so everything else we'll be a hack where we just try to imitate that behavior that's going to be uglier than this code. z ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] What use do swap interval 1 and OML_sync_control divisor and remainder have?
On Fri, Jan 24, 2014 at 4:32 AM, Pekka Paalanen ppaala...@gmail.com wrote: Hi, I am investigating what kind of Wayland protocol extensions would be needed to support proper presentation timing. Looking at existing works, I am wondering about two things whether they have any real use. Where is swap interval (e.g. eglSwapInterval) greater than one useful? Intervals 0 and 1 I understand, and Mesa EGL Wayland already supports those. But when would you like to make your framerate a fraction of the display's? To save power. To target 30 Hz when you can't hit 60 Hz and would otherwise get 45 Hz (and the corresponding jitter because you alternate 1 vblank per frame - 2 vblanks per frame). When are the target-MSC related remainder and divisor parameters as defined in the GLX_OML_sync_control useful? Why does also X11 Present protocol include remainder and divisor? GLX_OML_sync_control defines that for interlaced displays MSC is incremented for each field. With divisor and remainder you could then target only top or bottom fields. Is that useful, and do we care about interlaced displays anymore? 1080i, which is the preferred resolution for a lot of TVs. I am contemplating on not supporting these, because I am going to propose using an UST-like clock as the standard clock language in Wayland present extension. Supporting MSC-based timings would add complexity. Therefore I would like to know where and how the above mentioned are useful, because I cannot imagine it myself. You can look in Chrome for an interesting use of GLX_OML_sync_control (look for sync_control_vsync_provider.cc) . It is used to schedule the rendering of the next frame without incurring too much latency, while keeping a constant swap delay (to avoid the 45 Hz phenomenon, and to buffer as many updates as possible before starting to draw without missing the frame). Granted, there are some shortcomings (multi-monitor is one, as the extension doesn't support those) but overall it helps. Stéphane Please, let me know of real actual use cases and existing software, where these features offer a visible benefit and what that benefit is exactly. I am not interested in what one might do in theory, I am interested in real-world examples where they have proved useful. Well, maybe also theories if they allow taking advantage of some new cool technology. Btw. if you think that using UST for presentation timing and feedback is nonsense, and MSC is the only right way, let me know and I can start another email thread about that detail after preparing my material. Thanks, pq ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] build: Share the all-local rule for linking libraries into the build dir
This consolidates how we link the libraries. It only works for lib_LTLIBRARIES, ie not for custom shared libraries like DRI drivers or gallium state trackers. Signed-off-by: Kristian Høgsberg k...@bitplanet.net --- We could do something like this to avoid the problem in the future. Kristian install-lib-links.mk | 14 ++ src/egl/main/Makefile.am | 7 +-- src/gbm/Makefile.am | 5 + src/glx/Makefile.am | 7 +-- src/mapi/es1api/Makefile.am | 8 +--- src/mapi/es2api/Makefile.am | 8 +--- src/mapi/shared-glapi/Makefile.am | 6 +- src/mapi/vgapi/Makefile.am| 8 +--- 8 files changed, 21 insertions(+), 42 deletions(-) create mode 100644 install-lib-links.mk diff --git a/install-lib-links.mk b/install-lib-links.mk new file mode 100644 index 000..73d9e14 --- /dev/null +++ b/install-lib-links.mk @@ -0,0 +1,14 @@ +# Provide compatibility with scripts for the old Mesa build system for +# a while by putting a link to the driver into /lib of the build tree. + +all-local : .libs/install-mesa-links + +.libs/install-mesa-links : $(lib_LTLIBRARIES) + $(MKDIR_P) $(top_builddir)/$(LIB_DIR) + for f in $(lib_LTLIBRARIES:%.la=.libs/%.so*); do\ + if test -h .libs/$$f; then \ + cp -d $$f $(top_builddir)/$(LIB_DIR); \ + else\ + ln -f $$f $(top_builddir)/$(LIB_DIR); \ + fi; \ + done touch $@ diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am index e12aeae..4c20d12 100644 --- a/src/egl/main/Makefile.am +++ b/src/egl/main/Makefile.am @@ -115,12 +115,7 @@ libEGL_la_LIBADD += ../drivers/dri2/libegl_dri2.la libEGL_la_LIBADD += $(DLOPEN_LIBS) $(LIBDRM_LIBS) endif -# Provide compatibility with scripts for the old Mesa build system for -# a while by putting a link to the driver into /lib of the build tree. -all-local: libEGL.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR); - ln -f .libs/libEGL.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libEGL.so.1 - ln -sf libEGL.so.1 $(top_builddir)/$(LIB_DIR)/libEGL.so +include $(top_srcdir)/install-lib-links.mk pkgconfigdir = $(libdir)/pkgconfig diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am index de5126c..eacb96a 100644 --- a/src/gbm/Makefile.am +++ b/src/gbm/Makefile.am @@ -47,7 +47,4 @@ libgbm_la_LIBADD += \ libgbm_dri.la $(top_builddir)/src/mapi/shared-glapi/libglapi.la $(LIBDRM_LIBS) endif -all-local: libgbm.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR); - ln -f .libs/libgbm.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libgbm.so - ln -f .libs/libgbm.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libgbm.so.1 +include $(top_srcdir)/install-lib-links.mk diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am index 54a0cc0..c8dfb86 100644 --- a/src/glx/Makefile.am +++ b/src/glx/Makefile.am @@ -118,9 +118,4 @@ lib@GL_LIB@_la_SOURCES = lib@GL_LIB@_la_LIBADD = $(GL_LIBS) lib@GL_LIB@_la_LDFLAGS = $(GL_LDFLAGS) -# Provide compatibility with scripts for the old Mesa build system for -# a while by putting a link to the driver into /lib of the build tree. -all-local: lib@GL_LIB@.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR); - ln -f .libs/lib@GL_LIB@.so.1.2.0 $(top_builddir)/$(LIB_DIR)/lib@GL_LIB@.so.1 - ln -sf lib@GL_LIB@.so.1 $(top_builddir)/$(LIB_DIR)/lib@GL_LIB@.so +include $(top_srcdir)/install-lib-links.mk diff --git a/src/mapi/es1api/Makefile.am b/src/mapi/es1api/Makefile.am index eb98f16..b61f9cb 100644 --- a/src/mapi/es1api/Makefile.am +++ b/src/mapi/es1api/Makefile.am @@ -57,10 +57,4 @@ glapi_mapi_tmp.h: ../glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps) BUILT_SOURCES = glapi_mapi_tmp.h CLEANFILES = $(BUILT_SOURCES) -# Provide compatibility with scripts for the old Mesa build system for -# a while by putting a link to the driver into /lib of the build tree. -all-local: libGLESv1_CM.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR); - ln -f .libs/libGLESv1_CM.so $(top_builddir)/$(LIB_DIR)/libGLESv1_CM.so - ln -f .libs/libGLESv1_CM.so.1 $(top_builddir)/$(LIB_DIR)/libGLESv1_CM.so.1 - ln -f .libs/libGLESv1_CM.so.1.1.0 $(top_builddir)/$(LIB_DIR)/libGLESv1_CM.so.1.1.0 +include $(top_srcdir)/install-lib-links.mk diff --git a/src/mapi/es2api/Makefile.am b/src/mapi/es2api/Makefile.am index c6b0ca4..a944493 100644 --- a/src/mapi/es2api/Makefile.am +++ b/src/mapi/es2api/Makefile.am @@ -61,10 +61,4 @@ glapi_mapi_tmp.h: ../glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps) BUILT_SOURCES = glapi_mapi_tmp.h CLEANFILES = $(BUILT_SOURCES) -# Provide compatibility with scripts for the old Mesa build system for -# a while by putting a link to the driver into /lib of the build tree. -all-local: libGLESv2.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR); - ln -f
Re: [Mesa-dev] [PATCH] build: Share the all-local rule for linking libraries into the build dir
On Wed, Jan 29, 2014 at 11:50 AM, Kristian Høgsberg k...@bitplanet.net wrote: This consolidates how we link the libraries. It only works for lib_LTLIBRARIES, ie not for custom shared libraries like DRI drivers or gallium state trackers. Signed-off-by: Kristian Høgsberg k...@bitplanet.net --- We could do something like this to avoid the problem in the future. Kristian install-lib-links.mk | 14 ++ src/egl/main/Makefile.am | 7 +-- src/gbm/Makefile.am | 5 + src/glx/Makefile.am | 7 +-- src/mapi/es1api/Makefile.am | 8 +--- src/mapi/es2api/Makefile.am | 8 +--- src/mapi/shared-glapi/Makefile.am | 6 +- src/mapi/vgapi/Makefile.am| 8 +--- 8 files changed, 21 insertions(+), 42 deletions(-) create mode 100644 install-lib-links.mk diff --git a/install-lib-links.mk b/install-lib-links.mk new file mode 100644 index 000..73d9e14 --- /dev/null +++ b/install-lib-links.mk @@ -0,0 +1,14 @@ +# Provide compatibility with scripts for the old Mesa build system for +# a while by putting a link to the driver into /lib of the build tree. + +all-local : .libs/install-mesa-links + +.libs/install-mesa-links : $(lib_LTLIBRARIES) + $(MKDIR_P) $(top_builddir)/$(LIB_DIR) + for f in $(lib_LTLIBRARIES:%.la=.libs/%.so*); do\ + if test -h .libs/$$f; then \ + cp -d $$f $(top_builddir)/$(LIB_DIR); \ + else\ + ln -f $$f $(top_builddir)/$(LIB_DIR); \ + fi; \ + done touch $@ Oh, that's nice. I like this idea a lot. Reviewed-by: Matt Turner matts...@gmail.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] egl/dri2/android: free driver_name in dri2_initialize_android error path
v2: Cleanup driver name if dri2_load_driver() fails. Spotted by Chad Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- Hmm... I swear I had that hunk in mind when writing the patch. Or maybe I was day dreaming. Thanks Chad -Emil src/egl/drivers/dri2/platform_android.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 4a201c8..cc19a61 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -682,7 +682,7 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy) if (!dri2_load_driver(dpy)) { err = DRI2: failed to load driver; - goto cleanup_device; + goto cleanup_driver_name; } dri2_dpy-dri2_loader_extension.base.name = __DRI_DRI2_LOADER; @@ -722,6 +722,8 @@ cleanup_screen: dri2_dpy-core-destroyScreen(dri2_dpy-dri_screen); cleanup_driver: dlclose(dri2_dpy-driver); +cleanup_driver_name: + free(dri2_dpy-driver_name); cleanup_device: close(dri2_dpy-fd); cleanup_display: -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] egl/glx: Remove egl_glx driver
On Wed, Jan 29, 2014 at 9:25 AM, Chad Versace chad.vers...@linux.intel.com wrote: Mesa now has a real, feature-rich EGL implementation on X11 via xcb. Therefore I believe there is no longer a practical need for the egl_glx driver. Furthermore, egl_glx appears to be unmaintained. The most recent nontrivial commit driver was 6baa5f1 on 2011-11-25. Signed-off-by: Chad Versace chad.vers...@linux.intel.com --- In a similar vein -- is gallium_egl useful for anything these days? The only time I hear it mentioned is when telling others to not use it. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/8] opencl: do not link against libudev
Previously the linking was required due to dependency of udev in the pipe-loader. Now this is no longer the case, as we dlopen the library. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- src/gallium/targets/opencl/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/targets/opencl/Makefile.am b/src/gallium/targets/opencl/Makefile.am index 653302c..d0275ae 100644 --- a/src/gallium/targets/opencl/Makefile.am +++ b/src/gallium/targets/opencl/Makefile.am @@ -11,7 +11,7 @@ lib@OPENCL_LIBNAME@_la_LIBADD = \ $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \ $(top_builddir)/src/gallium/state_trackers/clover/libclover.la \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ - $(GALLIUM_PIPE_LOADER_LIBS) $(LIBUDEV_LIBS) \ + $(GALLIUM_PIPE_LOADER_LIBS) \ -ldl \ -lclangCodeGen \ -lclangFrontendTool \ -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 7/8] gbm: drop unneeded dependency of libudev
As of recently we dlopen the library, additionally the only code that is including the libudev.h header, is the loader. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- src/gallium/targets/gbm/Makefile.am | 2 -- src/gbm/Makefile.am | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/gallium/targets/gbm/Makefile.am b/src/gallium/targets/gbm/Makefile.am index 4299d07..6d71a65 100644 --- a/src/gallium/targets/gbm/Makefile.am +++ b/src/gallium/targets/gbm/Makefile.am @@ -34,7 +34,6 @@ AM_CPPFLAGS = \ AM_CFLAGS = \ $(GALLIUM_CFLAGS) \ - $(LIBUDEV_CFLAGS) \ $(LIBDRM_CFLAGS) gbm_LTLIBRARIES = gbm_gallium_drm.la @@ -47,7 +46,6 @@ gbm_gallium_drm_la_LIBADD = \ $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \ $(top_builddir)/src/gallium/state_trackers/gbm/libgbm.la \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ - $(LIBUDEV_LIBS) \ $(LIBDRM_LIBS) \ -lm diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am index de5126c..2b02365 100644 --- a/src/gbm/Makefile.am +++ b/src/gbm/Makefile.am @@ -9,7 +9,6 @@ AM_CFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/loader \ -I$(top_srcdir)/src/gbm/main \ - $(LIBUDEV_CFLAGS) \ $(LIBKMS_CFLAGS) \ $(DLOPEN_CFLAGS) \ $(DEFINES) @@ -23,7 +22,6 @@ libgbm_la_SOURCES = \ libgbm_la_LDFLAGS = -version-info 1:0 libgbm_la_LIBADD = \ $(top_builddir)/src/loader/libloader.la \ - $(LIBUDEV_LIBS) \ $(LIBKMS_LIBS) \ $(DLOPEN_LIBS) -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 8/8] configure: cleanup libudev handling
Add the explicit note about the required version during configure. Require the same version (151) of udev when building the pipe-loader. Mention the udev version requirement in GBM Requires.private. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- configure.ac | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 994b3b2..98beafd 100644 --- a/configure.ac +++ b/configure.ac @@ -1174,7 +1174,7 @@ if test x$enable_gbm = xauto; then fi if test x$enable_gbm = xyes; then if test x$have_libudev != xyes; then -AC_MSG_ERROR([gbm needs udev]) +AC_MSG_ERROR([gbm requires udev = $LIBUDEV_REQUIRED]) fi if test x$enable_dri = xyes; then @@ -1185,7 +1185,7 @@ if test x$enable_gbm = xyes; then fi fi AM_CONDITIONAL(HAVE_GBM, test x$enable_gbm = xyes) -GBM_PC_REQ_PRIV=libudev +GBM_PC_REQ_PRIV=libudev = LIBUDEV_REQUIRED GBM_PC_LIB_PRIV=$DLOPEN_LIBS AC_SUBST([GBM_PC_REQ_PRIV]) AC_SUBST([GBM_PC_LIB_PRIV]) @@ -1458,7 +1458,7 @@ for plat in $egl_platforms; do case $plat$have_libudev in waylandno|drmno) -AC_MSG_ERROR([cannot build $plat platfrom without udev]) ;; +AC_MSG_ERROR([cannot build $plat platfrom without udev = $LIBUDEV_REQUIRED]) ;; esac done @@ -1697,8 +1697,9 @@ gallium_require_llvm() { gallium_require_drm_loader() { if test x$enable_gallium_loader = xyes; then -PKG_CHECK_MODULES([LIBUDEV], [libudev], [], - AC_MSG_ERROR([Gallium drm loader requires libudev])) +if x$have_libudev != xyes; then +AC_MSG_ERROR([Gallium drm loader requires libudev = LIBUDEV_REQUIRED])) +fi if test x$have_libdrm != xyes; then AC_MSG_ERROR([Gallium drm loader requires libdrm = $LIBDRM_REQUIRED]) fi -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/8] egl_dri2: remove LIBUDEV_CFLAGS from Makefile.am
None of the code within builds or (explicitly) requires udev. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- src/egl/drivers/dri2/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/src/egl/drivers/dri2/Makefile.am b/src/egl/drivers/dri2/Makefile.am index 6a9ae50..a95cfa4 100644 --- a/src/egl/drivers/dri2/Makefile.am +++ b/src/egl/drivers/dri2/Makefile.am @@ -31,7 +31,6 @@ AM_CFLAGS = \ $(DEFINES) \ $(VISIBILITY_CFLAGS) \ $(LIBDRM_CFLAGS) \ - $(LIBUDEV_CFLAGS) \ $(LIBKMS_CFLAGS) \ -DDEFAULT_DRIVER_DIR=\$(DRI_DRIVER_SEARCH_DIR)\ -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/8] Cleanup usage of libudev CFLAGS and linking
Hello list, Now that everything libudev related is moved to src/loader and we handle the library by dlopen-ing it, we can cleanup a few includes, CFLAGS and LIBS that were behind. The final commit adds explicit version check for udev, where is was missing. It should not cause any issues, but worth mentioning. Note the scons build requires an older version of udev than automake (150 vs 151), but afaics this should not cause problems. -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/8] pipe-loader: drop obsolete libudev.h include
All the udev code is in the loader, so there is no reason for us to include this header. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c index d6869fd..597a9b5 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c @@ -32,7 +32,6 @@ #include fcntl.h #include stdio.h -#include libudev.h #include xf86drm.h #ifdef HAVE_PIPE_LOADER_XCB -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/8] gallium/tests: do not link against libudev
Previously the linking was required due to dependency of udev in the pipe-loader. Now this is no longer the case, as we dlopen the library. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- src/gallium/tests/trivial/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/tests/trivial/Makefile.am b/src/gallium/tests/trivial/Makefile.am index d65eb86..0702f68 100644 --- a/src/gallium/tests/trivial/Makefile.am +++ b/src/gallium/tests/trivial/Makefile.am @@ -15,7 +15,6 @@ LDADD = $(GALLIUM_PIPE_LOADER_LIBS) \ $(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \ $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ - $(LIBUDEV_LIBS) \ $(DLOPEN_LIBS) \ $(PTHREAD_LIBS) \ -lm -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/8] egl-static: stop linking against libudev
No longer required since all the udev code is in the loader. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- src/gallium/targets/egl-static/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/targets/egl-static/Makefile.am b/src/gallium/targets/egl-static/Makefile.am index 73bb795..166e9a1 100644 --- a/src/gallium/targets/egl-static/Makefile.am +++ b/src/gallium/targets/egl-static/Makefile.am @@ -63,7 +63,6 @@ egl_gallium_la_LIBADD = \ $(top_builddir)/src/egl/main/libEGL.la \ $(top_builddir)/src/loader/libloader.la \ $(CLOCK_LIB) \ - $(LIBUDEV_LIBS) \ $(DLOPEN_LIBS) \ $(PTHREAD_LIBS) \ -lm -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/8] configure: drop LIBUDEV_CFLAGS from X11_INCLUDES
The cflags are explicitly included in the only Makefile that handles udev dependant code. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- configure.ac | 5 - 1 file changed, 5 deletions(-) diff --git a/configure.ac b/configure.ac index ba158e8..994b3b2 100644 --- a/configure.ac +++ b/configure.ac @@ -856,11 +856,6 @@ xyesno) X11_INCLUDES=$X11_INCLUDES $DRIGL_CFLAGS GL_LIB_DEPS=$DRIGL_LIBS -if test x$enable_dri3$have_libudev = xyesyes; then -X11_INCLUDES=$X11_INCLUDES $LIBUDEV_CFLAGS -GL_LIB_DEPS=$GL_LIB_DEPS -fi - # need DRM libs, $PTHREAD_LIBS, etc. GL_LIB_DEPS=$GL_LIB_DEPS $LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS GL_PC_LIB_PRIV=-lm $PTHREAD_LIBS $DLOPEN_LIBS -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] configure: cleanup libudev handling
On Wed, Jan 29, 2014 at 3:23 PM, Emil Velikov emil.l.veli...@gmail.com wrote: Add the explicit note about the required version during configure. Require the same version (151) of udev when building the pipe-loader. Mention the udev version requirement in GBM Requires.private. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- configure.ac | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 994b3b2..98beafd 100644 --- a/configure.ac +++ b/configure.ac @@ -1174,7 +1174,7 @@ if test x$enable_gbm = xauto; then fi if test x$enable_gbm = xyes; then if test x$have_libudev != xyes; then -AC_MSG_ERROR([gbm needs udev]) +AC_MSG_ERROR([gbm requires udev = $LIBUDEV_REQUIRED]) fi if test x$enable_dri = xyes; then @@ -1185,7 +1185,7 @@ if test x$enable_gbm = xyes; then fi fi AM_CONDITIONAL(HAVE_GBM, test x$enable_gbm = xyes) -GBM_PC_REQ_PRIV=libudev +GBM_PC_REQ_PRIV=libudev = LIBUDEV_REQUIRED Can't say I'm much of an autoconf expert, but should this be $LIBUDEV_REQUIRED? Similarly below. GBM_PC_LIB_PRIV=$DLOPEN_LIBS AC_SUBST([GBM_PC_REQ_PRIV]) AC_SUBST([GBM_PC_LIB_PRIV]) @@ -1458,7 +1458,7 @@ for plat in $egl_platforms; do case $plat$have_libudev in waylandno|drmno) -AC_MSG_ERROR([cannot build $plat platfrom without udev]) ;; +AC_MSG_ERROR([cannot build $plat platfrom without udev = $LIBUDEV_REQUIRED]) ;; esac done @@ -1697,8 +1697,9 @@ gallium_require_llvm() { gallium_require_drm_loader() { if test x$enable_gallium_loader = xyes; then -PKG_CHECK_MODULES([LIBUDEV], [libudev], [], - AC_MSG_ERROR([Gallium drm loader requires libudev])) +if x$have_libudev != xyes; then +AC_MSG_ERROR([Gallium drm loader requires libudev = LIBUDEV_REQUIRED])) +fi if test x$have_libdrm != xyes; then AC_MSG_ERROR([Gallium drm loader requires libdrm = $LIBDRM_REQUIRED]) fi -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] configure: cleanup libudev handling
On 29/01/14 20:25, Ilia Mirkin wrote: On Wed, Jan 29, 2014 at 3:23 PM, Emil Velikov emil.l.veli...@gmail.com wrote: Add the explicit note about the required version during configure. Require the same version (151) of udev when building the pipe-loader. Mention the udev version requirement in GBM Requires.private. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- configure.ac | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 994b3b2..98beafd 100644 --- a/configure.ac +++ b/configure.ac @@ -1174,7 +1174,7 @@ if test x$enable_gbm = xauto; then fi if test x$enable_gbm = xyes; then if test x$have_libudev != xyes; then -AC_MSG_ERROR([gbm needs udev]) +AC_MSG_ERROR([gbm requires udev = $LIBUDEV_REQUIRED]) fi if test x$enable_dri = xyes; then @@ -1185,7 +1185,7 @@ if test x$enable_gbm = xyes; then fi fi AM_CONDITIONAL(HAVE_GBM, test x$enable_gbm = xyes) -GBM_PC_REQ_PRIV=libudev +GBM_PC_REQ_PRIV=libudev = LIBUDEV_REQUIRED Can't say I'm much of an autoconf expert, but should this be $LIBUDEV_REQUIRED? Similarly below. Dough... you are right, seems like a copy/paste slip-up. -Emil GBM_PC_LIB_PRIV=$DLOPEN_LIBS AC_SUBST([GBM_PC_REQ_PRIV]) AC_SUBST([GBM_PC_LIB_PRIV]) @@ -1458,7 +1458,7 @@ for plat in $egl_platforms; do case $plat$have_libudev in waylandno|drmno) -AC_MSG_ERROR([cannot build $plat platfrom without udev]) ;; +AC_MSG_ERROR([cannot build $plat platfrom without udev = $LIBUDEV_REQUIRED]) ;; esac done @@ -1697,8 +1697,9 @@ gallium_require_llvm() { gallium_require_drm_loader() { if test x$enable_gallium_loader = xyes; then -PKG_CHECK_MODULES([LIBUDEV], [libudev], [], - AC_MSG_ERROR([Gallium drm loader requires libudev])) +if x$have_libudev != xyes; then +AC_MSG_ERROR([Gallium drm loader requires libudev = LIBUDEV_REQUIRED])) +fi if test x$have_libdrm != xyes; then AC_MSG_ERROR([Gallium drm loader requires libdrm = $LIBDRM_REQUIRED]) fi -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glcpp: Reject #version after the version has been resolved.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74166 --- src/glsl/glcpp/glcpp-parse.y | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 17bc649..4dba051 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -375,9 +375,15 @@ control_line: _glcpp_parser_skip_stack_pop (parser, @1); } NEWLINE | HASH_VERSION integer_constant NEWLINE { + if (parser-version_resolved) { + glcpp_error( @1, parser, #version after version is resolved); + } _glcpp_parser_handle_version_declaration(parser, $2, NULL, true); } | HASH_VERSION integer_constant IDENTIFIER NEWLINE { + if (parser-version_resolved) { + glcpp_error( @1, parser, #version after version is resolved); + } _glcpp_parser_handle_version_declaration(parser, $2, $3, true); } | HASH NEWLINE { -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] configure: cleanup libudev handling
On Wed, Jan 29, 2014 at 3:23 PM, Emil Velikov emil.l.veli...@gmail.com wrote: Add the explicit note about the required version during configure. Require the same version (151) of udev when building the pipe-loader. Mention the udev version requirement in GBM Requires.private. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- configure.ac | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 994b3b2..98beafd 100644 --- a/configure.ac +++ b/configure.ac @@ -1174,7 +1174,7 @@ if test x$enable_gbm = xauto; then fi if test x$enable_gbm = xyes; then if test x$have_libudev != xyes; then -AC_MSG_ERROR([gbm needs udev]) +AC_MSG_ERROR([gbm requires udev = $LIBUDEV_REQUIRED]) fi if test x$enable_dri = xyes; then @@ -1185,7 +1185,7 @@ if test x$enable_gbm = xyes; then fi fi AM_CONDITIONAL(HAVE_GBM, test x$enable_gbm = xyes) -GBM_PC_REQ_PRIV=libudev +GBM_PC_REQ_PRIV=libudev = LIBUDEV_REQUIRED GBM_PC_LIB_PRIV=$DLOPEN_LIBS AC_SUBST([GBM_PC_REQ_PRIV]) AC_SUBST([GBM_PC_LIB_PRIV]) @@ -1458,7 +1458,7 @@ for plat in $egl_platforms; do case $plat$have_libudev in waylandno|drmno) -AC_MSG_ERROR([cannot build $plat platfrom without udev]) ;; +AC_MSG_ERROR([cannot build $plat platfrom without udev = $LIBUDEV_REQUIRED]) ;; esac done @@ -1697,8 +1697,9 @@ gallium_require_llvm() { gallium_require_drm_loader() { if test x$enable_gallium_loader = xyes; then -PKG_CHECK_MODULES([LIBUDEV], [libudev], [], - AC_MSG_ERROR([Gallium drm loader requires libudev])) +if x$have_libudev != xyes; then Also this should be if test x$have_libudev != xyes; then or if [ x$have_libudev (since [ is a symlink to test... but that doesn't seem to be the style used here). Otherwise you will end up with a xyes: command not found error. +AC_MSG_ERROR([Gallium drm loader requires libudev = LIBUDEV_REQUIRED])) +fi if test x$have_libdrm != xyes; then AC_MSG_ERROR([Gallium drm loader requires libdrm = $LIBDRM_REQUIRED]) fi -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 74166] piglit CorrectVersion1.V110 regression regression
https://bugs.freedesktop.org/show_bug.cgi?id=74166 Matt Turner matts...@gmail.com changed: What|Removed |Added Assignee|mesa-dev@lists.freedesktop. |matts...@gmail.com |org | CC||mesa-dev@lists.freedesktop. ||org URL||http://patchwork.freedeskto ||p.org/patch/19014/ --- Comment #1 from Matt Turner matts...@gmail.com --- Patch on the list. Thanks for the report! -- You are receiving this mail because: You are on the CC list for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/35] mesa: Make target_enum_to_index available outside texobj.c
From: Ian Romanick ian.d.roman...@intel.com The next patch will use this function in another file. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/main/texobj.c | 6 +++--- src/mesa/main/texobj.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 24ffc89..f6fe09d 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1198,8 +1198,8 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) * Note that proxy targets are not valid here. * \return TEXTURE_x_INDEX or -1 if target is invalid */ -static GLint -target_enum_to_index(const struct gl_context *ctx, GLenum target) +int +_mesa_target_enum_to_index(const struct gl_context *ctx, GLenum target) { switch (target) { case GL_TEXTURE_1D: @@ -1270,7 +1270,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) _mesa_debug(ctx, glBindTexture %s %d\n, _mesa_lookup_enum_by_nr(target), (GLint) texName); - targetIndex = target_enum_to_index(ctx, target); + targetIndex = _mesa_target_enum_to_index(ctx, target); if (targetIndex 0) { _mesa_error(ctx, GL_INVALID_ENUM, glBindTexture(target)); return; diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index 55091a6..525585a 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -54,6 +54,9 @@ _mesa_initialize_texture_object( struct gl_context *ctx, struct gl_texture_object *obj, GLuint name, GLenum target ); +extern int +_mesa_target_enum_to_index(const struct gl_context *ctx, GLenum target); + extern void _mesa_delete_texture_object( struct gl_context *ctx, struct gl_texture_object *obj ); -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 21/35] meta: Use common vertex setup code for _mesa_meta_Bitmap too
From: Ian Romanick ian.d.roman...@intel.com Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 48 +++--- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 2f87d0d..a987fd7 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2946,9 +2946,6 @@ _mesa_meta_Bitmap(struct gl_context *ctx, const GLenum texIntFormat = GL_ALPHA; const struct gl_pixelstore_attrib unpackSave = *unpack; GLubyte fg, bg; - struct vertex { - GLfloat x, y, z, s, t, r, g, b, a; - }; struct vertex verts[4]; GLboolean newTex; GLubyte *bitmap8; @@ -2982,34 +2979,13 @@ _mesa_meta_Bitmap(struct gl_context *ctx, MESA_META_VERTEX | MESA_META_VIEWPORT)); - if (bitmap-ArrayObj == 0) { - /* one-time setup */ - - /* create vertex array object */ - _mesa_GenVertexArrays(1, bitmap-ArrayObj); - _mesa_BindVertexArray(bitmap-ArrayObj); - - /* create vertex array buffer */ - _mesa_GenBuffers(1, bitmap-VBO); - _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, bitmap-VBO); - _mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts), - NULL, GL_DYNAMIC_DRAW_ARB); - - /* setup vertex arrays */ - _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x)); - _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s)); - _mesa_ColorPointer(4, GL_FLOAT, sizeof(struct vertex), OFFSET(r)); - _mesa_EnableClientState(GL_VERTEX_ARRAY); - _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); - _mesa_EnableClientState(GL_COLOR_ARRAY); - } - else { - _mesa_BindVertexArray(bitmap-ArrayObj); - _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, bitmap-VBO); - } + setup_vertex_objects(bitmap-ArrayObj, bitmap-VBO, false, 3, 2, 4); newTex = alloc_texture(tex, width, height, texIntFormat); + /* Silence valgrind warnings about reading uninitialized stack. */ + memset(verts, 0, sizeof(verts)); + /* vertex positions, texcoords, colors (after texture allocation!) */ { const GLfloat x0 = (GLfloat) x; @@ -3022,23 +2998,23 @@ _mesa_meta_Bitmap(struct gl_context *ctx, verts[0].x = x0; verts[0].y = y0; verts[0].z = z; - verts[0].s = 0.0F; - verts[0].t = 0.0F; + verts[0].tex[0] = 0.0F; + verts[0].tex[1] = 0.0F; verts[1].x = x1; verts[1].y = y0; verts[1].z = z; - verts[1].s = tex-Sright; - verts[1].t = 0.0F; + verts[1].tex[0] = tex-Sright; + verts[1].tex[1] = 0.0F; verts[2].x = x1; verts[2].y = y1; verts[2].z = z; - verts[2].s = tex-Sright; - verts[2].t = tex-Ttop; + verts[2].tex[0] = tex-Sright; + verts[2].tex[1] = tex-Ttop; verts[3].x = x0; verts[3].y = y1; verts[3].z = z; - verts[3].s = 0.0F; - verts[3].t = tex-Ttop; + verts[3].tex[0] = 0.0F; + verts[3].tex[1] = tex-Ttop; for (i = 0; i 4; i++) { verts[i].r = ctx-Current.RasterColor[0]; -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/35] mesa: Use common _mesa_target_enum_to_index in tex param code
From: Ian Romanick ian.d.roman...@intel.com TEXTURE_BUFFER_INDEX has to be specially called out because it is not allowed in any of the glTexParameter or glGetTexParameter functions. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/main/texparam.c | 66 ++-- 1 file changed, 8 insertions(+), 58 deletions(-) diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index e915ddd..bb720cd 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -126,6 +126,7 @@ static struct gl_texture_object * get_texobj(struct gl_context *ctx, GLenum target, GLboolean get) { struct gl_texture_unit *texUnit; + int targetIndex; if (ctx-Texture.CurrentUnit = ctx-Const.MaxCombinedTextureImageUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -135,66 +136,15 @@ get_texobj(struct gl_context *ctx, GLenum target, GLboolean get) texUnit = _mesa_get_current_tex_unit(ctx); - switch (target) { - case GL_TEXTURE_1D: - if (_mesa_is_desktop_gl(ctx)) - return texUnit-CurrentTex[TEXTURE_1D_INDEX]; - break; - case GL_TEXTURE_2D: - return texUnit-CurrentTex[TEXTURE_2D_INDEX]; - case GL_TEXTURE_3D: - if (ctx-API != API_OPENGLES) - return texUnit-CurrentTex[TEXTURE_3D_INDEX]; - break; - case GL_TEXTURE_CUBE_MAP: - if (ctx-Extensions.ARB_texture_cube_map) { - return texUnit-CurrentTex[TEXTURE_CUBE_INDEX]; - } - break; - case GL_TEXTURE_RECTANGLE_NV: - if (_mesa_is_desktop_gl(ctx) - ctx-Extensions.NV_texture_rectangle) { - return texUnit-CurrentTex[TEXTURE_RECT_INDEX]; - } - break; - case GL_TEXTURE_1D_ARRAY_EXT: - if (_mesa_is_desktop_gl(ctx) ctx-Extensions.EXT_texture_array) { - return texUnit-CurrentTex[TEXTURE_1D_ARRAY_INDEX]; - } - break; - case GL_TEXTURE_2D_ARRAY_EXT: - if ((_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) - ctx-Extensions.EXT_texture_array) { - return texUnit-CurrentTex[TEXTURE_2D_ARRAY_INDEX]; - } - break; - case GL_TEXTURE_EXTERNAL_OES: - if (_mesa_is_gles(ctx) ctx-Extensions.OES_EGL_image_external) { - return texUnit-CurrentTex[TEXTURE_EXTERNAL_INDEX]; - } - break; - case GL_TEXTURE_CUBE_MAP_ARRAY: - if (ctx-Extensions.ARB_texture_cube_map_array) { - return texUnit-CurrentTex[TEXTURE_CUBE_ARRAY_INDEX]; - } - break; - case GL_TEXTURE_2D_MULTISAMPLE: - if (ctx-Extensions.ARB_texture_multisample) { - return texUnit-CurrentTex[TEXTURE_2D_MULTISAMPLE_INDEX]; - } - break; - case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: - if (ctx-Extensions.ARB_texture_multisample) { - return texUnit-CurrentTex[TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX]; - } - break; - default: - ; + targetIndex = _mesa_target_enum_to_index(ctx, target); + if (targetIndex 0 || targetIndex == TEXTURE_BUFFER_INDEX) { + _mesa_error(ctx, GL_INVALID_ENUM, + gl%sTexParameter(target), get ? Get : ); + return NULL; } + assert(targetIndex NUM_TEXTURE_TARGETS); - _mesa_error(ctx, GL_INVALID_ENUM, - gl%sTexParameter(target), get ? Get : ); - return NULL; + return texUnit-CurrentTex[targetIndex]; } -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 18/35] meta: Clean up stray binding calls
From: Ian Romanick ian.d.roman...@intel.com Clean up a few stray calls to _mesa_BindVertexArray and _mesa_BindBuffer that are no longer necessary after the previous refactor. Note: This should get squashed in with the previous commit when the series is pushed. --- src/mesa/drivers/common/meta.c | 21 - 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 3661173..e03267e 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1727,9 +1727,6 @@ blitframebuffer_texture(struct gl_context *ctx, setup_ff_blit_framebuffer(ctx-Meta-Blit); } - _mesa_BindVertexArray(blit-ArrayObj); - _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, blit-VBO); - _mesa_GenSamplers(1, sampler); _mesa_BindSampler(ctx-Texture.CurrentUnit, sampler); @@ -1909,9 +1906,6 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, setup_ff_blit_framebuffer(blit); } - _mesa_BindVertexArray(blit-ArrayObj); - _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, blit-VBO); - /* Silence valgrind warnings about reading uninitialized stack. */ memset(verts, 0, sizeof(verts)); @@ -2199,12 +2193,11 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) GLuint vs, gs = 0, fs; bool has_integer_textures; - if (clear-ArrayObj != 0) - return; - - /* create vertex array object */ setup_vertex_objects(clear-ArrayObj, clear-VBO, true, 3, 0, 0); + if (clear-ShaderProg != 0) + return; + vs = _mesa_CreateShaderObjectARB(GL_VERTEX_SHADER); _mesa_ShaderSource(vs, 1, vs_source, NULL); _mesa_CompileShader(vs); @@ -2365,9 +2358,6 @@ _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers) ctx-Color.ClearColor.f); } - _mesa_BindVertexArray(clear-ArrayObj); - _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, clear-VBO); - /* GL_COLOR_BUFFER_BIT */ if (buffers BUFFER_BITS_COLOR) { /* leave colormask, glDrawBuffer state as-is */ @@ -3364,7 +3354,7 @@ setup_texture_coords(GLenum faceTarget, static void setup_ff_generate_mipmap(struct gen_mipmap_state *mipmap) { - setup_vertex_objects(mipmap-ArrayObj, mipmap-VBO, false, 2, 3); + setup_vertex_objects(mipmap-ArrayObj, mipmap-VBO, false, 2, 3, 0); /* setup projection matrix */ _mesa_MatrixMode(GL_PROJECTION); @@ -3591,9 +3581,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, _mesa_set_enable(ctx, target, GL_TRUE); } - _mesa_BindVertexArray(mipmap-ArrayObj); - _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, mipmap-VBO); - samplerSave = ctx-Texture.Unit[ctx-Texture.CurrentUnit].Sampler ? ctx-Texture.Unit[ctx-Texture.CurrentUnit].Sampler-Name : 0; -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 31/35] meta: Enable cubemap array texture support to decompress_texture_image
From: Ian Romanick ian.d.roman...@intel.com Fixed piglit test getteximage-targets S3TC CUBE_ARRAY on systems that don't have libtxc_dxtn installed. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 500311d..5237f2f 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -3879,7 +3879,8 @@ decompress_texture_image(struct gl_context *ctx, if (slice 0) { assert(target == GL_TEXTURE_3D || - target == GL_TEXTURE_2D_ARRAY); + target == GL_TEXTURE_2D_ARRAY || + target == GL_TEXTURE_CUBE_MAP_ARRAY); } switch (target) { @@ -3893,8 +3894,8 @@ decompress_texture_image(struct gl_context *ctx, return; case GL_TEXTURE_CUBE_MAP_ARRAY: - /* This target is just broken currently. */ - return; + faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + (slice % 6); + break; case GL_TEXTURE_CUBE_MAP: faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage-Face; @@ -3943,7 +3944,7 @@ decompress_texture_image(struct gl_context *ctx, struct glsl_sampler *sampler; setup_vertex_objects(decompress-ArrayObj, decompress-VBO, true, - 2, 3, 0); + 2, 4, 0); /* Generate a relevant fragment shader program for the texture target */ sampler = setup_texture_sampler(target, decompress-samplers); @@ -4095,8 +4096,7 @@ _mesa_meta_GetTexImage(struct gl_context *ctx, * unsigned, normalized values. We could handle signed and unnormalized * with floating point renderbuffers... */ - if (texImage-TexObject-Target != GL_TEXTURE_CUBE_MAP_ARRAY -_mesa_is_format_compressed(texImage-TexFormat) + if (_mesa_is_format_compressed(texImage-TexFormat) _mesa_get_format_datatype(texImage-TexFormat) == GL_UNSIGNED_NORMALIZED) { struct gl_texture_object *texObj = texImage-TexObject; @@ -4105,7 +4105,8 @@ _mesa_meta_GetTexImage(struct gl_context *ctx, _mesa_unlock_texture(ctx, texObj); for (slice = 0; slice texImage-Depth; slice++) { void *dst; - if (texImage-TexObject-Target == GL_TEXTURE_2D_ARRAY) { + if (texImage-TexObject-Target == GL_TEXTURE_2D_ARRAY + || texImage-TexObject-Target == GL_TEXTURE_CUBE_MAP_ARRAY) { /* Setup pixel packing. SkipPixels and SkipRows will be applied * in the decompress_texture_image() function's call to * glReadPixels but we need to compute the dest slice's address -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 11/35] meta: Expand the vertex structure for the BlitFramebuffer paths
From: Ian Romanick ian.d.roman...@intel.com This is the first of several steps leading to some code sharing. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 66 +++--- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 8d9a037..bcd2b81 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1459,7 +1459,7 @@ static void setup_ff_blit_framebuffer(struct blit_state *blit) { struct vertex { - GLfloat x, y, s, t; + GLfloat x, y, z, tex[4]; }; struct vertex verts[4]; @@ -1478,7 +1478,7 @@ setup_ff_blit_framebuffer(struct blit_state *blit) /* setup vertex arrays */ _mesa_VertexPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(x)); - _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s)); + _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(tex)); _mesa_EnableClientState(GL_VERTEX_ARRAY); _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); } @@ -1496,7 +1496,7 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx, GLenum target) { struct vertex { - GLfloat x, y, s, t; + GLfloat x, y, z, tex[4]; }; struct vertex verts[4]; const char *vs_source; @@ -1526,7 +1526,7 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx, _mesa_VertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(struct vertex), OFFSET(x)); _mesa_VertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, - sizeof(struct vertex), OFFSET(s)); + sizeof(struct vertex), OFFSET(tex)); _mesa_EnableVertexAttribArray(0); _mesa_EnableVertexAttribArray(1); @@ -1727,7 +1727,7 @@ blitframebuffer_texture(struct gl_context *ctx, /* Prepare vertex data (the VBO was previously created and bound) */ { struct vertex { - GLfloat x, y, s, t; + GLfloat x, y, z, tex[4]; }; struct vertex verts[4]; GLfloat s0, t0, s1, t1; @@ -1748,6 +1748,9 @@ blitframebuffer_texture(struct gl_context *ctx, t1 = (float) srcY1; } +/* Silence valgrind warnings about reading uninitialized stack. */ +memset(verts, 0, sizeof(verts)); + /* setup vertex positions */ verts[0].x = -1.0F * flipX; verts[0].y = -1.0F * flipY; @@ -1758,14 +1761,14 @@ blitframebuffer_texture(struct gl_context *ctx, verts[3].x = -1.0F * flipX; verts[3].y = 1.0F * flipY; -verts[0].s = s0; -verts[0].t = t0; -verts[1].s = s1; -verts[1].t = t0; -verts[2].s = s1; -verts[2].t = t1; -verts[3].s = s0; -verts[3].t = t1; +verts[0].tex[0] = s0; +verts[0].tex[1] = t0; +verts[1].tex[0] = s1; +verts[1].tex[1] = t0; +verts[2].tex[0] = s1; +verts[2].tex[1] = t1; +verts[3].tex[0] = s0; +verts[3].tex[1] = t1; _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); } @@ -1826,7 +1829,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, const GLint flipY = srcFlipY * dstFlipY; struct vertex { - GLfloat x, y, s, t; + GLfloat x, y, z, tex[4]; }; struct vertex verts[4]; GLboolean newTex; @@ -1875,6 +1878,9 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, _mesa_BindVertexArray(blit-ArrayObj); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, blit-VBO); + /* Silence valgrind warnings about reading uninitialized stack. */ + memset(verts, 0, sizeof(verts)); + /* Continue with normal approach which involves copying the src rect * into a temporary texture and is blitted by drawing a textured quad. */ @@ -1913,14 +1919,14 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, rb_base_format, filter); /* texcoords (after texture allocation!) */ { - verts[0].s = 1.0F; - verts[0].t = 1.0F; - verts[1].s = tex-Sright - 1.0F; - verts[1].t = 1.0F; - verts[2].s = tex-Sright - 1.0F; - verts[2].t = tex-Ttop - 1.0F; - verts[3].s = 1.0F; - verts[3].t = tex-Ttop - 1.0F; + verts[0].tex[0] = 1.0F; + verts[0].tex[1] = 1.0F; + verts[1].tex[0] = tex-Sright - 1.0F; + verts[1].tex[1] = 1.0F; + verts[2].tex[0] = tex-Sright - 1.0F; + verts[2].tex[1] = tex-Ttop - 1.0F; + verts[3].tex[0] = 1.0F; + verts[3].tex[1] = tex-Ttop - 1.0F; /* upload new vertex data */ _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); @@
[Mesa-dev] [PATCH 15/35] meta: Expand the vertex structure for the GenerateMipmap and decompress paths
From: Ian Romanick ian.d.roman...@intel.com Final intermediate step leading to some code sharing. Note that the new GemerateMipmap and decompress vertex structures are the same as the new vertex structure in BlitFramebuffer and the others. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 29 + 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 889948f..fb58b42 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -3249,10 +3249,10 @@ setup_texture_coords(GLenum faceTarget, GLint width, GLint height, GLint depth, - GLfloat coords0[3], - GLfloat coords1[3], - GLfloat coords2[3], - GLfloat coords3[3]) + GLfloat coords0[4], + GLfloat coords1[4], + GLfloat coords2[4], + GLfloat coords3[4]) { static const GLfloat st[4][2] = { {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f} @@ -3260,6 +3260,13 @@ setup_texture_coords(GLenum faceTarget, GLuint i; GLfloat r; + /* Currently all texture targets want the W component to be 1.0. +*/ + coords0[3] = 1.0F; + coords1[3] = 1.0F; + coords2[3] = 1.0F; + coords3[3] = 1.0F; + switch (faceTarget) { case GL_TEXTURE_1D: case GL_TEXTURE_2D: @@ -3396,7 +3403,7 @@ static void setup_ff_generate_mipmap(struct gen_mipmap_state *mipmap) { struct vertex { - GLfloat x, y, tex[3]; + GLfloat x, y, z, tex[4]; }; if (mipmap-ArrayObj == 0) { @@ -3473,7 +3480,7 @@ setup_glsl_generate_mipmap(struct gl_context *ctx, GLenum target) { struct vertex { - GLfloat x, y, tex[3]; + GLfloat x, y, z, tex[4]; }; struct glsl_sampler *sampler; const char *vs_source; @@ -3619,7 +3626,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, { struct gen_mipmap_state *mipmap = ctx-Meta-Mipmap; struct vertex { - GLfloat x, y, tex[3]; + GLfloat x, y, z, tex[4]; }; struct vertex verts[4]; const GLuint baseLevel = texObj-BaseLevel; @@ -3709,6 +3716,9 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, else assert(!genMipmapSave); + /* Silence valgrind warnings about reading uninitialized stack. */ + memset(verts, 0, sizeof(verts)); + /* Setup texture coordinates */ setup_texture_coords(faceTarget, slice, @@ -4018,7 +4028,7 @@ decompress_texture_image(struct gl_context *ctx, const GLenum target = texObj-Target; GLenum faceTarget; struct vertex { - GLfloat x, y, tex[3]; + GLfloat x, y, z, tex[4]; }; struct vertex verts[4]; GLuint fboDrawSave, fboReadSave; @@ -4127,6 +4137,9 @@ decompress_texture_image(struct gl_context *ctx, _mesa_BindSampler(ctx-Texture.CurrentUnit, decompress-Sampler); } + /* Silence valgrind warnings about reading uninitialized stack. */ + memset(verts, 0, sizeof(verts)); + setup_texture_coords(faceTarget, slice, width, height, depth, verts[0].tex, verts[1].tex, -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 26/35] meta: Use common GLSL code for blits
From: Ian Romanick ian.d.roman...@intel.com Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 108 + 1 file changed, 13 insertions(+), 95 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 380ee32..363b1ac 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -247,8 +247,7 @@ struct blit_state GLuint ArrayObj; GLuint VBO; GLuint DepthFP; - GLuint ShaderProg; - GLuint RectShaderProg; + struct sampler_table samplers; struct temp_texture depthTex; }; @@ -487,6 +486,7 @@ setup_shader_for_sampler(struct gl_context *ctx, struct glsl_sampler *sampler) void main()\n {\n gl_FragColor = %s(texSampler, %s);\n + gl_FragDepth = gl_FragColor.x;\n }\n, sampler-type, sampler-func, sampler-texcoords); @@ -515,6 +515,7 @@ setup_shader_for_sampler(struct gl_context *ctx, struct glsl_sampler *sampler) void main()\n {\n out_color = texture(texSampler, %s);\n + gl_FragDepth = out_color.x;\n }\n, _mesa_is_desktop_gl(ctx) ? 130 : 300 es, sampler-type, @@ -1662,98 +1663,18 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx, struct blit_state *blit, GLenum target) { - const char *vs_source; - char *fs_source; - GLuint vs, fs; - void *mem_ctx; - GLuint ShaderProg; - GLboolean texture_2d = (target == GL_TEXTURE_2D); + struct glsl_sampler *sampler; /* target = GL_TEXTURE_RECTANGLE is not supported in GLES 3.0 */ - assert(_mesa_is_desktop_gl(ctx) || texture_2d); + assert(_mesa_is_desktop_gl(ctx) || target == GL_TEXTURE_2D); setup_vertex_objects(blit-ArrayObj, blit-VBO, true, 2, 2, 0); /* Generate a relevant fragment shader program for the texture target */ - if ((target == GL_TEXTURE_2D blit-ShaderProg != 0) || - (target == GL_TEXTURE_RECTANGLE blit-RectShaderProg != 0)) { - return; - } - - mem_ctx = ralloc_context(NULL); - - if (ctx-Const.GLSLVersion 130) { - vs_source = - attribute vec2 position;\n - attribute vec2 textureCoords;\n - varying vec2 texCoords;\n - void main()\n - {\n -texCoords = textureCoords;\n -gl_Position = vec4(position, 0.0, 1.0);\n - }\n; - - fs_source = ralloc_asprintf(mem_ctx, - #ifdef GL_ES\n - precision highp float;\n - #endif\n - uniform %s texSampler;\n - varying vec2 texCoords;\n - void main()\n - {\n - gl_FragColor = %s(texSampler, texCoords);\n - gl_FragDepth = gl_FragColor.r;\n - }\n, - texture_2d ? sampler2D : sampler2DRect, - texture_2d ? texture2D : texture2DRect); - } - else { - vs_source = ralloc_asprintf(mem_ctx, - #version %s\n - in vec2 position;\n - in vec2 textureCoords;\n - out vec2 texCoords;\n - void main()\n - {\n - texCoords = textureCoords;\n - gl_Position = vec4(position, 0.0, 1.0);\n - }\n, - _mesa_is_desktop_gl(ctx) ? 130 : 300 es); - fs_source = ralloc_asprintf(mem_ctx, - #version %s\n - #ifdef GL_ES\n - precision highp float;\n - #endif\n - uniform %s texSampler;\n - in vec2 texCoords;\n - out vec4 out_color;\n - \n - void main()\n - {\n - out_color = %s(texSampler, texCoords);\n - gl_FragDepth = out_color.r;\n - }\n, -
[Mesa-dev] [PATCH 06/35] meta: Fallback to software for GetTexImage of compressed GL_TEXTURE_CUBE_MAP_ARRAY
From: Ian Romanick ian.d.roman...@intel.com The hardware decompression path isn't even close to being able to handle this. This converts the crash (assertion failure) in EXT_texture_compression_s3tc/getteximage-targets S3TC CUBE_ARRAY to a plain old failure. Signed-off-by: Ian Romanick ian.d.roman...@intel.com Cc: 9.1 9.2 10.0 mesa-sta...@lists.freedesktop.org --- src/mesa/drivers/common/meta.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 6185e80..b898a27 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -4219,7 +4219,8 @@ _mesa_meta_GetTexImage(struct gl_context *ctx, * unsigned, normalized values. We could handle signed and unnormalized * with floating point renderbuffers... */ - if (_mesa_is_format_compressed(texImage-TexFormat) + if (texImage-TexObject-Target != GL_TEXTURE_CUBE_MAP_ARRAY +_mesa_is_format_compressed(texImage-TexFormat) _mesa_get_format_datatype(texImage-TexFormat) == GL_UNSIGNED_NORMALIZED) { struct gl_texture_object *texObj = texImage-TexObject; -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/35] !UPSTREAM: Disable non-meta paths
From: Ian Romanick ian.d.roman...@intel.com This is a temporary commit so that i965 will hit the paths in meta that are modified by later patches in this series. --- src/mesa/drivers/dri/i965/brw_clear.c| 3 ++- src/mesa/drivers/dri/i965/intel_fbo.c| 3 +++ src/mesa/drivers/dri/i965/intel_pixel_copy.c | 2 ++ src/mesa/drivers/dri/i965/intel_pixel_draw.c | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_clear.c b/src/mesa/drivers/dri/i965/brw_clear.c index 953e9ba..a9c20d2 100644 --- a/src/mesa/drivers/dri/i965/brw_clear.c +++ b/src/mesa/drivers/dri/i965/brw_clear.c @@ -230,6 +230,7 @@ brw_clear(struct gl_context *ctx, GLbitfield mask) intel_prepare_render(brw); brw_workaround_depthstencil_alignment(brw, partial_clear ? 0 : mask); +#if 0 if (mask BUFFER_BIT_DEPTH) { if (brw_fast_clear_depth(ctx)) { DBG(fast clear: depth\n); @@ -246,7 +247,7 @@ brw_clear(struct gl_context *ctx, GLbitfield mask) } } } - +#endif GLbitfield tri_mask = mask (BUFFER_BITS_COLOR | BUFFER_BIT_STENCIL | BUFFER_BIT_DEPTH); diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c index d99f9a6..246d55c 100644 --- a/src/mesa/drivers/dri/i965/intel_fbo.c +++ b/src/mesa/drivers/dri/i965/intel_fbo.c @@ -775,6 +775,8 @@ intel_blit_framebuffer(struct gl_context *ctx, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { + if (ctx-DrawBuffer-Visual.samples 1 + || ctx-ReadBuffer-Visual.samples 1) { mask = brw_blorp_framebuffer(brw_context(ctx), srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, @@ -789,6 +791,7 @@ intel_blit_framebuffer(struct gl_context *ctx, mask, filter); if (mask == 0x0) return; + } _mesa_meta_BlitFramebuffer(ctx, diff --git a/src/mesa/drivers/dri/i965/intel_pixel_copy.c b/src/mesa/drivers/dri/i965/intel_pixel_copy.c index b2795c6..eee9ad6 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_copy.c @@ -208,8 +208,10 @@ intelCopyPixels(struct gl_context * ctx, if (!_mesa_check_conditional_render(ctx)) return; +#if 0 if (do_blit_copypixels(ctx, srcx, srcy, width, height, destx, desty, type)) return; +#endif /* this will use swrast if needed */ _mesa_meta_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type); diff --git a/src/mesa/drivers/dri/i965/intel_pixel_draw.c b/src/mesa/drivers/dri/i965/intel_pixel_draw.c index a09c139..0c6d374 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_draw.c @@ -159,6 +159,7 @@ intelDrawPixels(struct gl_context * ctx, return; } +#if 0 if (_mesa_is_bufferobj(unpack-BufferObj)) { if (do_blit_drawpixels(ctx, x, y, width, height, format, type, unpack, pixels)) { @@ -167,6 +168,7 @@ intelDrawPixels(struct gl_context * ctx, perf_debug(%s: fallback to generic code in PBO case\n, __FUNCTION__); } +#endif _mesa_meta_DrawPixels(ctx, x, y, width, height, format, type, unpack, pixels); -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/35] meta: Expand the vertex structure for the Clear paths
From: Ian Romanick ian.d.roman...@intel.com Another step leading to some code sharing. Note that the new Clear vertex structure is the same as the new BlitFramebuffer and CopyPixels vertex structure. The sizeof(float) * 7 hack is temporary. It will magically disappear in a just a couple more patches. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 8b5bed3..da85262 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2037,7 +2037,7 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) { struct clear_state *clear = ctx-Meta-Clear; struct vertex { - GLfloat x, y, z, r, g, b, a; + GLfloat x, y, z, tex[4]; }; struct vertex verts[4]; /* save all state but scissor, pixel pack/unpack */ @@ -2068,7 +2068,7 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) /* setup vertex arrays */ _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x)); - _mesa_ColorPointer(4, GL_FLOAT, sizeof(struct vertex), OFFSET(r)); + _mesa_ColorPointer(4, GL_FLOAT, sizeof(struct vertex), OFFSET(tex)); _mesa_EnableClientState(GL_VERTEX_ARRAY); _mesa_EnableClientState(GL_COLOR_ARRAY); } @@ -2137,10 +2137,10 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) /* vertex colors */ for (i = 0; i 4; i++) { - verts[i].r = ctx-Color.ClearColor.f[0]; - verts[i].g = ctx-Color.ClearColor.f[1]; - verts[i].b = ctx-Color.ClearColor.f[2]; - verts[i].a = ctx-Color.ClearColor.f[3]; + verts[i].tex[0] = ctx-Color.ClearColor.f[0]; + verts[i].tex[1] = ctx-Color.ClearColor.f[1]; + verts[i].tex[2] = ctx-Color.ClearColor.f[2]; + verts[i].tex[3] = ctx-Color.ClearColor.f[3]; } /* upload new vertex data */ @@ -2200,7 +2200,8 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, clear-VBO); /* setup vertex arrays */ - _mesa_VertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void *)0); + _mesa_VertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 7, + (void *)0); _mesa_EnableVertexAttribArray(0); vs = _mesa_CreateShaderObjectARB(GL_VERTEX_SHADER); @@ -2328,7 +2329,7 @@ _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers) const float y1 = ((float)fb-_Ymax / fb-Height) * 2.0f - 1.0f; const float z = -invert_z(ctx-Depth.Clear); struct vertex { - GLfloat x, y, z; + GLfloat x, y, z, tex[4]; } verts[4]; metaSave = (MESA_META_ALPHA_TEST | -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 34/35] mesa: Fix extension dependency for half-float TexBOs
From: Ian Romanick ian.d.roman...@intel.com Half-float TexBOs should require both GL_ARB_half_float_pixel and GL_ARB_texture_float. This doesn't matter much in practice. Every driver that supports GL_ARB_texture_buffer_object already supports GL_ARB_half_float_pixel. We only expose the TexBO extension in core profiles, and those require GL_ARB_texture_float. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/main/teximage.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 59a9870..d606ed1 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -4196,7 +4196,18 @@ _mesa_validate_texbuffer_format(const struct gl_context *ctx, if (datatype == GL_FLOAT !ctx-Extensions.ARB_texture_float) return MESA_FORMAT_NONE; - if (datatype == GL_HALF_FLOAT !ctx-Extensions.ARB_half_float_pixel) + /* The GL_ARB_texture_buffer_object spec says: +* +* If ARB_texture_float is not supported, references to the +* floating-point internal formats provided by that extension should be +* removed, and such formats may not be passed to TexBufferARB. +* +* As a result, GL_HALF_FLOAT internal format depends on both +* GL_ARB_texture_float and GL_ARB_half_float_pixel. +*/ + if (datatype == GL_HALF_FLOAT + !(ctx-Extensions.ARB_half_float_pixel + ctx-Extensions.ARB_texture_float)) return MESA_FORMAT_NONE; if (!ctx-Extensions.ARB_texture_rg) { -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 22/35] meta: Refactor the table of glsl_sampler structures
From: Ian Romanick ian.d.roman...@intel.com This will allow the same table of shader-per-sampler-type to be used for paths in meta other than just mipmap generation. This is also the reason the declarations of the structures was moved towards the top of the file. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 128 +++-- 1 file changed, 72 insertions(+), 56 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index a987fd7..0241c34 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -215,6 +215,28 @@ struct temp_texture GLfloat Sright, Ttop; /** right, top texcoords */ }; +/** + * State for GLSL texture sampler which is used to generate fragment + * shader in _mesa_meta_generate_mipmap(). + */ +struct glsl_sampler { + const char *type; + const char *func; + const char *texcoords; + GLuint shader_prog; +}; + +/** + * Table of all sampler types and shaders for accessing them. + */ +struct sampler_table { + struct glsl_sampler sampler_1d; + struct glsl_sampler sampler_2d; + struct glsl_sampler sampler_3d; + struct glsl_sampler sampler_cubemap; + struct glsl_sampler sampler_1d_array; + struct glsl_sampler sampler_2d_array; +}; /** * State for glBlitFramebufer() @@ -281,17 +303,6 @@ struct bitmap_state }; /** - * State for GLSL texture sampler which is used to generate fragment - * shader in _mesa_meta_generate_mipmap(). - */ -struct glsl_sampler { - const char *type; - const char *func; - const char *texcoords; - GLuint shader_prog; -}; - -/** * State for _mesa_meta_generate_mipmap() */ struct gen_mipmap_state @@ -301,12 +312,8 @@ struct gen_mipmap_state GLuint FBO; GLuint Sampler; GLuint ShaderProg; - struct glsl_sampler sampler_1d; - struct glsl_sampler sampler_2d; - struct glsl_sampler sampler_3d; - struct glsl_sampler sampler_cubemap; - struct glsl_sampler sampler_1d_array; - struct glsl_sampler sampler_2d_array; + + struct sampler_table samplers; }; /** @@ -356,12 +363,16 @@ struct vertex { GLfloat r, g, b, a; }; +static struct glsl_sampler * setup_texture_sampler(GLenum target, + struct sampler_table *table); + static void meta_glsl_blit_cleanup(struct blit_state *blit); static void cleanup_temp_texture(struct temp_texture *tex); static void meta_glsl_clear_cleanup(struct clear_state *clear); static void meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap); static void meta_decompress_cleanup(struct decompress_state *decompress); static void meta_drawpix_cleanup(struct drawpix_state *drawpix); +static void sampler_table_cleanup(struct sampler_table *table); static GLuint compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB *source) @@ -3324,42 +3335,42 @@ setup_texture_coords(GLenum faceTarget, } static struct glsl_sampler * -setup_texture_sampler(GLenum target, struct gen_mipmap_state *mipmap) +setup_texture_sampler(GLenum target, struct sampler_table *table) { switch(target) { case GL_TEXTURE_1D: - mipmap-sampler_1d.type = sampler1D; - mipmap-sampler_1d.func = texture1D; - mipmap-sampler_1d.texcoords = texCoords.x; - return mipmap-sampler_1d; + table-sampler_1d.type = sampler1D; + table-sampler_1d.func = texture1D; + table-sampler_1d.texcoords = texCoords.x; + return table-sampler_1d; case GL_TEXTURE_2D: - mipmap-sampler_2d.type = sampler2D; - mipmap-sampler_2d.func = texture2D; - mipmap-sampler_2d.texcoords = texCoords.xy; - return mipmap-sampler_2d; + table-sampler_2d.type = sampler2D; + table-sampler_2d.func = texture2D; + table-sampler_2d.texcoords = texCoords.xy; + return table-sampler_2d; case GL_TEXTURE_3D: /* Code for mipmap generation with 3D textures is not used yet. * It's a sw fallback. */ - mipmap-sampler_3d.type = sampler3D; - mipmap-sampler_3d.func = texture3D; - mipmap-sampler_3d.texcoords = texCoords; - return mipmap-sampler_3d; + table-sampler_3d.type = sampler3D; + table-sampler_3d.func = texture3D; + table-sampler_3d.texcoords = texCoords; + return table-sampler_3d; case GL_TEXTURE_CUBE_MAP: - mipmap-sampler_cubemap.type = samplerCube; - mipmap-sampler_cubemap.func = textureCube; - mipmap-sampler_cubemap.texcoords = texCoords; - return mipmap-sampler_cubemap; + table-sampler_cubemap.type = samplerCube; + table-sampler_cubemap.func = textureCube; + table-sampler_cubemap.texcoords = texCoords; + return table-sampler_cubemap; case GL_TEXTURE_1D_ARRAY: - mipmap-sampler_1d_array.type = sampler1DArray; - mipmap-sampler_1d_array.func = texture1DArray; - mipmap-sampler_1d_array.texcoords = texCoords.xy; - return
[Mesa-dev] [PATCH 04/35] meta: Release resources used by decompress_texture_image
From: Ian Romanick ian.d.roman...@intel.com decompress_texture_image creates an FBO, an RBO, a VBO, a VAO, and a sampler object, but none of them are ever released. Later patches will add program objects, exacerbating the problem. Leaking piles of memory is generally frowned upon. Signed-off-by: Ian Romanick ian.d.roman...@intel.com Cc: 9.1 9.2 10.0 mesa-sta...@lists.freedesktop.org --- src/mesa/drivers/common/meta.c | 21 + 1 file changed, 21 insertions(+) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index eb94deb..2ef27de 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -355,6 +355,7 @@ static void cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *te static void meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear); static void meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx, struct gen_mipmap_state *mipmap); +static void meta_decompress_cleanup(struct decompress_state *decompress); static GLuint compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB *source) @@ -449,6 +450,7 @@ _mesa_meta_free(struct gl_context *ctx) meta_glsl_clear_cleanup(ctx, ctx-Meta-Clear); meta_glsl_generate_mipmap_cleanup(ctx, ctx-Meta-Mipmap); cleanup_temp_texture(ctx, ctx-Meta-TempTex); + meta_decompress_cleanup(ctx-Meta-Decompress); if (old_context) _mesa_make_current(old_context, old_context-WinSysDrawBuffer, old_context-WinSysReadBuffer); else @@ -3945,6 +3947,25 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, } +static void +meta_decompress_cleanup(struct decompress_state *decompress) +{ + if (decompress-FBO != 0) { + _mesa_DeleteFramebuffers(1, decompress-FBO); + _mesa_DeleteRenderbuffers(1, decompress-RBO); + } + + if (decompress-ArrayObj != 0) { + _mesa_DeleteVertexArrays(1, decompress-ArrayObj); + _mesa_DeleteBuffers(1, decompress-VBO); + } + + if (decompress-Sampler != 0) + _mesa_DeleteSamplers(1, decompress-Sampler); + + memset(decompress, 0, sizeof(*decompress)); +} + /** * Decompress a texture image by drawing a quad with the compressed * texture and reading the pixels out of the color buffer. -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 28/35] meta: Expand texture coordinate from vec3 to vec4
From: Ian Romanick ian.d.roman...@intel.com This will be necessary to support cubemap array textures because they use all four components. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 9b54d3a..9e82132 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -471,7 +471,7 @@ setup_shader_for_sampler(struct gl_context *ctx, struct glsl_sampler *sampler) vs_source = attribute vec2 position;\n attribute vec3 textureCoords;\n - varying vec3 texCoords;\n + varying vec4 texCoords;\n void main()\n {\n texCoords = textureCoords;\n @@ -484,7 +484,7 @@ setup_shader_for_sampler(struct gl_context *ctx, struct glsl_sampler *sampler) precision highp float;\n #endif\n uniform %s texSampler;\n - varying vec3 texCoords;\n + varying vec4 texCoords;\n void main()\n {\n gl_FragColor = %s(texSampler, %s);\n @@ -497,8 +497,8 @@ setup_shader_for_sampler(struct gl_context *ctx, struct glsl_sampler *sampler) vs_source = ralloc_asprintf(mem_ctx, #version %s\n in vec2 position;\n - in vec3 textureCoords;\n - out vec3 texCoords;\n + in vec4 textureCoords;\n + out vec4 texCoords;\n void main()\n {\n texCoords = textureCoords;\n @@ -511,7 +511,7 @@ setup_shader_for_sampler(struct gl_context *ctx, struct glsl_sampler *sampler) precision highp float;\n #endif\n uniform %s texSampler;\n - in vec3 texCoords;\n + in vec4 texCoords;\n out vec4 out_color;\n \n void main()\n @@ -3375,12 +3375,12 @@ setup_texture_sampler(GLenum target, struct sampler_table *table) */ table-sampler_3d.type = sampler3D; table-sampler_3d.func = texture3D; - table-sampler_3d.texcoords = texCoords; + table-sampler_3d.texcoords = texCoords.xyz; return table-sampler_3d; case GL_TEXTURE_CUBE_MAP: table-sampler_cubemap.type = samplerCube; table-sampler_cubemap.func = textureCube; - table-sampler_cubemap.texcoords = texCoords; + table-sampler_cubemap.texcoords = texCoords.xyz; return table-sampler_cubemap; case GL_TEXTURE_1D_ARRAY: table-sampler_1d_array.type = sampler1DArray; @@ -3390,7 +3390,7 @@ setup_texture_sampler(GLenum target, struct sampler_table *table) case GL_TEXTURE_2D_ARRAY: table-sampler_2d_array.type = sampler2DArray; table-sampler_2d_array.func = texture2DArray; - table-sampler_2d_array.texcoords = texCoords; + table-sampler_2d_array.texcoords = texCoords.xyz; return table-sampler_2d_array; default: _mesa_problem(NULL, Unexpected texture target 0x%x in -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 30/35] meta: Add cubemap array support to generic blit shader code
From: Ian Romanick ian.d.roman...@intel.com Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 12 1 file changed, 12 insertions(+) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 6723263..500311d 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -237,6 +237,7 @@ struct sampler_table { struct glsl_sampler sampler_cubemap; struct glsl_sampler sampler_1d_array; struct glsl_sampler sampler_2d_array; + struct glsl_sampler sampler_cubemap_array; }; /** @@ -480,6 +481,7 @@ setup_shader_for_sampler(struct gl_context *ctx, struct glsl_sampler *sampler) fs_source = ralloc_asprintf(mem_ctx, #extension GL_EXT_texture_array : enable\n + #extension GL_ARB_texture_cube_map_array: enable\n #ifdef GL_ES\n precision highp float;\n #endif\n @@ -507,6 +509,7 @@ setup_shader_for_sampler(struct gl_context *ctx, struct glsl_sampler *sampler) _mesa_is_desktop_gl(ctx) ? 130 : 300 es); fs_source = ralloc_asprintf(mem_ctx, #version %s\n + #extension GL_ARB_texture_cube_map_array: enable\n #ifdef GL_ES\n precision highp float;\n #endif\n @@ -3309,6 +3312,8 @@ setup_texture_coords(GLenum faceTarget, assert(0); } + coord[3] = (float) (slice / 6); + switch (faceTarget) { case GL_TEXTURE_CUBE_MAP_POSITIVE_X: coord[0] = 1.0f; @@ -3392,6 +3397,11 @@ setup_texture_sampler(GLenum target, struct sampler_table *table) table-sampler_2d_array.func = texture2DArray; table-sampler_2d_array.texcoords = texCoords.xyz; return table-sampler_2d_array; + case GL_TEXTURE_CUBE_MAP_ARRAY: + table-sampler_cubemap_array.type = samplerCubeArray; + table-sampler_cubemap_array.func = textureCubeArray; + table-sampler_cubemap_array.texcoords = texCoords.xyzw; + return table-sampler_cubemap_array; default: _mesa_problem(NULL, Unexpected texture target 0x%x in setup_texture_sampler()\n, target); @@ -3409,6 +3419,7 @@ sampler_table_cleanup(struct sampler_table *table) _mesa_DeleteObjectARB(table-sampler_cubemap.shader_prog); _mesa_DeleteObjectARB(table-sampler_1d_array.shader_prog); _mesa_DeleteObjectARB(table-sampler_2d_array.shader_prog); + _mesa_DeleteObjectARB(table-sampler_cubemap_array.shader_prog); table-sampler_1d.shader_prog = 0; table-sampler_2d.shader_prog = 0; @@ -3417,6 +3428,7 @@ sampler_table_cleanup(struct sampler_table *table) table-sampler_cubemap.shader_prog = 0; table-sampler_1d_array.shader_prog = 0; table-sampler_2d_array.shader_prog = 0; + table-sampler_cubemap_array.shader_prog = 0; } static void -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 16/35] meta: Track the _mesa_meta_DrawPixels VBO just like the others
From: Ian Romanick ian.d.roman...@intel.com All of the other meta routines have a particular pattern for creating and tracking the VAO and VBO. This one function deviated from that pattern for no apparent reason. Almost all of the code added in this patch will be removed shortly. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index fb58b42..6718680 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -263,6 +263,7 @@ struct copypix_state struct drawpix_state { GLuint ArrayObj; + GLuint VBO; GLuint StencilFP; /** Fragment program for drawing stencil images */ GLuint DepthFP; /** Fragment program for drawing depth images */ @@ -2561,6 +2562,9 @@ meta_drawpix_cleanup(struct drawpix_state *drawpix) if (drawpix-ArrayObj != 0) { _mesa_DeleteVertexArrays(1, drawpix-ArrayObj); drawpix-ArrayObj = 0; + + _mesa_DeleteBuffers(1, drawpix-VBO); + drawpix-VBO = 0; } if (drawpix-StencilFP != 0) { @@ -2824,6 +2828,27 @@ _mesa_meta_DrawPixels(struct gl_context *ctx, newTex = alloc_texture(tex, width, height, texIntFormat); + if (drawpix-ArrayObj == 0) { + /* one-time setup: create vertex array object */ + _mesa_GenVertexArrays(1, drawpix-ArrayObj); + _mesa_BindVertexArray(drawpix-ArrayObj); + + /* create vertex array buffer */ + _mesa_GenBuffers(1, drawpix-VBO); + _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, drawpix-VBO); + _mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts), + NULL, GL_DYNAMIC_DRAW_ARB); + + /* setup vertex arrays */ + _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x)); + _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(tex)); + _mesa_EnableClientState(GL_VERTEX_ARRAY); + _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); + } else { + _mesa_BindVertexArray(drawpix-ArrayObj); + _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, drawpix-VBO); + } + /* Silence valgrind warnings about reading uninitialized stack. */ memset(verts, 0, sizeof(verts)); @@ -2857,24 +2882,10 @@ _mesa_meta_DrawPixels(struct gl_context *ctx, verts[3].tex[1] = tex-Ttop; } - if (drawpix-ArrayObj == 0) { - /* one-time setup: create vertex array object */ - _mesa_GenVertexArrays(1, drawpix-ArrayObj); - } - _mesa_BindVertexArray(drawpix-ArrayObj); - - /* create vertex array buffer */ - _mesa_GenBuffers(1, vbo); - _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, vbo); + /* upload new vertex data */ _mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_DYNAMIC_DRAW_ARB); - /* setup vertex arrays */ - _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x)); - _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(tex)); - _mesa_EnableClientState(GL_VERTEX_ARRAY); - _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); - /* set given unpack params */ ctx-Unpack = *unpack; -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/35] meta: Silence several 'unused parameter' warnings
From: Ian Romanick ian.d.roman...@intel.com Silences many GCC warnings of the form: drivers/common/meta.c: In function 'cleanup_temp_texture': drivers/common/meta.c:1208:41: warning: unused parameter 'ctx' [-Wunused-parameter] drivers/common/meta.c: In function 'setup_ff_blit_framebuffer': drivers/common/meta.c:1453:46: warning: unused parameter 'ctx' [-Wunused-parameter] drivers/common/meta.c: In function 'meta_glsl_blit_cleanup': drivers/common/meta.c:1998:43: warning: unused parameter 'ctx' [-Wunused-parameter] drivers/common/meta.c: In function 'meta_glsl_clear_cleanup': drivers/common/meta.c:2287:44: warning: unused parameter 'ctx' [-Wunused-parameter] drivers/common/meta.c: In function 'setup_ff_generate_mipmap': drivers/common/meta.c:3365:45: warning: unused parameter 'ctx' [-Wunused-parameter] drivers/common/meta.c: In function 'meta_glsl_generate_mipmap_cleanup': drivers/common/meta.c:3556:54: warning: unused parameter 'ctx' [-Wunused-parameter] There are a couple other similar warnings, but they are less trivial. I want to investigate these further before axing them. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 38 +- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index e6772fc..8d9a037 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -350,11 +350,10 @@ struct gl_meta_state struct drawtex_state DrawTex; /** For _mesa_meta_DrawTex() */ }; -static void meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit); -static void cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex); -static void meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear); -static void meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx, - struct gen_mipmap_state *mipmap); +static void meta_glsl_blit_cleanup(struct blit_state *blit); +static void cleanup_temp_texture(struct temp_texture *tex); +static void meta_glsl_clear_cleanup(struct clear_state *clear); +static void meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap); static void meta_decompress_cleanup(struct decompress_state *decompress); static void meta_drawpix_cleanup(struct drawpix_state *drawpix); @@ -447,10 +446,10 @@ _mesa_meta_free(struct gl_context *ctx) { GET_CURRENT_CONTEXT(old_context); _mesa_make_current(ctx, NULL, NULL); - meta_glsl_blit_cleanup(ctx, ctx-Meta-Blit); - meta_glsl_clear_cleanup(ctx, ctx-Meta-Clear); - meta_glsl_generate_mipmap_cleanup(ctx, ctx-Meta-Mipmap); - cleanup_temp_texture(ctx, ctx-Meta-TempTex); + meta_glsl_blit_cleanup(ctx-Meta-Blit); + meta_glsl_clear_cleanup(ctx-Meta-Clear); + meta_glsl_generate_mipmap_cleanup(ctx-Meta-Mipmap); + cleanup_temp_texture(ctx-Meta-TempTex); meta_decompress_cleanup(ctx-Meta-Decompress); meta_drawpix_cleanup(ctx-Meta-DrawPix); if (old_context) @@ -1212,7 +1211,7 @@ init_temp_texture(struct gl_context *ctx, struct temp_texture *tex) } static void -cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex) +cleanup_temp_texture(struct temp_texture *tex) { if (!tex-TexObj) return; @@ -1457,8 +1456,7 @@ init_blit_depth_pixels(struct gl_context *ctx) } static void -setup_ff_blit_framebuffer(struct gl_context *ctx, - struct blit_state *blit) +setup_ff_blit_framebuffer(struct blit_state *blit) { struct vertex { GLfloat x, y, s, t; @@ -1686,7 +1684,7 @@ blitframebuffer_texture(struct gl_context *ctx, _mesa_UseProgram(blit-RectShaderProg); } else { -setup_ff_blit_framebuffer(ctx, ctx-Meta-Blit); +setup_ff_blit_framebuffer(ctx-Meta-Blit); } _mesa_BindVertexArray(blit-ArrayObj); @@ -1871,7 +1869,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, _mesa_UseProgram(blit-RectShaderProg); } else { - setup_ff_blit_framebuffer(ctx, blit); + setup_ff_blit_framebuffer(blit); } _mesa_BindVertexArray(blit-ArrayObj); @@ -2002,7 +2000,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, } static void -meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit) +meta_glsl_blit_cleanup(struct blit_state *blit) { if (blit-ArrayObj) { _mesa_DeleteVertexArrays(1, blit-ArrayObj); @@ -2291,7 +2289,7 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) } static void -meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear) +meta_glsl_clear_cleanup(struct clear_state *clear) { if (clear-ArrayObj == 0) return; @@ -3382,8 +3380,7 @@ setup_texture_coords(GLenum faceTarget, static void -setup_ff_generate_mipmap(struct gl_context *ctx, - struct gen_mipmap_state
[Mesa-dev] [PATCH 23/35] meta: Refactor shader generation code out of mipmap generation path
From: Ian Romanick ian.d.roman...@intel.com This is quite like code we want for blits. Pull it out so that it can be shared by other paths. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 169 ++--- 1 file changed, 91 insertions(+), 78 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 0241c34..acc81c1 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -442,6 +442,96 @@ link_program_with_debug(struct gl_context *ctx, GLuint program) } /** + * Generate a generic shader to blit from a texture to a framebuffer + * + * \param ctx Current GL context + * \param texTarget Texture target that will be the source of the blit + * + * \returns a handle to a shader program on success or zero on failure. + */ +static GLuint +setup_shader_for_sampler(struct gl_context *ctx, struct glsl_sampler *sampler) +{ + const char *vs_source; + char *fs_source; + GLuint vs, fs; + void *const mem_ctx = ralloc_context(NULL); + + if (sampler-shader_prog != 0) + return sampler-shader_prog; + + if (ctx-API == API_OPENGLES2 || ctx-Const.GLSLVersion 130) { + vs_source = + attribute vec2 position;\n + attribute vec3 textureCoords;\n + varying vec3 texCoords;\n + void main()\n + {\n +texCoords = textureCoords;\n +gl_Position = vec4(position, 0.0, 1.0);\n + }\n; + + fs_source = ralloc_asprintf(mem_ctx, + #extension GL_EXT_texture_array : enable\n + #ifdef GL_ES\n + precision highp float;\n + #endif\n + uniform %s texSampler;\n + varying vec3 texCoords;\n + void main()\n + {\n + gl_FragColor = %s(texSampler, %s);\n + }\n, + sampler-type, + sampler-func, sampler-texcoords); + } + else { + vs_source = ralloc_asprintf(mem_ctx, + #version %s\n + in vec2 position;\n + in vec3 textureCoords;\n + out vec3 texCoords;\n + void main()\n + {\n + texCoords = textureCoords;\n + gl_Position = vec4(position, 0.0, 1.0);\n + }\n, + _mesa_is_desktop_gl(ctx) ? 130 : 300 es); + fs_source = ralloc_asprintf(mem_ctx, + #version %s\n + #ifdef GL_ES\n + precision highp float;\n + #endif\n + uniform %s texSampler;\n + in vec3 texCoords;\n + out vec4 out_color;\n + \n + void main()\n + {\n + out_color = texture(texSampler, %s);\n + }\n, + _mesa_is_desktop_gl(ctx) ? 130 : 300 es, + sampler-type, + sampler-texcoords); + } + + vs = compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_source); + fs = compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_source); + + sampler-shader_prog = _mesa_CreateProgramObjectARB(); + _mesa_AttachShader(sampler-shader_prog, fs); + _mesa_DeleteObjectARB(fs); + _mesa_AttachShader(sampler-shader_prog, vs); + _mesa_DeleteObjectARB(vs); + _mesa_BindAttribLocation(sampler-shader_prog, 0, position); + _mesa_BindAttribLocation(sampler-shader_prog, 1, texcoords); + link_program_with_debug(ctx, sampler-shader_prog); + ralloc_free(mem_ctx); + + return sampler-shader_prog; +} + +/** * Configure vertex buffer and vertex array objects for tests * * Regardless of whether a new VAO and new VBO are created, the objects @@ -3402,91 +3492,14 @@ setup_glsl_generate_mipmap(struct gl_context *ctx, GLenum target) { struct glsl_sampler *sampler; - const char *vs_source; - char *fs_source; - GLuint vs, fs; - void *mem_ctx; setup_vertex_objects(mipmap-ArrayObj, mipmap-VBO, true, 2, 3, 0); /* Generate a fragment shader program appropriate for the texture target */ sampler = setup_texture_sampler(target, mipmap-samplers); assert(sampler != NULL); - if (sampler-shader_prog != 0) { -
[Mesa-dev] [PATCH 35/35] mesa: GL_ARB_half_float_pixel is not optional
From: Ian Romanick ian.d.roman...@intel.com Almost every driver already supported it. All current and future Gallium drivers always support it, and most existing classic drivers support it. This only changes radeon and nouveau. This extension only adds data types that can be passed to, for example, glTexImage2D. It does not add internal formats. Since you can already pass GL_FLOAT to glTexImage2D this shouldn't pose any additional issues with those drivers. Note that r200 and i915 already supported this extension, and they don't support floating-point textures either. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- docs/GL3.txt | 2 +- src/mesa/drivers/dri/i915/intel_extensions.c | 1 - src/mesa/drivers/dri/i965/intel_extensions.c | 1 - src/mesa/drivers/dri/r200/r200_context.c | 1 - src/mesa/main/extensions.c | 3 +-- src/mesa/main/glformats.c| 24 ++-- src/mesa/main/mtypes.h | 1 - src/mesa/main/teximage.c | 17 ++--- src/mesa/main/version.c | 1 - src/mesa/state_tracker/st_extensions.c | 1 - 10 files changed, 10 insertions(+), 42 deletions(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index 4955f4d..8d0c1e1 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -30,7 +30,7 @@ GL 3.0 --- all DONE: i965, nv50, nvc0, r600, radeonsi GL_EXT_texture_shared_exponentDONE (swrast) Float depth buffers (GL_ARB_depth_buffer_float) DONE () Framebuffer objects (GL_ARB_framebuffer_object) DONE (r300, swrast) - GL_ARB_half_float_pixel DONE (r300, swrast) + GL_ARB_half_float_pixel DONE (all drivers) GL_ARB_half_float_vertex DONE (r300, swrast) GL_EXT_texture_integerDONE () GL_EXT_texture_array DONE () diff --git a/src/mesa/drivers/dri/i915/intel_extensions.c b/src/mesa/drivers/dri/i915/intel_extensions.c index 9da12dc..11be004 100644 --- a/src/mesa/drivers/dri/i915/intel_extensions.c +++ b/src/mesa/drivers/dri/i915/intel_extensions.c @@ -47,7 +47,6 @@ intelInitExtensions(struct gl_context *ctx) ctx-Extensions.ARB_draw_elements_base_vertex = true; ctx-Extensions.ARB_explicit_attrib_location = true; ctx-Extensions.ARB_framebuffer_object = true; - ctx-Extensions.ARB_half_float_pixel = true; ctx-Extensions.ARB_internalformat_query = true; ctx-Extensions.ARB_map_buffer_range = true; ctx-Extensions.ARB_point_sprite = true; diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c index 2b5ed0b..d7f6846 100644 --- a/src/mesa/drivers/dri/i965/intel_extensions.c +++ b/src/mesa/drivers/dri/i965/intel_extensions.c @@ -174,7 +174,6 @@ intelInitExtensions(struct gl_context *ctx) ctx-Extensions.ARB_fragment_program_shadow = true; ctx-Extensions.ARB_fragment_shader = true; ctx-Extensions.ARB_framebuffer_object = true; - ctx-Extensions.ARB_half_float_pixel = true; ctx-Extensions.ARB_half_float_vertex = true; ctx-Extensions.ARB_instanced_arrays = true; ctx-Extensions.ARB_internalformat_query = true; diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 637a263..126206c 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -365,7 +365,6 @@ GLboolean r200CreateContext( gl_api api, _math_matrix_ctr( rmesa-tmpmat ); _math_matrix_set_identity( rmesa-tmpmat ); - ctx-Extensions.ARB_half_float_pixel = true; ctx-Extensions.ARB_occlusion_query = true; ctx-Extensions.ARB_point_sprite = true; ctx-Extensions.ARB_texture_border_clamp = true; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index e48c1a3..260542b 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -105,7 +105,7 @@ static const struct extension extension_table[] = { { GL_ARB_framebuffer_sRGB,o(EXT_framebuffer_sRGB), GL, 1998 }, { GL_ARB_get_program_binary, o(dummy_true), GL, 2010 }, { GL_ARB_gpu_shader5, o(ARB_gpu_shader5), GL, 2010 }, - { GL_ARB_half_float_pixel,o(ARB_half_float_pixel), GL, 2003 }, + { GL_ARB_half_float_pixel,o(dummy_true), GL, 2003 }, { GL_ARB_half_float_vertex, o(ARB_half_float_vertex), GL, 2008 }, { GL_ARB_instanced_arrays,o(ARB_instanced_arrays), GL, 2008 }, { GL_ARB_internalformat_query,
[Mesa-dev] [PATCH 14/35] meta: Expand the vertex structure for the DrawPixels paths
From: Ian Romanick ian.d.roman...@intel.com Another step leading to some code sharing. Note that the new DrawPixels vertex structure is the same as the new vertex structure in BlitFramebuffer and the others. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index da85262..889948f 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2726,7 +2726,7 @@ _mesa_meta_DrawPixels(struct gl_context *ctx, const struct gl_pixelstore_attrib unpackSave = ctx-Unpack; const GLuint origStencilMask = ctx-Stencil.WriteMask[0]; struct vertex { - GLfloat x, y, z, s, t; + GLfloat x, y, z, tex[4]; }; struct vertex verts[4]; GLenum texIntFormat; @@ -2824,6 +2824,9 @@ _mesa_meta_DrawPixels(struct gl_context *ctx, newTex = alloc_texture(tex, width, height, texIntFormat); + /* Silence valgrind warnings about reading uninitialized stack. */ + memset(verts, 0, sizeof(verts)); + /* vertex positions, texcoords (after texture allocation!) */ { const GLfloat x0 = (GLfloat) x; @@ -2835,23 +2838,23 @@ _mesa_meta_DrawPixels(struct gl_context *ctx, verts[0].x = x0; verts[0].y = y0; verts[0].z = z; - verts[0].s = 0.0F; - verts[0].t = 0.0F; + verts[0].tex[0] = 0.0F; + verts[0].tex[1] = 0.0F; verts[1].x = x1; verts[1].y = y0; verts[1].z = z; - verts[1].s = tex-Sright; - verts[1].t = 0.0F; + verts[1].tex[0] = tex-Sright; + verts[1].tex[1] = 0.0F; verts[2].x = x1; verts[2].y = y1; verts[2].z = z; - verts[2].s = tex-Sright; - verts[2].t = tex-Ttop; + verts[2].tex[0] = tex-Sright; + verts[2].tex[1] = tex-Ttop; verts[3].x = x0; verts[3].y = y1; verts[3].z = z; - verts[3].s = 0.0F; - verts[3].t = tex-Ttop; + verts[3].tex[0] = 0.0F; + verts[3].tex[1] = tex-Ttop; } if (drawpix-ArrayObj == 0) { @@ -2868,7 +2871,7 @@ _mesa_meta_DrawPixels(struct gl_context *ctx, /* setup vertex arrays */ _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x)); - _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s)); + _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(tex)); _mesa_EnableClientState(GL_VERTEX_ARRAY); _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/35] meta: Use NDC in decompress_texture_image
From: Ian Romanick ian.d.roman...@intel.com There is no need to use pixel coordinates, and using NDC directly will simplify the GLSL paths. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 3479eb1..1d870d2 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -4108,18 +4108,17 @@ decompress_texture_image(struct gl_context *ctx, verts[3].tex); /* setup vertex positions */ - verts[0].x = 0.0F; - verts[0].y = 0.0F; - verts[1].x = width; - verts[1].y = 0.0F; - verts[2].x = width; - verts[2].y = height; - verts[3].x = 0.0F; - verts[3].y = height; + verts[0].x = -1.0F; + verts[0].y = -1.0F; + verts[1].x = 1.0F; + verts[1].y = -1.0F; + verts[2].x = 1.0F; + verts[2].y = 1.0F; + verts[3].x = -1.0F; + verts[3].y = 1.0F; _mesa_MatrixMode(GL_PROJECTION); _mesa_LoadIdentity(); - _mesa_Ortho(0.0, width, 0.0, height, -1.0, 1.0); _mesa_set_viewport(ctx, 0, 0, 0, width, height); /* upload new vertex data */ -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 17/35] meta: Refactor common VAO and VBO initialization code
From: Ian Romanick ian.d.roman...@intel.com Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 309 + 1 file changed, 97 insertions(+), 212 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 6718680..3661173 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -351,6 +351,10 @@ struct gl_meta_state struct drawtex_state DrawTex; /** For _mesa_meta_DrawTex() */ }; +struct vertex { + GLfloat x, y, z, tex[4]; +}; + static void meta_glsl_blit_cleanup(struct blit_state *blit); static void cleanup_temp_texture(struct temp_texture *tex); static void meta_glsl_clear_cleanup(struct clear_state *clear); @@ -426,6 +430,89 @@ link_program_with_debug(struct gl_context *ctx, GLuint program) } /** + * Configure vertex buffer and vertex array objects for tests + * + * Regardless of whether a new VAO and new VBO are created, the objects + * referenced by \c ArrayObj and \c VBO will be bound into the GL state vector + * when this function terminates. + * + * \param ArrayObj Storage for vertex array object handle. If 0, a new VAO + * will be created. + * \param VBO Storage for vertex buffer object handle. If 0, a new VBO + * will be created. The new VBO will have storage for 4 + * \c vertex structures. + * \param use_generic_attributes Should generic attributes 0 and 1 be used, + * or should traditional, fixed-function color and texture + * coordinate be used? + * \param vertex_size Number of components for attribute 0 / vertex. + * \param texcoord_size Number of components for attribute 1 / texture + * coordinate. If this is 0, attribute 1 will not be set or + * enabled. + * \param color_size Number of components for attribute 1 / primary color. + * If this is 0, attribute 1 will not be set or enabled. + * + * \note Either \c texcoord_size or \c color_size \b must be zero! The same + * data location is used for both values, so only one can be active at a time. + * + * \note If \c use_generic_attributes is \c true, \c color_size must be zero. + * Use \c texcoord_size instead. + */ +static void +setup_vertex_objects(GLuint *ArrayObj, GLuint *VBO, bool use_generic_attributes, + unsigned vertex_size, unsigned texcoord_size, + unsigned color_size) +{ + if (*ArrayObj == 0) { + assert(*VBO == 0); + assert(color_size == 0 || texcoord_size == 0); + + /* create vertex array object */ + _mesa_GenVertexArrays(1, ArrayObj); + _mesa_BindVertexArray(*ArrayObj); + + /* create vertex array buffer */ + _mesa_GenBuffers(1, VBO); + _mesa_BindBuffer(GL_ARRAY_BUFFER, *VBO); + _mesa_BufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vertex), NULL, + GL_DYNAMIC_DRAW); + + /* setup vertex arrays */ + if (use_generic_attributes) { + assert(color_size == 0); + + _mesa_VertexAttribPointer(0, vertex_size, GL_FLOAT, GL_FALSE, + sizeof(struct vertex), OFFSET(x)); + _mesa_EnableVertexAttribArray(0); + + if (texcoord_size 0) { +_mesa_VertexAttribPointer(1, texcoord_size, GL_FLOAT, GL_FALSE, + sizeof(struct vertex), OFFSET(tex)); +_mesa_EnableVertexAttribArray(1); + } + } else { + _mesa_VertexPointer(vertex_size, GL_FLOAT, sizeof(struct vertex), + OFFSET(x)); + _mesa_EnableClientState(GL_VERTEX_ARRAY); + + if (texcoord_size 0) { +_mesa_TexCoordPointer(texcoord_size, GL_FLOAT, + sizeof(struct vertex), OFFSET(tex)); +_mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); + } + + if (color_size 0) { +_mesa_ColorPointer(color_size, GL_FLOAT, + sizeof(struct vertex), OFFSET(tex)); +_mesa_EnableClientState(GL_COLOR_ARRAY); + } + } + } else { + _mesa_BindVertexArray(*ArrayObj); + _mesa_BindBuffer(GL_ARRAY_BUFFER, *VBO); + } +} + +/** * Initialize meta-ops for a context. * To be called once during context creation. */ @@ -1459,30 +1546,7 @@ init_blit_depth_pixels(struct gl_context *ctx) static void setup_ff_blit_framebuffer(struct blit_state *blit) { - struct vertex { - GLfloat x, y, z, tex[4]; - }; - struct vertex verts[4]; - - if (blit-ArrayObj == 0) { - /* one-time setup */ - - /* create vertex array object */ - _mesa_GenVertexArrays(1, blit-ArrayObj); - _mesa_BindVertexArray(blit-ArrayObj); - - /* create vertex array buffer */ - _mesa_GenBuffers(1, blit-VBO); - _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, blit-VBO); -
[Mesa-dev] [PATCH 12/35] meta: Expand the vertex structure for the CopyPixels paths
From: Ian Romanick ian.d.roman...@intel.com Another step leading to some code sharing. Note that the new CopyPixels vertex structure is the same as the new BlitFramebuffer vertex structure. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index bcd2b81..8b5bed3 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2451,7 +2451,7 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, struct copypix_state *copypix = ctx-Meta-CopyPix; struct temp_texture *tex = get_temp_texture(ctx); struct vertex { - GLfloat x, y, z, s, t; + GLfloat x, y, z, tex[4]; }; struct vertex verts[4]; GLboolean newTex; @@ -2493,7 +2493,7 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, /* setup vertex arrays */ _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x)); - _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s)); + _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(tex)); _mesa_EnableClientState(GL_VERTEX_ARRAY); _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); } @@ -2504,6 +2504,9 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, newTex = alloc_texture(tex, width, height, intFormat); + /* Silence valgrind warnings about reading uninitialized stack. */ + memset(verts, 0, sizeof(verts)); + /* vertex positions, texcoords (after texture allocation!) */ { const GLfloat dstX0 = (GLfloat) dstX; @@ -2515,23 +2518,23 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, verts[0].x = dstX0; verts[0].y = dstY0; verts[0].z = z; - verts[0].s = 0.0F; - verts[0].t = 0.0F; + verts[0].tex[0] = 0.0F; + verts[0].tex[1] = 0.0F; verts[1].x = dstX1; verts[1].y = dstY0; verts[1].z = z; - verts[1].s = tex-Sright; - verts[1].t = 0.0F; + verts[1].tex[0] = tex-Sright; + verts[1].tex[1] = 0.0F; verts[2].x = dstX1; verts[2].y = dstY1; verts[2].z = z; - verts[2].s = tex-Sright; - verts[2].t = tex-Ttop; + verts[2].tex[0] = tex-Sright; + verts[2].tex[1] = tex-Ttop; verts[3].x = dstX0; verts[3].y = dstY1; verts[3].z = z; - verts[3].s = 0.0F; - verts[3].t = tex-Ttop; + verts[3].tex[0] = 0.0F; + verts[3].tex[1] = tex-Ttop; /* upload new vertex data */ _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 24/35] meta: Add rectangle textures to the shader-per-sampler-type table
From: Ian Romanick ian.d.roman...@intel.com Rectangle textures were not necessary for mipmap generation (because they cannot have mipmaps), but all of the future users of this common code will need to support rectangle textures. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 8 1 file changed, 8 insertions(+) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index acc81c1..e7154df 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -233,6 +233,7 @@ struct sampler_table { struct glsl_sampler sampler_1d; struct glsl_sampler sampler_2d; struct glsl_sampler sampler_3d; + struct glsl_sampler sampler_rect; struct glsl_sampler sampler_cubemap; struct glsl_sampler sampler_1d_array; struct glsl_sampler sampler_2d_array; @@ -3438,6 +3439,11 @@ setup_texture_sampler(GLenum target, struct sampler_table *table) table-sampler_2d.func = texture2D; table-sampler_2d.texcoords = texCoords.xy; return table-sampler_2d; + case GL_TEXTURE_RECTANGLE: + table-sampler_rect.type = sampler2DRect; + table-sampler_rect.func = texture2DRect; + table-sampler_rect.texcoords = texCoords.xy; + return table-sampler_rect; case GL_TEXTURE_3D: /* Code for mipmap generation with 3D textures is not used yet. * It's a sw fallback. @@ -3474,6 +3480,7 @@ sampler_table_cleanup(struct sampler_table *table) _mesa_DeleteObjectARB(table-sampler_1d.shader_prog); _mesa_DeleteObjectARB(table-sampler_2d.shader_prog); _mesa_DeleteObjectARB(table-sampler_3d.shader_prog); + _mesa_DeleteObjectARB(table-sampler_rect.shader_prog); _mesa_DeleteObjectARB(table-sampler_cubemap.shader_prog); _mesa_DeleteObjectARB(table-sampler_1d_array.shader_prog); _mesa_DeleteObjectARB(table-sampler_2d_array.shader_prog); @@ -3481,6 +3488,7 @@ sampler_table_cleanup(struct sampler_table *table) table-sampler_1d.shader_prog = 0; table-sampler_2d.shader_prog = 0; table-sampler_3d.shader_prog = 0; + table-sampler_rect.shader_prog = 0; table-sampler_cubemap.shader_prog = 0; table-sampler_1d_array.shader_prog = 0; table-sampler_2d_array.shader_prog = 0; -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 29/35] meta: Get the correct info log
From: Ian Romanick ian.d.roman...@intel.com Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 9e82132..6723263 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -403,7 +403,7 @@ compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB return 0; } - _mesa_GetProgramInfoLog(shader, size, NULL, info); + _mesa_GetShaderInfoLog(shader, size, NULL, info); _mesa_problem(ctx, meta program compile failed:\n%s\n source:\n%s\n, -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/35] meta: Don't use fixed-function to decompress array textures
From: Ian Romanick ian.d.roman...@intel.com Array textures can't be used with fixed-function, so don't. Instead, just drop the decompress request on the floor. This is no worse than what was done previously because generating the GL error (in _mesa_set_enable) broke everything anyway. A later patch will get GL_TEXTURE_2D_ARRAY targets working. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 23 --- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 1d870d2..e6772fc 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -4021,11 +4021,28 @@ decompress_texture_image(struct gl_context *ctx, target == GL_TEXTURE_2D_ARRAY); } - if (target == GL_TEXTURE_CUBE_MAP) { + switch (target) { + case GL_TEXTURE_1D: + case GL_TEXTURE_1D_ARRAY: + assert(!No compressed 1D textures.); + return; + + case GL_TEXTURE_3D: + assert(!No compressed 3D textures.); + return; + + case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: + /* These targets are just broken currently. */ + return; + + case GL_TEXTURE_CUBE_MAP: faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage-Face; - } - else { + break; + + default: faceTarget = target; + break; } /* save fbo bindings (not saved by _mesa_meta_begin()) */ -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 20/35] meta: Add storage to the vertex structure for R, G, B, and A
From: Ian Romanick ian.d.roman...@intel.com Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index d4987ca..2f87d0d 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -353,6 +353,7 @@ struct gl_meta_state struct vertex { GLfloat x, y, z, tex[4]; + GLfloat r, g, b, a; }; static void meta_glsl_blit_cleanup(struct blit_state *blit); @@ -451,9 +452,6 @@ link_program_with_debug(struct gl_context *ctx, GLuint program) * \param color_size Number of components for attribute 1 / primary color. * If this is 0, attribute 1 will not be set or enabled. * - * \note Either \c texcoord_size or \c color_size \b must be zero! The same - * data location is used for both values, so only one can be active at a time. - * * \note If \c use_generic_attributes is \c true, \c color_size must be zero. * Use \c texcoord_size instead. */ @@ -464,7 +462,6 @@ setup_vertex_objects(GLuint *ArrayObj, GLuint *VBO, bool use_generic_attributes, { if (*ArrayObj == 0) { assert(*VBO == 0); - assert(color_size == 0 || texcoord_size == 0); /* create vertex array object */ _mesa_GenVertexArrays(1, ArrayObj); @@ -502,7 +499,7 @@ setup_vertex_objects(GLuint *ArrayObj, GLuint *VBO, bool use_generic_attributes, if (color_size 0) { _mesa_ColorPointer(color_size, GL_FLOAT, - sizeof(struct vertex), OFFSET(tex)); + sizeof(struct vertex), OFFSET(r)); _mesa_EnableClientState(GL_COLOR_ARRAY); } } @@ -2142,10 +2139,10 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) /* vertex colors */ for (i = 0; i 4; i++) { - verts[i].tex[0] = ctx-Color.ClearColor.f[0]; - verts[i].tex[1] = ctx-Color.ClearColor.f[1]; - verts[i].tex[2] = ctx-Color.ClearColor.f[2]; - verts[i].tex[3] = ctx-Color.ClearColor.f[3]; + verts[i].r = ctx-Color.ClearColor.f[0]; + verts[i].g = ctx-Color.ClearColor.f[1]; + verts[i].b = ctx-Color.ClearColor.f[2]; + verts[i].a = ctx-Color.ClearColor.f[3]; } /* upload new vertex data */ -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 19/35] meta: Use common routine to configure fixed-function TNL state
From: Ian Romanick ian.d.roman...@intel.com Also... glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0) *is* the identity matrix, so drop the unnecessary call to _mesa_Ortho. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 31 --- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index e03267e..d4987ca 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1544,15 +1544,13 @@ init_blit_depth_pixels(struct gl_context *ctx) } static void -setup_ff_blit_framebuffer(struct blit_state *blit) +setup_ff_TNL_for_blit(GLuint *ArrayObj, GLuint *VBO, unsigned texcoord_size) { - setup_vertex_objects(blit-ArrayObj, blit-VBO, false, 2, 2, 0); + setup_vertex_objects(ArrayObj, VBO, false, 2, texcoord_size, 0); /* setup projection matrix */ _mesa_MatrixMode(GL_PROJECTION); _mesa_LoadIdentity(); - _mesa_Ortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); - } static void @@ -1724,7 +1722,9 @@ blitframebuffer_texture(struct gl_context *ctx, _mesa_UseProgram(blit-RectShaderProg); } else { -setup_ff_blit_framebuffer(ctx-Meta-Blit); +setup_ff_TNL_for_blit(ctx-Meta-Blit.ArrayObj, + ctx-Meta-Blit.VBO, + 2); } _mesa_GenSamplers(1, sampler); @@ -1903,7 +1903,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, _mesa_UseProgram(blit-RectShaderProg); } else { - setup_ff_blit_framebuffer(blit); + setup_ff_TNL_for_blit(blit-ArrayObj, blit-VBO, 2); } /* Silence valgrind warnings about reading uninitialized stack. */ @@ -3350,19 +3350,6 @@ setup_texture_coords(GLenum faceTarget, } } - -static void -setup_ff_generate_mipmap(struct gen_mipmap_state *mipmap) -{ - setup_vertex_objects(mipmap-ArrayObj, mipmap-VBO, false, 2, 3, 0); - - /* setup projection matrix */ - _mesa_MatrixMode(GL_PROJECTION); - _mesa_LoadIdentity(); - _mesa_Ortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); -} - - static struct glsl_sampler * setup_texture_sampler(GLenum target, struct gen_mipmap_state *mipmap) { @@ -3577,7 +3564,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, _mesa_UseProgram(mipmap-ShaderProg); } else { - setup_ff_generate_mipmap(mipmap); + setup_ff_TNL_for_blit(mipmap-ArrayObj, mipmap-VBO, 3); _mesa_set_enable(ctx, target, GL_TRUE); } @@ -4002,7 +3989,7 @@ decompress_texture_image(struct gl_context *ctx, decompress-Height = height; } - setup_vertex_objects(decompress-ArrayObj, decompress-VBO, false, 2, 3, 0); + setup_ff_TNL_for_blit(decompress-ArrayObj, decompress-VBO, 3); if (!decompress-Sampler) { _mesa_GenSamplers(1, decompress-Sampler); @@ -4039,8 +4026,6 @@ decompress_texture_image(struct gl_context *ctx, verts[3].x = -1.0F; verts[3].y = 1.0F; - _mesa_MatrixMode(GL_PROJECTION); - _mesa_LoadIdentity(); _mesa_set_viewport(ctx, 0, 0, 0, width, height); /* upload new vertex data */ -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 32/35] meta: Silence unused parameter warning in setup_drawpix_texture
From: Ian Romanick ian.d.roman...@intel.com drivers/common/meta.c: In function 'setup_drawpix_texture': drivers/common/meta.c:1572:30: warning: unused parameter 'texIntFormat' [-Wunused-parameter] setup_drawpix_texture has never used this paramater. Before the refactor commit 04f8193aa it was used in several locations. After that commit, texIntFormat was only used in alloc_texture. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 5237f2f..235a9f23 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1577,7 +1577,6 @@ static void setup_drawpix_texture(struct gl_context *ctx, struct temp_texture *tex, GLboolean newTex, - GLenum texIntFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) @@ -2010,7 +2009,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, newTex = alloc_texture(depthTex, srcW, srcH, GL_DEPTH_COMPONENT); _mesa_ReadPixels(srcX, srcY, srcW, srcH, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, tmp); - setup_drawpix_texture(ctx, depthTex, newTex, GL_DEPTH_COMPONENT, + setup_drawpix_texture(ctx, depthTex, newTex, srcW, srcH, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, tmp); @@ -2866,7 +2865,7 @@ _mesa_meta_DrawPixels(struct gl_context *ctx, if (!drawpix-StencilFP) init_draw_stencil_pixels(ctx); - setup_drawpix_texture(ctx, tex, newTex, texIntFormat, width, height, + setup_drawpix_texture(ctx, tex, newTex, width, height, GL_ALPHA, type, pixels); _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); @@ -2909,14 +2908,14 @@ _mesa_meta_DrawPixels(struct gl_context *ctx, _mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0, ctx-Current.RasterColor); - setup_drawpix_texture(ctx, tex, newTex, texIntFormat, width, height, + setup_drawpix_texture(ctx, tex, newTex, width, height, format, type, pixels); _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); } else { /* Drawing RGBA */ - setup_drawpix_texture(ctx, tex, newTex, texIntFormat, width, height, + setup_drawpix_texture(ctx, tex, newTex, width, height, format, type, pixels); _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); } @@ -3078,7 +3077,7 @@ _mesa_meta_Bitmap(struct gl_context *ctx, _mesa_set_enable(ctx, GL_ALPHA_TEST, GL_TRUE); _mesa_AlphaFunc(GL_NOTEQUAL, UBYTE_TO_FLOAT(bg)); - setup_drawpix_texture(ctx, tex, newTex, texIntFormat, width, height, + setup_drawpix_texture(ctx, tex, newTex, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, bitmap8); _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 07/35] meta: Consistenly use non-Apple VAO functions
From: Ian Romanick ian.d.roman...@intel.com For these objects, meta was already using the non-Apple function to delete the objects. Everywhere else in the file uses _mesa_GenVertexArrays and _mesa_BindVertexArrays. Signed-off-by: Ian Romanick ian.d.roman...@intel.com Cc: 9.1 9.2 10.0 mesa-sta...@lists.freedesktop.org --- src/mesa/drivers/common/meta.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index b898a27..3479eb1 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -3026,8 +3026,8 @@ _mesa_meta_Bitmap(struct gl_context *ctx, /* one-time setup */ /* create vertex array object */ - _mesa_GenVertexArraysAPPLE(1, bitmap-ArrayObj); - _mesa_BindVertexArrayAPPLE(bitmap-ArrayObj); + _mesa_GenVertexArrays(1, bitmap-ArrayObj); + _mesa_BindVertexArray(bitmap-ArrayObj); /* create vertex array buffer */ _mesa_GenBuffers(1, bitmap-VBO); @@ -3392,8 +3392,8 @@ setup_ff_generate_mipmap(struct gl_context *ctx, if (mipmap-ArrayObj == 0) { /* one-time setup */ /* create vertex array object */ - _mesa_GenVertexArraysAPPLE(1, mipmap-ArrayObj); - _mesa_BindVertexArrayAPPLE(mipmap-ArrayObj); + _mesa_GenVertexArrays(1, mipmap-ArrayObj); + _mesa_BindVertexArray(mipmap-ArrayObj); /* create vertex array buffer */ _mesa_GenBuffers(1, mipmap-VBO); -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 25/35] meta: Improve GLSL version check
From: Ian Romanick ian.d.roman...@intel.com We want to use the GLSL 1.30-ish path for OpenGL ES 3.0. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index e7154df..380ee32 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -461,7 +461,12 @@ setup_shader_for_sampler(struct gl_context *ctx, struct glsl_sampler *sampler) if (sampler-shader_prog != 0) return sampler-shader_prog; - if (ctx-API == API_OPENGLES2 || ctx-Const.GLSLVersion 130) { + /* The version check is a little tricky. API is set to API_OPENGLES2 even +* for OpenGL ES 3.0 contexts, and GLSLVersion may be set to 140, for +* example, in an OpenGL ES 2.0 context. +*/ + if ((ctx-API == API_OPENGLES2 ctx-Version 30) + || ctx-Const.GLSLVersion 130) { vs_source = attribute vec2 position;\n attribute vec3 textureCoords;\n -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 33/35] meta: Silence unused parameter warning in _mesa_meta_CopyTexSubImage
From: Ian Romanick ian.d.roman...@intel.com drivers/common/meta.c: In function '_mesa_meta_CopyTexSubImage': drivers/common/meta.c:3744:52: warning: unused parameter 'rb' [-Wunused-parameter] Unfortunately, the parameter can't just be removed because it is part of the dd_function_table::CopyTexSubImage interface. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/common/meta.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 235a9f23..71f4eca 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -3758,6 +3758,12 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, GLint bpp; void *buf; + /* The gl_renderbuffer is part of the interface for +* dd_function_table::CopyTexSubImage, but this implementation does not use +* it. +*/ + (void) rb; + /* Choose format/type for temporary image buffer */ format = _mesa_get_format_base_format(texImage-TexFormat); if (format == GL_LUMINANCE || -- 1.8.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] glcpp: Add make check test for comment-parsing bug
This is the innocent-looking but killer test case to verify the bug fixed in the preceding commit. --- src/glsl/glcpp/tests/121-comment-bug-72686.c | 2 ++ src/glsl/glcpp/tests/121-comment-bug-72686.c.expected | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 src/glsl/glcpp/tests/121-comment-bug-72686.c create mode 100644 src/glsl/glcpp/tests/121-comment-bug-72686.c.expected diff --git a/src/glsl/glcpp/tests/121-comment-bug-72686.c b/src/glsl/glcpp/tests/121-comment-bug-72686.c new file mode 100644 index 000..67ebe73 --- /dev/null +++ b/src/glsl/glcpp/tests/121-comment-bug-72686.c @@ -0,0 +1,2 @@ +/* + */ // diff --git a/src/glsl/glcpp/tests/121-comment-bug-72686.c.expected b/src/glsl/glcpp/tests/121-comment-bug-72686.c.expected new file mode 100644 index 000..402a763 --- /dev/null +++ b/src/glsl/glcpp/tests/121-comment-bug-72686.c.expected @@ -0,0 +1,3 @@ + + + -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] glcpp: Don't enter lexer's NEWLINE_CATCHUP start state for single-line comments
In commit 6005e9cb28 a new start state of NEWLINE_CATCHUP was added to the lexer. This start state is used whenever the lexer is emitting a NEWLINE token to emit additional NEWLINE tokens for any newline characters that were skipped by an immediately preceding multi-line comment. However, that commit erroneously entered the NEWLINE_CATCHUP state for single-line comments. This is not desired since in the case of a single-line comment, the lexer is not emitting any NEWLINE token. The result is that the lexer will remain in the NEWLINE_CATCHUP state and proceed to fail to emit a NEWLINE token for the subsequent newline character, (since the case to match \n expects only the INITIAL start state). The fix is quite simple, remove the BEGIN NEWLINE_CATCHUP code from the single-line comment case, (preserving it only in exactly the cases where the lexer is actually emitting a NEWLINE token). My utmost tany hanks to Petri Latvala for reporting this bug and for providing the minimal test case to exercise it. The bug showed up only with a multi-line comment which was followed immediately by a single-line comment (without any intervening newline), such as: /* */ // Kablam! Since 6005e9cb28, and before this commit, that very innocent-looking combination of comments would yield a parse failure in the compiler. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72686 --- src/glsl/glcpp/glcpp-lex.l | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index f1fa192..ea3b862 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -155,8 +155,6 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? /* Single-line comments */ //[^\n]* { - if (parser-commented_newlines) - BEGIN NEWLINE_CATCHUP; } /* Multi-line comments */ -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] glcpp: Allow integer expression for #line directive.
Carl Worth cwo...@cworth.org writes: Matt Turner matts...@gmail.com writes: LINE_EXPANDED expression expression NEWLINE Yes. Thanks for the catch. I'll expand the testing and follow up with a new set of patches. Except that that's totally bogus. We can't parse two adjacent expressions with no intervening separator (assuming whitespace is valid within each expression). This looks to me like a bug in the GLSL specification. Real preprocessors for languages like C do not accept expressions for #line, (they do perform macro substitution, but the final result must be an integer constant, not an expression). And that's what is in the C specifications. A deviation to accept an expression here, (together with the replacement of a source-file string, with a source-file number), gives us something unparseable, (or at least under-specified). It feels like something specified without an implementation in hand, (which can lead to problems like this). Ian, I asked in the bug[*] already, but I'll ask again here. Where did this bug report come from? And can we fix the problem by pushing to have the specification updated? If not, (that is, if there are real-world users with non-integer-literal #line directives), then it would be nice to see what those actually are so we could, at the very least, resolve the grammar ambiguity in a direction that will solve the real-world cases. [*] https://bugs.freedesktop.org/show_bug.cgi?id=72273 -- carl.d.wo...@intel.com pgpON_fEKNxVI.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] i965: Use brw_bo_map() in intel_texsubimage_tiled_memcpy().
This additionally measures the time stalled, while also simplifying the code. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/intel_tex_subimage.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c b/src/mesa/drivers/dri/i965/intel_tex_subimage.c index ce8bbe1..6942039 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c @@ -610,13 +610,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx, intel_batchbuffer_flush(brw); } - if (unlikely(brw-perf_debug)) { - if (drm_intel_bo_busy(bo)) { - perf_debug(Mapping a busy BO, causing a stall on the GPU.\n); - } - } - - error = drm_intel_bo_map(bo, true /*write_enable*/); + error = brw_bo_map(brw, bo, true /* write enable */, miptree); if (error || bo-virtual == NULL) { DBG(%s: failed to map bo\n, __FUNCTION__); return false; -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] i965: Use brw_bo_map[_gtt]() in intel_miptree_map_raw().
This moves the intel_batchbuffer_flush before the drm_intel_bo_busy call, so it isn't entirely equivalent, but I think that should be fine. This code is strange anyway; the typical paradigm is to check whether the batch references the buffer, flush it if so, and then check whether it's busy. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 5a60637..24985dc 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -1706,18 +1706,12 @@ intel_miptree_map_raw(struct brw_context *brw, struct intel_mipmap_tree *mt) drm_intel_bo *bo = mt-region-bo; - if (unlikely(INTEL_DEBUG DEBUG_PERF)) { - if (drm_intel_bo_busy(bo)) { - perf_debug(Mapping a busy miptree, causing a stall on the GPU.\n); - } - } - intel_batchbuffer_flush(brw); if (mt-region-tiling != I915_TILING_NONE) - drm_intel_gem_bo_map_gtt(bo); + brw_bo_map_gtt(brw, bo, miptree); else - drm_intel_bo_map(bo, true); + brw_bo_map(brw, bo, true, miptree); return bo-virtual; } -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] i965: Create drm_intel_bo_map wrappers with performance warnings.
Mapping a buffer is a common place where we could stall the CPU. In a few places, we've added special code to check whether a buffer is busy and log the stall as a performance warning. Most of these give no indication of the severity of the stall, though, since measuring the time is a small hassle. This patch introduces a new brw_bo_map() function which wraps drm_intel_bo_map, but additionally measures the time stalled and reports a performance warning. If performance debugging is not enabled, it simply maps the buffer with negligable overhead. We also add a similar wrapper for drm_intel_gem_bo_map_gtt(). This should make it easy to add performance warnings in lots of places. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_context.h | 6 src/mesa/drivers/dri/i965/intel_buffer_objects.c | 40 2 files changed, 46 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 8d098e6..626bc50 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1654,6 +1654,12 @@ void brw_dump_perf_monitors(struct brw_context *brw); void brw_perf_monitor_new_batch(struct brw_context *brw); void brw_perf_monitor_finish_batch(struct brw_context *brw); +/* intel_buffer_objects.c */ +int brw_bo_map(struct brw_context *brw, drm_intel_bo *bo, int write_enable, + const char *bo_name); +int brw_bo_map_gtt(struct brw_context *brw, drm_intel_bo *bo, + const char *bo_name); + /* intel_extensions.c */ extern void intelInitExtensions(struct gl_context *ctx); diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c b/src/mesa/drivers/dri/i965/intel_buffer_objects.c index 4d7044a..a493c3b 100644 --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c @@ -41,6 +41,46 @@ #include intel_buffer_objects.h #include intel_batchbuffer.h +/** + * Map a buffer object; issue performance warnings if mapping causes stalls. + * + * This matches the drm_intel_bo_map API, but takes an additional human-readable + * name for the buffer object to use in the performance debug message. + */ +int +brw_bo_map(struct brw_context *brw, + drm_intel_bo *bo, int write_enable, + const char *bo_name) +{ + if (likely(!brw-perf_debug) || !drm_intel_bo_busy(bo)) + return drm_intel_bo_map(bo, write_enable); + + float start_time = get_time(); + + int ret = drm_intel_bo_map(bo, write_enable); + + perf_debug(CPU mapping a busy %s BO stalled and took %.03f ms.\n, + bo_name, (get_time() - start_time) * 1000); + + return ret; +} + +int +brw_bo_map_gtt(struct brw_context *brw, drm_intel_bo *bo, const char *bo_name) +{ + if (likely(!brw-perf_debug) || !drm_intel_bo_busy(bo)) + return drm_intel_gem_bo_map_gtt(bo); + + float start_time = get_time(); + + int ret = drm_intel_gem_bo_map_gtt(bo); + + perf_debug(GTT mapping a busy %s BO stalled and took %.03f ms.\n, + bo_name, (get_time() - start_time) * 1000); + + return ret; +} + static GLboolean intel_bufferobj_unmap(struct gl_context * ctx, struct gl_buffer_object *obj); -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] i965: Fix Gen8+ disassembly of half float subregister numbers.
Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/gen8_disasm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/i965/gen8_disasm.c b/src/mesa/drivers/dri/i965/gen8_disasm.c index 0ea5e73..387bb71 100644 --- a/src/mesa/drivers/dri/i965/gen8_disasm.c +++ b/src/mesa/drivers/dri/i965/gen8_disasm.c @@ -176,6 +176,7 @@ static const int reg_type_size[] = { [BRW_HW_REG_NON_IMM_TYPE_B] = 1, [GEN7_HW_REG_NON_IMM_TYPE_DF] = 8, [BRW_HW_REG_TYPE_F] = 4, + [GEN8_HW_REG_NON_IMM_TYPE_HF] = 2, }; static const char *const m_reg_file[4] = { -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] i965: Drop bogus F32TO16/F16TO32 instructions on Broadwell - use MOV.
Broadwell removed the F32TO16 and F16TO32 instructions. However, it has actual support for HF values, so they're actually just MOV. Fixes vs-packHalf2x16 and vs-unpackHalf2x16 tests (both the ARB extension and ES 3.0 variants). Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/gen8_fs_generator.cpp | 4 ++-- src/mesa/drivers/dri/i965/gen8_generator.cpp | 2 -- src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp index e550123..6793ce0 100644 --- a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp @@ -745,10 +745,10 @@ gen8_fs_generator::generate_code(exec_list *instructions) break; case BRW_OPCODE_F32TO16: - F32TO16(dst, src[0]); + MOV(retype(dst, BRW_REGISTER_TYPE_HF), src[0]); break; case BRW_OPCODE_F16TO32: - F16TO32(dst, src[0]); + MOV(dst, retype(src[0], BRW_REGISTER_TYPE_HF)); break; case BRW_OPCODE_CMP: diff --git a/src/mesa/drivers/dri/i965/gen8_generator.cpp b/src/mesa/drivers/dri/i965/gen8_generator.cpp index 8a79701..6b11e9a 100644 --- a/src/mesa/drivers/dri/i965/gen8_generator.cpp +++ b/src/mesa/drivers/dri/i965/gen8_generator.cpp @@ -154,8 +154,6 @@ ALU2(ASR) ALU3(BFE) ALU2(BFI1) ALU3(BFI2) -ALU1(F32TO16) -ALU1(F16TO32) ALU1(BFREV) ALU1(CBIT) ALU2_ACCUMULATE(ADDC) diff --git a/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp b/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp index 451da6e..314a6a4 100644 --- a/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp +++ b/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp @@ -589,11 +589,11 @@ gen8_vec4_generator::generate_vec4_instruction(vec4_instruction *instruction, break; case BRW_OPCODE_F32TO16: - F32TO16(dst, src[0]); + MOV(retype(dst, BRW_REGISTER_TYPE_HF), src[0]); break; case BRW_OPCODE_F16TO32: - F16TO32(dst, src[0]); + MOV(dst, retype(src[0], BRW_REGISTER_TYPE_HF)); break; case BRW_OPCODE_LRP: -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] i965/fs: Implement FS_OPCODE_[UN]PACK_HALF_2x16_SPLIT[_XY] opcodes.
I'd neglected to port these to Broadwell. Most of this code is copy and pasted from Gen7, but instead of using F32TO16/F16TO32, we just use MOV with HF register types. Fixes fs-packHalf2x16 and fs-unpackHalf2x16 tests (both the ARB extension and ES 3.0 variants). Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_fs.h | 7 +++ src/mesa/drivers/dri/i965/gen8_fs_generator.cpp | 76 - 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 9c5c13a..5c7f2ce 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -673,6 +673,13 @@ private: void generate_set_simd4x2_offset(fs_inst *ir, struct brw_reg dst, struct brw_reg offset); + void generate_pack_half_2x16_split(fs_inst *inst, + struct brw_reg dst, + struct brw_reg x, + struct brw_reg y); + void generate_unpack_half_2x16_split(fs_inst *inst, +struct brw_reg dst, +struct brw_reg src); void generate_discard_jump(fs_inst *ir); void patch_discard_jumps_to_fb_writes(); diff --git a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp index 6793ce0..43eaa35 100644 --- a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp @@ -582,6 +582,78 @@ gen8_fs_generator::generate_set_simd4x2_offset(fs_inst *ir, MOV_RAW(retype(brw_vec1_reg(dst.file, dst.nr, 0), value.type), value); } +/** + * Change the register's data type from UD to HF, doubling the strides in order + * to compensate for halving the data type width. + */ +static struct brw_reg +ud_reg_to_hf(struct brw_reg r) +{ + assert(r.type == BRW_REGISTER_TYPE_UD); + r.type = BRW_REGISTER_TYPE_HF; + + /* The BRW_*_STRIDE enums are defined so that incrementing the field +* doubles the real stride. +*/ + if (r.hstride != 0) + ++r.hstride; + if (r.vstride != 0) + ++r.vstride; + + return r; +} + +void +gen8_fs_generator::generate_pack_half_2x16_split(fs_inst *inst, + struct brw_reg dst, + struct brw_reg x, + struct brw_reg y) +{ + assert(dst.type == BRW_REGISTER_TYPE_UD); + assert(x.type == BRW_REGISTER_TYPE_F); + assert(y.type == BRW_REGISTER_TYPE_F); + + struct brw_reg dst_hf = ud_reg_to_hf(dst); + + /* Give each 32-bit channel of dst the form below , where . means +* unchanged. +* 0x +*/ + MOV(dst_hf, y); + + /* Now the form: +* 0x +*/ + SHL(dst, dst, brw_imm_ud(16u)); + + /* And, finally the form of packHalf2x16's output: +* 0x +*/ + MOV(dst_hf, x); +} + +void +gen8_fs_generator::generate_unpack_half_2x16_split(fs_inst *inst, + struct brw_reg dst, + struct brw_reg src) +{ + assert(dst.type == BRW_REGISTER_TYPE_F); + assert(src.type == BRW_REGISTER_TYPE_UD); + + struct brw_reg src_hf = ud_reg_to_hf(src); + + /* Each channel of src has the form of unpackHalf2x16's input: 0x. +* For the Y case, we wish to access only the upper word; therefore +* a 16-bit subregister offset is needed. +*/ + assert(inst-opcode == FS_OPCODE_UNPACK_HALF_2x16_SPLIT_X || + inst-opcode == FS_OPCODE_UNPACK_HALF_2x16_SPLIT_Y); + if (inst-opcode == FS_OPCODE_UNPACK_HALF_2x16_SPLIT_Y) + src_hf.subnr += 2; + + MOV(dst, src_hf); +} + void gen8_fs_generator::generate_code(exec_list *instructions) { @@ -965,12 +1037,12 @@ gen8_fs_generator::generate_code(exec_list *instructions) break; case FS_OPCODE_PACK_HALF_2x16_SPLIT: - assert(!XXX: Missing Gen8 scalar support for PACK_HALF_2x16_SPLIT); + generate_pack_half_2x16_split(ir, dst, src[0], src[1]); break; case FS_OPCODE_UNPACK_HALF_2x16_SPLIT_X: case FS_OPCODE_UNPACK_HALF_2x16_SPLIT_Y: - assert(!XXX: Missing Gen8 scalar support for UNPACK_HALF_2x16_SPLIT); + generate_unpack_half_2x16_split(ir, dst, src[0]); break; case FS_OPCODE_PLACEHOLDER_HALT: -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/7] dri2: Trust our own driver name lookup over the server's.
On Tue, Jan 28, 2014 at 2:13 PM, Ian Romanick i...@freedesktop.org wrote: On 01/28/2014 02:51 PM, Mark Mueller wrote: This patch could cause the i965 driver to not load if Mesa was built on a system without libudev devel present. For example on Fedora one should install systemd-devel before configuring and building Mesa drivers subsequent to this change. I don't think so. loader_get_driver_for_fd should return NULL in that case, and the loader will fallback to the old behavior. Except it doesn't; it goes and grabs the kernel module name. For example on an i965 it will try to open the i915 driver, because that's the name of the kernel module. The erroneous assumption in this patch is that dri2 implies libudev is present (this isn't checked by ./configure). Although that is true with dri3, it's not the case with dri2. So in that respect the patch is incorrect. Stéphane On Sun, Jan 26, 2014 at 4:02 PM, Keith Packard kei...@keithp.com mailto:kei...@keithp.com wrote: Eric Anholt e...@anholt.net mailto:e...@anholt.net writes: This allows Mesa to choose to rename driver .sos (or split drivers), without needing a flag day with the corresponding 2D driver. Reviewed-by: Keith Packard kei...@keithp.com mailto:kei...@keithp.com -- keith.pack...@intel.com mailto:keith.pack...@intel.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org mailto: mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] glcpp: Don't enter lexer's NEWLINE_CATCHUP start state for single-line comments
On Wed, Jan 29, 2014 at 2:20 PM, Carl Worth cwo...@cworth.org wrote: In commit 6005e9cb28 a new start state of NEWLINE_CATCHUP was added to the lexer. This start state is used whenever the lexer is emitting a NEWLINE token to emit additional NEWLINE tokens for any newline characters that were skipped by an immediately preceding multi-line comment. However, that commit erroneously entered the NEWLINE_CATCHUP state for single-line comments. This is not desired since in the case of a single-line comment, the lexer is not emitting any NEWLINE token. The result is that the lexer will remain in the NEWLINE_CATCHUP state and proceed to fail to emit a NEWLINE token for the subsequent newline character, (since the case to match \n expects only the INITIAL start state). The fix is quite simple, remove the BEGIN NEWLINE_CATCHUP code from the single-line comment case, (preserving it only in exactly the cases where the lexer is actually emitting a NEWLINE token). My utmost tany hanks to Petri Latvala for reporting this bug and for providing tany hanks = thanks Series Reviewed-by: Jordan Justen jordan.l.jus...@intel.com the minimal test case to exercise it. The bug showed up only with a multi-line comment which was followed immediately by a single-line comment (without any intervening newline), such as: /* */ // Kablam! Since 6005e9cb28, and before this commit, that very innocent-looking combination of comments would yield a parse failure in the compiler. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72686 --- src/glsl/glcpp/glcpp-lex.l | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index f1fa192..ea3b862 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -155,8 +155,6 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? /* Single-line comments */ //[^\n]* { - if (parser-commented_newlines) - BEGIN NEWLINE_CATCHUP; } /* Multi-line comments */ -- 1.8.5.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glcpp: Reject #version after the version has been resolved.
Reviewed-by: Jordan Justen jordan.l.jus...@intel.com On Wed, Jan 29, 2014 at 12:48 PM, Matt Turner matts...@gmail.com wrote: Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74166 --- src/glsl/glcpp/glcpp-parse.y | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 17bc649..4dba051 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -375,9 +375,15 @@ control_line: _glcpp_parser_skip_stack_pop (parser, @1); } NEWLINE | HASH_VERSION integer_constant NEWLINE { + if (parser-version_resolved) { + glcpp_error( @1, parser, #version after version is resolved); + } _glcpp_parser_handle_version_declaration(parser, $2, NULL, true); } | HASH_VERSION integer_constant IDENTIFIER NEWLINE { + if (parser-version_resolved) { + glcpp_error( @1, parser, #version after version is resolved); + } _glcpp_parser_handle_version_declaration(parser, $2, $3, true); } | HASH NEWLINE { -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] egl/glx: Remove egl_glx driver
On Mit, 2014-01-29 at 12:18 -0800, Matt Turner wrote: On Wed, Jan 29, 2014 at 9:25 AM, Chad Versace chad.vers...@linux.intel.com wrote: Mesa now has a real, feature-rich EGL implementation on X11 via xcb. Therefore I believe there is no longer a practical need for the egl_glx driver. Furthermore, egl_glx appears to be unmaintained. The most recent nontrivial commit driver was 6baa5f1 on 2011-11-25. Signed-off-by: Chad Versace chad.vers...@linux.intel.com --- In a similar vein -- is gallium_egl useful for anything these days? The only time I hear it mentioned is when telling others to not use it. In contrast to egl_dri2, egl_gallium supports OpenVG. -- Earthling Michel Dänzer| http://www.amd.com Libre software enthusiast |Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev