Re: [Mesa-dev] [PATCH 2/3][RFC v2] mesa/main/x86: Add sse2 streaming clamping
Hello. I'd get rid of "_mm_set1_ps" inside "_mesa_clamp_float_rgba" by passing _m128 version of min/max directly, so "_mm_set1_ps" will be moved out of the for loop. I'd also unroll the "_mesa_streaming_clamp_float_rgba" loop to minimize the loop overhead (and utilize out of order execution as a bonus), because nothing compute intensive is happening there. You can also use prefetching (_mm_prefetch) there to improve performance by reading data ahead from memory. Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH V5] mesa: add SSE optimisation for glDrawElements
How and when is "cpu_has_sse4_1" true? Is it controllable at runtime through setting some environmental variable? or is it set once during startup by detecting CPU features? I guess checking for "cpu_has_sse4_1" is unnecessary if it isn't controllable by user at runtime; because "USE_SSE41" is a compile time check and requires the target machine to be SSE 4.1 capable already. Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] Require micro-benchmarks for performance optimization oriented patches
I know that this might sound troublesome but since there is no benchmarks done by reviewers before pushing the performance optimization oriented patches into master branch, I think it's as important as piglit tests and necessary to ask the patch provider for simple OpenGL micro benchmarks triggering the optimized code path to see if there is any real benefits and make sure that it isn't degrading the performance. Being more strict about pushing and quality assurance of these kind of patches will save hours of bisecting and hair-pulling to find the root cause of performance degrades. Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH V5] mesa: add SSE optimisation for glDrawElements
On 11/07/2014 03:14 PM, Steven Newbury wrote: On Thu, 2014-11-06 at 21:00 -0800, Matt Turner wrote: On Thu, Nov 6, 2014 at 8:56 PM, Siavash Eliasi < siavashser...@gmail.com> wrote: Then I do recommend removing the "if (cpu_has_sse4_1)" from this patch and similar places, because there is no runtime CPU dispatching happening for SSE optimized code paths in action and just adds extra overhead (unnecessary branches) to the generated code. No. Sorry, I realize I misread your previous question: I guess checking for "cpu_has_sse4_1" is unnecessary if it isn't controllable by user at runtime; because "USE_SSE41" is a compile time check and requires the target machine to be SSE 4.1 capable already. USE_SSE41 is set if the *compiler* supports SSE 4.1. This allows you to build the code and then use it only on systems that actually support it. All of this could have been pretty easily answered by a few greps though... I wonder what difference it would make to have an option to compile out the run-time check code to avoid the additional overhead in cases where the builder *knows* at compile time what the run-time system is? (ie Gentoo) I think that's possible. Since "cpu_has_sse4_1" and friends are simply macros, one can set them to "true" or "1" during compile time if it's going to be built for an SSE 4.1 capable target so your smart compiler will totally get rid of the unnecessary runtime check. I guess "common_x86_features.h" should be modified to something like this: #ifdef __SSE4_1__ #define cpu_has_sse4_1 1 #else #define cpu_has_sse4_1(_mesa_x86_cpu_features & X86_FEATURE_SSE4_1) #endif ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH V5] mesa: add SSE optimisation for glDrawElements
Then I do recommend removing the "if (cpu_has_sse4_1)" from this patch and similar places, because there is no runtime CPU dispatching happening for SSE optimized code paths in action and just adds extra overhead (unnecessary branches) to the generated code. Same must be applied to these patches: [Mesa-dev] [PATCH 2/2] i965: add runtime check for SSSE3 rgba8_copy http://lists.freedesktop.org/archives/mesa-dev/2014-November/070256.html Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH V5] mesa: add SSE optimisation for glDrawElements
On 11/07/2014 07:31 PM, Ian Romanick wrote: On 11/07/2014 06:09 AM, Siavash Eliasi wrote: On 11/07/2014 03:14 PM, Steven Newbury wrote: On Thu, 2014-11-06 at 21:00 -0800, Matt Turner wrote: On Thu, Nov 6, 2014 at 8:56 PM, Siavash Eliasi < siavashser...@gmail.com> wrote: Then I do recommend removing the "if (cpu_has_sse4_1)" from this patch and similar places, because there is no runtime CPU dispatching happening for SSE optimized code paths in action and just adds extra overhead (unnecessary branches) to the generated code. No. Sorry, I realize I misread your previous question: I guess checking for "cpu_has_sse4_1" is unnecessary if it isn't controllable by user at runtime; because "USE_SSE41" is a compile time check and requires the target machine to be SSE 4.1 capable already. USE_SSE41 is set if the *compiler* supports SSE 4.1. This allows you to build the code and then use it only on systems that actually support it. All of this could have been pretty easily answered by a few greps though... I wonder what difference it would make to have an option to compile out the run-time check code to avoid the additional overhead in cases where the builder *knows* at compile time what the run-time system is? (ie Gentoo) I think that's possible. Since "cpu_has_sse4_1" and friends are simply macros, one can set them to "true" or "1" during compile time if it's going to be built for an SSE 4.1 capable target so your smart compiler will totally get rid of the unnecessary runtime check. I guess "common_x86_features.h" should be modified to something like this: #ifdef __SSE4_1__ #define cpu_has_sse4_1 1 #else #define cpu_has_sse4_1(_mesa_x86_cpu_features & X86_FEATURE_SSE4_1) #endif I was thinking about doing something similar for cpu_has_xmm and cpu_has_xmm2 for x64. SSE and SSE2 are required parts of that instruction set, so they're always there. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev I can come up with a patch implementing the same for SSE, SSE2, SSE3 and SSSE3 if current approach is fine by you. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Require micro-benchmarks for performance optimization oriented patches
Sounds okay to me, thanks! Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Require micro-benchmarks for performance optimization oriented patches
On 11/07/2014 10:56 PM, Matt Turner wrote: On Fri, Nov 7, 2014 at 12:31 AM, Siavash Eliasi wrote: Being more strict about pushing and quality assurance of these kind of patches will save hours of bisecting and hair-pulling to find the root cause of performance degrades. You say this as if it has happened...? Nope, I'm not aware of any. Just saying that it's better to stay safe. Because mesa has reached a pretty much stable and usable state for gaming and daily tasks, we will see more of these patches in upcoming years. Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: Permanently enable features supported by target CPU at compile time.
This will remove the need for unnecessary runtime checks for CPU features if already supported by target CPU, resulting in smaller and less branchy code. --- src/mesa/x86/common_x86_features.h | 25 + 1 file changed, 25 insertions(+) diff --git a/src/mesa/x86/common_x86_features.h b/src/mesa/x86/common_x86_features.h index 66f2cf6..9888c26 100644 --- a/src/mesa/x86/common_x86_features.h +++ b/src/mesa/x86/common_x86_features.h @@ -67,5 +67,30 @@ #define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT) #define cpu_has_sse4_1 (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1) +/* Permanently enable features supported by target CPU at compile time */ +#ifdef __MMX__ +#define cpu_has_mmx1 +#endif + +#ifdef __SSE__ +#define cpu_has_xmm1 +#endif + +#ifdef __SSE2__ +#define cpu_has_xmm2 1 +#endif + +#ifdef __3dNOW__ +#define cpu_has_3dnow 1 +#endif + +#ifdef __SSSE3__ +#define cpu_has_ssse3 1 +#endif + +#ifdef __SSE4_1__ +#define cpu_has_sse4_1 1 +#endif + #endif -- 2.1.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Permanently enable features supported by target CPU at compile time.
On 11/08/2014 10:30 AM, Matt Turner wrote: On Fri, Nov 7, 2014 at 10:43 PM, Siavash Eliasi wrote: This will remove the need for unnecessary runtime checks for CPU features if already supported by target CPU, resulting in smaller and less branchy code. --- src/mesa/x86/common_x86_features.h | 25 + 1 file changed, 25 insertions(+) diff --git a/src/mesa/x86/common_x86_features.h b/src/mesa/x86/common_x86_features.h index 66f2cf6..9888c26 100644 --- a/src/mesa/x86/common_x86_features.h +++ b/src/mesa/x86/common_x86_features.h @@ -67,5 +67,30 @@ #define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT) #define cpu_has_sse4_1 (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1) +/* Permanently enable features supported by target CPU at compile time */ +#ifdef __MMX__ +#define cpu_has_mmx1 +#endif + +#ifdef __SSE__ +#define cpu_has_xmm1 +#endif + +#ifdef __SSE2__ +#define cpu_has_xmm2 1 +#endif + +#ifdef __3dNOW__ +#define cpu_has_3dnow 1 +#endif + +#ifdef __SSSE3__ +#define cpu_has_ssse3 1 +#endif There's not an existing cpu_has_ssse3 macro. Just wanted to add it in advance in case Timothy Arceri's patch gets merged: [Mesa-dev] [PATCH V2 1/2] mesa: add runtime support for SSSE3 http://lists.freedesktop.org/archives/mesa-dev/2014-November/070338.html I'll remove it if this isn't fine by you. + +#ifdef __SSE4_1__ +#define cpu_has_sse4_1 1 +#endif As you can see at the beginning of the patch, you're just redefining the same macros... They should be #ifdef __SSE__ #define cpu_has_xmm1 #else #define cpu_has_xmm (_mesa_x86_cpu_features & X86_FEATURE_XMM) #endif Sure, will modify it. By the way, GCC should use the last macro definition so "cpu_has_xmm" should be "1" in case it's going to be compiled for an SSE capable target and previous definition should be ignored. Am I missing something? Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2] mesa: Permanently enable features supported by target CPU at compile time.
This will remove the need for unnecessary runtime checks for CPU features if already supported by target CPU, resulting in smaller and less branchy code. V2: - Removed the SSSE3 related part for the not yet merged patch. - Avoiding redefinition of macros. --- src/mesa/x86/common_x86_features.h | 26 ++ 1 file changed, 26 insertions(+) diff --git a/src/mesa/x86/common_x86_features.h b/src/mesa/x86/common_x86_features.h index 66f2cf6..65634aa 100644 --- a/src/mesa/x86/common_x86_features.h +++ b/src/mesa/x86/common_x86_features.h @@ -59,13 +59,39 @@ #define X86_CPUEXT_3DNOW_EXT (1<<30) #define X86_CPUEXT_3DNOW (1<<31) +#ifdef __MMX__ +#define cpu_has_mmx1 +#else #define cpu_has_mmx(_mesa_x86_cpu_features & X86_FEATURE_MMX) +#endif + #define cpu_has_mmxext (_mesa_x86_cpu_features & X86_FEATURE_MMXEXT) + +#ifdef __SSE__ +#define cpu_has_xmm1 +#else #define cpu_has_xmm(_mesa_x86_cpu_features & X86_FEATURE_XMM) +#endif + +#ifdef __SSE2__ +#define cpu_has_xmm2 1 +#else #define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2) +#endif + +#ifdef __3dNOW__ +#define cpu_has_3dnow 1 +#else #define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW) +#endif + #define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT) + +#ifdef __SSE4_1__ +#define cpu_has_sse4_1 1 +#else #define cpu_has_sse4_1 (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1) +#endif #endif -- 2.1.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] mesa: helper macros to enable per function optimisations
I rather to not use compiler specific hacks in mesa. If it was a personal pet project it would make sense. Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] mesa: helper macros to enable per function optimisations
I know that's a time saver for developer (gcc function multi versioning), however I still do prefer the approach (my own ^^ ) which works on all setups regardless of hardware and compiler (well, any sane compiler ICC, GCC, Clang,...). Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH V2] mesa: Permanently enable features supported by target CPU at compile time.
On 11/08/2014 09:55 PM, Emil Velikov wrote: A comment I could not withheld based on your earlier post - "We require micro-benchmark for this code. It will take me hours to find why mesa is so slow now :P" Which brings the question why didn't you post to that thread/topic in first place instead :P Ideally mesa should have an infrastructure/farm that handles regressions - be that performance or otherwise. Pretty sure some companies have such features but those seem to be hidden behind locked doors :'( Yes, that's unfortunate. But atleast we have Phoronix :) Can you confirm that it does not cause issues with "interesting" setups such as https://bugs.freedesktop.org/show_bug.cgi?id=71547 Challenge accepted! What my patch is doing is to check for provided compile flags (-msse, ...) on compile time (__SSE__, ...) and set "cpu_has_sse" macro to "1" which allows any sane compiler to turn this pieces of code: #ifdef USE_SSE if (cpu_has_sse) { /* SSE code path */ } else #endif { /* C fallback */ } into this: /* SSE code path */ by using compile time information by target CPU. Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: Fix _mesa_uint_array_min_max linker error.
Fixes build process failure when providing -mno-sse4.1 CFLAGS: vbo_exec_array.c:(.text+0x9bb): undefined reference to `_mesa_uint_array_min_max' Similar bug: https://bugs.freedesktop.org/show_bug.cgi?id=71547 --- src/mesa/vbo/vbo_exec_array.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index e623b36..6362dd4 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -121,12 +121,14 @@ vbo_get_minmax_index(struct gl_context *ctx, } } else { +#ifdef __SSE4_1__ #if defined(USE_SSE41) if (cpu_has_sse4_1) { _mesa_uint_array_min_max(ui_indices, &min_ui, &max_ui, count); } else #endif +#endif for (i = 0; i < count; i++) { if (ui_indices[i] > max_ui) max_ui = ui_indices[i]; if (ui_indices[i] < min_ui) min_ui = ui_indices[i]; -- 2.1.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH V2] mesa: Permanently enable features supported by target CPU at compile time.
On 11/10/2014 04:28 AM, Emil Velikov wrote: On 09/11/14 04:37, Siavash Eliasi wrote: On 11/08/2014 09:55 PM, Emil Velikov wrote: [...] Can you confirm that it does not cause issues with "interesting" setups such as https://bugs.freedesktop.org/show_bug.cgi?id=71547 Challenge accepted! What my patch is doing is to check for provided compile flags (-msse, ...) on compile time (__SSE__, ...) and set "cpu_has_sse" macro to "1" which allows any sane compiler to turn this pieces of code: I'm not sure did you just said that you've checked it, or that's what it ought to do ? There is a reason why I'm so picky - this bizarre (as one might call it) setup is just the tip of the iceberg when it comes to people building mesa themselves. Would be nice to get your patch in as long as it does not break stuff :) -Emil I tried building with same CFLAGS in that bug report, no build failures; ofcourse after applying this patch: http://patchwork.freedesktop.org/patch/36869/ Best regards, Siavash Eliasi. Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Fix _mesa_uint_array_min_max linker error.
You are right. Any suggestions on how to fix this build failure? On 11/14/2014 10:10 PM, Ilia Mirkin wrote: And disables the optimization unless you're building with a -march that has sse4.1... thus defeating the purpose of doing it this way. On Fri, Nov 14, 2014 at 1:23 PM, Siavash Eliasi wrote: Fixes build process failure when providing -mno-sse4.1 CFLAGS: vbo_exec_array.c:(.text+0x9bb): undefined reference to `_mesa_uint_array_min_max' Similar bug: https://bugs.freedesktop.org/show_bug.cgi?id=71547 --- src/mesa/vbo/vbo_exec_array.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index e623b36..6362dd4 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -121,12 +121,14 @@ vbo_get_minmax_index(struct gl_context *ctx, } } else { +#ifdef __SSE4_1__ #if defined(USE_SSE41) if (cpu_has_sse4_1) { _mesa_uint_array_min_max(ui_indices, &min_ui, &max_ui, count); } else #endif +#endif for (i = 0; i < count; i++) { if (ui_indices[i] > max_ui) max_ui = ui_indices[i]; if (ui_indices[i] < min_ui) min_ui = ui_indices[i]; -- 2.1.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] mesa: Fix _mesa_uint_array_min_max linker error.
On 11/15/2014 01:20 AM, Timothy Arceri wrote: On Fri, 2014-11-14 at 22:14 +0330, Siavash Eliasi wrote: You are right. Any suggestions on how to fix this build failure? Using this would fix it but the optimisation would be disabled on clang. Not sure how many people are concerned about this, I don't use clang myself. [1] http://lists.freedesktop.org/archives/mesa-dev/2014-November/070387.html Unfortunately I'm not familiar with autoconf, but I think the magic should happen at configure.ac. I think USE_SSE41 macro should only defined when: 1. SSE4.1 is not permanently disabled (-mno-sse4.1) and 2. target compiler supports generating SSE4.1 code. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] configure.ac: roll up a program for the sse4.1 check
Tested on Core2 Q9550, using -march=native with and without -mno-sse4.1flag. It works perfect :) Also David Heidelberg kindly tested the patch which permanently enables optimized code paths if supported by target machine and it was okay. http://patchwork.freedesktop.org/patch/36488/ And a small improvement to your patch, I think including or the all-in-one alternative should be enough. Best regards, Siavash Eliasi. On 11/15/2014 08:34 PM, Emil Velikov wrote: So when checking/building sse code we have three possibilities: 1 Old compiler, throws an error when using -msse* 2 New compiler, user disables sse* (-mno-sse*) 3 New compiler, user doesn't disable sse The original code, added code for #1 but not #2. Later on we patched around the lack of handling #2 by wrapping the code in __SSE4_1__. Yet it lead to a missing/undefined symbol in case of #1 or #2, which might cause an issue for #2 when using the i965 driver. A bit later we "fixed" the undefined symbol by using #1, rather than updating it to handle #2. With this commit we set things straight :) To top it all up, conventions state that in case of conflicting (-enable-foo -disable-foo) options, the latter one takes precedence. Thus we need to make sure to prepend -msse4.1 to CFLAGS in our test. Cc: Siavash Eliasi Cc: Matt Turner Signed-off-by: Emil Velikov --- Man this thing is _very_ messy. Matt from the last hunk it seems that pixman might need fixing. Should be bother with that, or let people have fun when they hit it :P -Emil configure.ac | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 91e111b..9d1835e 100644 --- a/configure.ac +++ b/configure.ac @@ -252,7 +252,19 @@ AC_SUBST([VISIBILITY_CXXFLAGS]) dnl dnl Optional flags, check for compiler support dnl -AX_CHECK_COMPILE_FLAG([-msse4.1], [SSE41_SUPPORTED=1], [SSE41_SUPPORTED=0]) +save_CFLAGS="$CFLAGS" +CFLAGS="-msse4.1 $CFLAGS" +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#include +#include +#include +#include +int main () { +__m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c; +c = _mm_max_epu32(a, b); +return 0; +}]])], SSE41_SUPPORTED=1) +CFLAGS="$save_CFLAGS" if test "x$SSE41_SUPPORTED" = x1; then DEFINES="$DEFINES -DUSE_SSE41" fi ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa/main: Fix tmp_row memory leak in texstore_rgba_integer.
--- src/mesa/main/texstore.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index f913e42..f858cef 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1667,8 +1667,10 @@ texstore_rgba_integer(TEXSTORE_PARAMS) assert(is_array && !normalized); - if (!is_array) + if (!is_array) { + free(tmp_row); return GL_FALSE; + } invert_swizzle(dst2rgba, rgba2dst); compute_component_mapping(GL_RGBA, baseInternalFormat, base2rgba); -- 2.1.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa/main: Fix tmp_row memory leak in texstore_rgba_integer.
Please push it, I don't have write access. Best regards, Siavash Eliasi. On 11/15/2014 11:06 PM, Jason Ekstrand wrote: Good catch! Reviewed-by: Jason Ekstrand <mailto:jason.ekstr...@intel.com>> Can you push or do you need me to? On Sat, Nov 15, 2014 at 11:02 AM, Siavash Eliasi mailto:siavashser...@gmail.com>> wrote: --- src/mesa/main/texstore.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index f913e42..f858cef 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1667,8 +1667,10 @@ texstore_rgba_integer(TEXSTORE_PARAMS) assert(is_array && !normalized); - if (!is_array) + if (!is_array) { + free(tmp_row); return GL_FALSE; + } invert_swizzle(dst2rgba, rgba2dst); compute_component_mapping(GL_RGBA, baseInternalFormat, base2rgba); -- 2.1.3 ___ 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
Re: [Mesa-dev] [PATCH V2] mesa: Permanently enable features supported by target CPU at compile time.
On 11/10/2014 04:28 AM, Emil Velikov wrote: I'm not sure did you just said that you've checked it, or that's what it ought to do ? There is a reason why I'm so picky - this bizarre (as one might call it) setup is just the tip of the iceberg when it comes to people building mesa themselves. Would be nice to get your patch in as long as it does not break stuff :) -Emil Hello Emil, David Heidelberg kindly tested the patch on his machines and it was okay. Please consider pushing the patch upstream if it looks good to you guys too. Best regards, Siavash Eliasi. On 11/15/2014 08:58 PM, David Heidelberg wrote: Hello, I tested it directly on TK-55 laptop, crosscompiled (from my AMD A3870 to TK-55) and on my computer (A3870). Everything worked ok. Tested-by: David Heidelberg On 11/10/2014 04:53 AM, Siavash Eliasi wrote: Hello sir, I've sent a patch to mesa-dev which removes the runtime checks for CPU features which are known to be supported by that target at compile time. Just to make sure that this patch won't break your machine (Athlon TK-55?) with your usual build flags, can you please try this patch and see if that's ok for you? Patch: http://patchwork.freedesktop.org/patch/36488/ Related bug: https://bugs.freedesktop.org/show_bug.cgi?id=71547#c3 Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: Removed unnecessary check for NULL pointer when freeing memory block using _mesa_align_free.
Note that it is OK to pass NULL pointers to this function since this commit: mesa: modified _mesa_align_free() to accept NULL pointer http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0cc59d68a9f5231e8e2111393a1834858820735 --- src/mesa/main/bufferobj.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index cde6ac2..06928a0 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -562,8 +562,7 @@ _mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, (void) target; - if (bufObj->Data) - _mesa_align_free( bufObj->Data ); + _mesa_align_free( bufObj->Data ); new_data = _mesa_align_malloc( size, ctx->Const.MinMapBufferAlignment ); if (new_data) { -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Bad free in _mesa_delete_buffer_object
Hello, I'm responsible for the caused inconvenience. I forgot to use _mesa_align_free to clean up the allocated memory blocked using _mesa_align_malloc. Good catch and thanks for the patch! :) On POSIX aligned allocated memory (using posix_memalign) should be freed using ordinary free() and I didn't noticed any crashes. However other platforms do require special treatment ( eg _aligned_malloc and _aligned_free on MS Windows), so _mesa_align_free should have been called to handle those cases. Best regards, Siavash Eliasi. On 01/31/2014 02:38 PM, Colin Harrison wrote: Hi, I can get a crash without this change (now _mesa_align_malloc is being used for buffer object data) --- ./src/mesa/main/save_bufferobj.c2014-01-29 17:23:22.387706584 + +++ ./src/mesa/main/bufferobj.c 2014-01-31 11:01:26.164078585 + @@ -407,7 +407,7 @@ _mesa_delete_buffer_object(struct gl_con { (void) ctx; - free(bufObj->Data); + _mesa_align_free(bufObj->Data); /* assign strange values here to help w/ debugging */ bufObj->RefCount = -1000; Thanks, Colin Harrison ___ 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] Bad free in _mesa_delete_buffer_object
Hello, on which OS is this happening? On 01/31/2014 02:38 PM, Colin Harrison wrote: Hi, I can get a crash without this change (now _mesa_align_malloc is being used for buffer object data) --- ./src/mesa/main/save_bufferobj.c2014-01-29 17:23:22.387706584 + +++ ./src/mesa/main/bufferobj.c 2014-01-31 11:01:26.164078585 + @@ -407,7 +407,7 @@ _mesa_delete_buffer_object(struct gl_con { (void) ctx; - free(bufObj->Data); + _mesa_align_free(bufObj->Data); /* assign strange values here to help w/ debugging */ bufObj->RefCount = -1000; Thanks, Colin Harrison ___ 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 3/3] glx/apple: Fixed glx context memory leak in case of failure.
--- src/glx/apple/apple_glx_context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/glx/apple/apple_glx_context.c b/src/glx/apple/apple_glx_context.c index 0bb25b4..8a6ded2 100644 --- a/src/glx/apple/apple_glx_context.c +++ b/src/glx/apple/apple_glx_context.c @@ -142,6 +142,7 @@ apple_glx_create_context(void **ptr, Display * dpy, int screen, if (sharedac && !is_context_valid(sharedac)) { *errorptr = GLXBadContext; *x11errorptr = false; + free(ac); return true; } -- 1.8.5.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] gbm/dri: Fixed buffer object memory leak in case of failure.
--- src/gbm/backends/dri/gbm_dri.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index e013980..db4e074 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -609,7 +609,7 @@ gbm_dri_bo_create(struct gbm_device *gbm, dri_format = __DRI_IMAGE_FORMAT_XRGB2101010; break; default: - return NULL; + goto failed; } if (usage & GBM_BO_USE_SCANOUT) @@ -626,7 +626,7 @@ gbm_dri_bo_create(struct gbm_device *gbm, dri_format, dri_use, bo); if (bo->image == NULL) - return NULL; + goto failed; dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE, &bo->base.base.handle.s32); @@ -634,6 +634,10 @@ gbm_dri_bo_create(struct gbm_device *gbm, (int *) &bo->base.base.stride); return &bo->base.base; + +failed: + free(bo); + return NULL; } static struct gbm_surface * -- 1.8.5.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] r300g/tests: Added missing fclose for FILE resource.
--- src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c b/src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c index b4e30d8..239a762 100644 --- a/src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c +++ b/src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c @@ -557,6 +557,7 @@ unsigned load_program( if (last_char && last_char != '\n') { fprintf(stderr, "Error line cannot be longer than 100 " "characters:\n%s\n", line); + fclose(file); return 0; } @@ -605,5 +606,7 @@ unsigned load_program( // XXX: Parse immediates from the file. add_instruction(c, test->input[i]); } + + fclose(file); return 1; } -- 1.8.5.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/17] Modified softpipe to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT.
--- src/gallium/drivers/softpipe/sp_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 47ef20e..022b5bf 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -169,7 +169,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_START_INSTANCE: case PIPE_CAP_TEXTURE_MULTISAMPLE: case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: - return 0; + return 64; case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_CUBE_MAP_ARRAY: return 1; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/17] Modified llvmpipe to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT.
--- src/gallium/drivers/llvmpipe/lp_screen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index f61df98..8be1779 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -220,6 +220,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_START_INSTANCE: case PIPE_CAP_TEXTURE_MULTISAMPLE: case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_CUBE_MAP_ARRAY: return 0; case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/17] Modified allocation routine to use alignment of 64 instead of 16.
--- src/gallium/drivers/softpipe/sp_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 370f2b4..fb20748 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -88,7 +88,7 @@ softpipe_resource_layout(struct pipe_screen *screen, return FALSE; if (allocate) { - spr->data = align_malloc(buffer_size, 16); + spr->data = align_malloc(buffer_size, 64); return spr->data != NULL; } else { -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/17] Modified allocation routines to use alignment of 64 instead of 16.
--- src/gallium/drivers/llvmpipe/lp_texture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 0088b6a..d1ebeda 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -261,7 +261,7 @@ llvmpipe_resource_create(struct pipe_screen *_screen, * read/write always LP_RASTER_BLOCK_SIZE pixels, but the element * offset doesn't need to be aligned to LP_RASTER_BLOCK_SIZE. */ - lpr->data = align_malloc(bytes + (LP_RASTER_BLOCK_SIZE - 1) * 4 * sizeof(float), 16); + lpr->data = align_malloc(bytes + (LP_RASTER_BLOCK_SIZE - 1) * 4 * sizeof(float), 64); /* * buffers don't really have stride but it's probably safer * (for code doing same calculations for buffers and textures) @@ -746,7 +746,7 @@ llvmpipe_get_texture_image_address(struct llvmpipe_resource *lpr, static void alloc_image_data(struct llvmpipe_resource *lpr) { - uint alignment = MAX2(16, util_cpu_caps.cacheline); + uint alignment = MAX2(64, util_cpu_caps.cacheline); uint level; uint offset = 0; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 00/17] Newbie Project : Enable ARB_map_buffer_alignment in all drivers
Hello, this is a series of patches to accomplish *Enable ARB_map_buffer_alignment in all drivers* newbie project suggested by Ian Romanick. *Note* that I don't have write access, please merge them upstream after review process. Best Regards, Siavash Eliasi. Siavash Eliasi (17): Modified allocation routine to use alignment of 64 instead of 16. Modified softpipe to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. Modified allocation routines to use alignment of 64 instead of 16. Modified llvmpipe to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. Modified i915_buffer_create to use memory allocation alignment of 64 instead of 16. Modified i915g to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. Modified svga to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. Modified ilo to return 4096 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. Modified Mesa state tracker to unconditionally enable ARB_map_buffer_alignment. Modified _mesa_init_constants to set ctx->Const.MinMapBufferAlignment to 64. Modified _mesa_buffer_data to use _mesa_align_malloc. Modified radeonBufferData to pass ctx->Const.MinMapBufferAlignment as the alignment value to radeon_bo_open. Modified nouveau_bufferobj_data to pass ctx->Const.MinMapBufferAlignment as the alignment value to nouveau_bo_new. Modified i915 intel_bufferobj_data to use _mesa_align_malloc instead of malloc. Modified brw_initialize_context_constants to set ctx->Const.MinMapBufferAlignment to 4096. Modified extensions table to use o(dummy_true) instead of o(ARB_map_buffer_alignment). Deleted gl_extensions::ARB_map_buffer_alignment and all of its use cases. src/gallium/drivers/i915/i915_resource_buffer.c | 2 +- src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/ilo/ilo_screen.c| 2 +- src/gallium/drivers/llvmpipe/lp_screen.c| 1 + src/gallium/drivers/llvmpipe/lp_texture.c | 4 ++-- src/gallium/drivers/softpipe/sp_screen.c| 2 +- src/gallium/drivers/softpipe/sp_texture.c | 2 +- src/gallium/drivers/svga/svga_screen.c | 1 + src/mesa/drivers/dri/i915/intel_buffer_objects.c| 4 ++-- src/mesa/drivers/dri/i965/brw_context.c | 2 ++ src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c| 3 ++- src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 2 +- src/mesa/main/bufferobj.c | 4 ++-- src/mesa/main/context.c | 1 + src/mesa/main/extensions.c | 2 +- src/mesa/main/get.c | 1 - src/mesa/main/get_hash_params.py| 2 +- src/mesa/main/mtypes.h | 1 - src/mesa/state_tracker/st_extensions.c | 4 +--- 19 files changed, 22 insertions(+), 19 deletions(-) -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/17] Modified ilo to return 4096 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT.
--- src/gallium/drivers/ilo/ilo_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index a345b70..466b21c 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -406,7 +406,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TEXTURE_MULTISAMPLE: return false; /* TODO */ case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: - return 0; + return 4096; case PIPE_CAP_CUBE_MAP_ARRAY: case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: return true; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/17] Modified i915_buffer_create to use memory allocation alignment of 64 instead of 16.
--- src/gallium/drivers/i915/i915_resource_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c index 80ec43a..fd29524 100644 --- a/src/gallium/drivers/i915/i915_resource_buffer.c +++ b/src/gallium/drivers/i915/i915_resource_buffer.c @@ -135,7 +135,7 @@ i915_buffer_create(struct pipe_screen *screen, buf->b.vtbl = &i915_buffer_vtbl; pipe_reference_init(&buf->b.b.reference, 1); buf->b.b.screen = screen; - buf->data = align_malloc(template->width0, 16); + buf->data = align_malloc(template->width0, 64); buf->free_on_destroy = TRUE; if (!buf->data) -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 07/17] Modified svga to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT.
--- src/gallium/drivers/svga/svga_screen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index c16be16..9e67aa0 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -262,6 +262,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_TEXTURE_MULTISAMPLE: case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_CUBE_MAP_ARRAY: case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT: -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 17/17] Deleted gl_extensions::ARB_map_buffer_alignment and all of its use cases.
--- src/mesa/main/get.c| 1 - src/mesa/main/get_hash_params.py | 2 +- src/mesa/main/mtypes.h | 1 - src/mesa/state_tracker/st_extensions.c | 2 -- 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index eee8550..6293b02 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -369,7 +369,6 @@ EXTRA_EXT(OES_EGL_image_external); EXTRA_EXT(ARB_blend_func_extended); EXTRA_EXT(ARB_uniform_buffer_object); EXTRA_EXT(ARB_timer_query); -EXTRA_EXT(ARB_map_buffer_alignment); EXTRA_EXT(ARB_texture_cube_map_array); EXTRA_EXT(ARB_texture_buffer_range); EXTRA_EXT(ARB_texture_multisample); diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index c961fee..31f7867 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -715,7 +715,7 @@ descriptor=[ [ "TIMESTAMP", "LOC_CUSTOM, TYPE_INT64, 0, extra_ARB_timer_query" ], # GL_ARB_map_buffer_alignment - [ "MIN_MAP_BUFFER_ALIGNMENT", "CONTEXT_INT(Const.MinMapBufferAlignment), extra_ARB_map_buffer_alignment" ], + [ "MIN_MAP_BUFFER_ALIGNMENT", "CONTEXT_INT(Const.MinMapBufferAlignment), NO_EXTRA" ], # GL_ARB_texture_cube_map_array [ "TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_ARRAY_INDEX, extra_ARB_texture_cube_map_array" ], diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index ecfb5e0..6a52c27 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3339,7 +3339,6 @@ struct gl_extensions GLboolean ARB_half_float_vertex; GLboolean ARB_instanced_arrays; GLboolean ARB_internalformat_query; - GLboolean ARB_map_buffer_alignment; GLboolean ARB_map_buffer_range; GLboolean ARB_occlusion_query; GLboolean ARB_occlusion_query2; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 4707447..cbd5627 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -744,8 +744,6 @@ void st_init_extensions(struct st_context *st) ctx->Const.MinMapBufferAlignment = screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); - ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE; - if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) { ctx->Extensions.ARB_texture_buffer_object = GL_TRUE; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/17] Modified i915g to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT.
--- src/gallium/drivers/i915/i915_screen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 77607d0..3bc6ecf 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -213,6 +213,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_TEXTURE_MULTISAMPLE: case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK: return 0; case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/17] Modified Mesa state tracker to unconditionally enable ARB_map_buffer_alignment.
--- src/mesa/state_tracker/st_extensions.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index e8d0902..4707447 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -743,9 +743,9 @@ void st_init_extensions(struct st_context *st) ctx->Const.MinMapBufferAlignment = screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); - if (ctx->Const.MinMapBufferAlignment >= 64) { - ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE; - } + + ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE; + if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) { ctx->Extensions.ARB_texture_buffer_object = GL_TRUE; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 12/17] Modified radeonBufferData to pass ctx->Const.MinMapBufferAlignment as the alignment value to radeon_bo_open.
--- src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c index 40a16c3..ba7ab37 100644 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c @@ -103,7 +103,7 @@ radeonBufferData(struct gl_context * ctx, radeon_obj->bo = radeon_bo_open(radeon->radeonScreen->bom, 0, size, -32, +ctx->Const.MinMapBufferAlignment, RADEON_GEM_DOMAIN_GTT, 0); -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 14/17] Modified i915 intel_bufferobj_data to use _mesa_align_malloc instead of malloc.
--- src/mesa/drivers/dri/i915/intel_buffer_objects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_buffer_objects.c b/src/mesa/drivers/dri/i915/intel_buffer_objects.c index bc58c70..4fbf954 100644 --- a/src/mesa/drivers/dri/i915/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/i915/intel_buffer_objects.c @@ -137,7 +137,7 @@ intel_bufferobj_data(struct gl_context * ctx, * contents anyway. */ if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) { -intel_obj->sys_buffer = malloc(size); +intel_obj->sys_buffer = _mesa_align_malloc(size, ctx->Const.MinMapBufferAlignment); if (intel_obj->sys_buffer != NULL) { if (data != NULL) memcpy(intel_obj->sys_buffer, data, size); @@ -337,7 +337,7 @@ intel_bufferobj_map_range(struct gl_context * ctx, if ((access & GL_MAP_INVALIDATE_RANGE_BIT) && drm_intel_bo_busy(intel_obj->buffer)) { if (access & GL_MAP_FLUSH_EXPLICIT_BIT) { -intel_obj->range_map_buffer = malloc(length); +intel_obj->range_map_buffer = _mesa_align_malloc(length, ctx->Const.MinMapBufferAlignment); obj->Pointer = intel_obj->range_map_buffer; } else { intel_obj->range_map_bo = drm_intel_bo_alloc(intel->bufmgr, -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 16/17] Modified extensions table to use o(dummy_true) instead of o(ARB_map_buffer_alignment).
--- src/mesa/main/extensions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 104618c..6f73694 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -107,7 +107,7 @@ static const struct extension extension_table[] = { { "GL_ARB_instanced_arrays",o(ARB_instanced_arrays), GL, 2008 }, { "GL_ARB_internalformat_query", o(ARB_internalformat_query),GL, 2011 }, { "GL_ARB_invalidate_subdata", o(dummy_true), GL, 2012 }, - { "GL_ARB_map_buffer_alignment", o(ARB_map_buffer_alignment),GL, 2011 }, + { "GL_ARB_map_buffer_alignment",o(dummy_true), GL, 2011 }, { "GL_ARB_map_buffer_range",o(ARB_map_buffer_range), GL, 2008 }, { "GL_ARB_multisample", o(dummy_true), GLL,1994 }, { "GL_ARB_multitexture",o(dummy_true), GLL,1998 }, -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 11/17] Modified _mesa_buffer_data to use _mesa_align_malloc.
--- src/mesa/main/bufferobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index b27f592..5581a5d 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -416,9 +416,9 @@ _mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, { void * new_data; - (void) ctx; (void) target; + (void) target; - new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size ); + new_data = _mesa_align_malloc( size, ctx->Const.MinMapBufferAlignment ); if (new_data) { bufObj->Data = (GLubyte *) new_data; bufObj->Size = size; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 15/17] Modified brw_initialize_context_constants to set ctx->Const.MinMapBufferAlignment to 4096.
--- src/mesa/drivers/dri/i965/brw_context.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 6e09077..679ec0e 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -320,6 +320,8 @@ brw_initialize_context_constants(struct brw_context *brw) ctx->Const.MaxRenderbufferSize = 8192; + ctx->Const.MinMapBufferAlignment = 4096; + /* Hardware only supports a limited number of transform feedback buffers. * So we need to override the Mesa default (which is based only on software * limits). -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/17] Modified nouveau_bufferobj_data to pass ctx->Const.MinMapBufferAlignment as the alignment value to nouveau_bo_new.
--- src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c index 717c0b8..dc16585 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c @@ -95,7 +95,8 @@ nouveau_bufferobj_data(struct gl_context *ctx, GLenum target, GLsizeiptrARB size } else { /* Get a hardware BO */ ret = nouveau_bo_new(context_dev(ctx), -NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0, +NOUVEAU_BO_GART | NOUVEAU_BO_MAP, +ctx->Const.MinMapBufferAlignment, size, NULL, &nbo->bo); assert(!ret); } -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/17] Modified _mesa_init_constants to set ctx->Const.MinMapBufferAlignment to 64.
--- src/mesa/main/context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 87a4a35..9c516a2 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -586,6 +586,7 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxSpotExponent = 128.0; ctx->Const.MaxViewportWidth = MAX_VIEWPORT_WIDTH; ctx->Const.MaxViewportHeight = MAX_VIEWPORT_HEIGHT; + ctx->Const.MinMapBufferAlignment = 64; /** GL_ARB_uniform_buffer_object */ ctx->Const.MaxCombinedUniformBlocks = 36; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] Fixed setting switch cases prior to PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT incorrectly.
Thanks to Timothy Arceri for pointing that out! --- src/gallium/drivers/i915/i915_screen.c | 4 ++-- src/gallium/drivers/llvmpipe/lp_screen.c | 4 ++-- src/gallium/drivers/softpipe/sp_screen.c | 1 + src/gallium/drivers/svga/svga_screen.c | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 3bc6ecf..2ffe65b 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -212,10 +212,10 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_TEXTURE_MULTISAMPLE: - case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: - return 64; case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK: return 0; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME: case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 8be1779..e27f148 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -219,10 +219,10 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 16; case PIPE_CAP_START_INSTANCE: case PIPE_CAP_TEXTURE_MULTISAMPLE: - case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: - return 64; case PIPE_CAP_CUBE_MAP_ARRAY: return 0; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: return 1; case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE: diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 022b5bf..ab4fb4f 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -168,6 +168,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_START_INSTANCE: case PIPE_CAP_TEXTURE_MULTISAMPLE: + return 0; case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 64; case PIPE_CAP_QUERY_TIMESTAMP: diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 9e67aa0..3244c95 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -261,14 +261,14 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_START_INSTANCE: case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_TEXTURE_MULTISAMPLE: - case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: - return 64; case PIPE_CAP_CUBE_MAP_ARRAY: case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT: case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE: return 0; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: return 1; case PIPE_CAP_MAX_VIEWPORTS: -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] Fixed setting switch cases prior to PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT incorrectly.
Thanks to Timothy Arceri for pointing that out! --- src/gallium/drivers/i915/i915_screen.c | 4 ++-- src/gallium/drivers/llvmpipe/lp_screen.c | 4 ++-- src/gallium/drivers/softpipe/sp_screen.c | 1 + src/gallium/drivers/svga/svga_screen.c | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 3bc6ecf..2ffe65b 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -212,10 +212,10 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_TEXTURE_MULTISAMPLE: - case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: - return 64; case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK: return 0; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME: case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 8be1779..e27f148 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -219,10 +219,10 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 16; case PIPE_CAP_START_INSTANCE: case PIPE_CAP_TEXTURE_MULTISAMPLE: - case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: - return 64; case PIPE_CAP_CUBE_MAP_ARRAY: return 0; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: return 1; case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE: diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 022b5bf..ab4fb4f 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -168,6 +168,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_START_INSTANCE: case PIPE_CAP_TEXTURE_MULTISAMPLE: + return 0; case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 64; case PIPE_CAP_QUERY_TIMESTAMP: diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 9e67aa0..3244c95 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -261,14 +261,14 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_START_INSTANCE: case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_TEXTURE_MULTISAMPLE: - case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: - return 64; case PIPE_CAP_CUBE_MAP_ARRAY: case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT: case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE: return 0; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: return 1; case PIPE_CAP_MAX_VIEWPORTS: -- 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 00/17] Newbie Project : Enable ARB_map_buffer_alignment in all drivers
On 11/25/2013 10:50 AM, Chris Forbes wrote: Ah, I see you have a follow-up that fixes this already. Looks good, sorry for the noise. -- Chris I'm pretty new here and I'm not used to mailing lists, sorry if patches aren't showing up in correct place. Should I send all of patches again (and possibly squash a few) or is that fine by moderators? ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 02/17] Modified softpipe to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT.
Hello, thanks for reviewing these patches! There is a patch to address these issues: http://lists.freedesktop.org/archives/mesa-dev/2013-November/049057.html Best Regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 11/17] Modified _mesa_buffer_data to use _mesa_align_malloc.
Yes I think you are right, I guess *_mesa_align_realloc* is the correct function which should be used here. What do you think Ian? Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] Fixed memory leak.
--- src/mesa/main/bufferobj.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 5581a5d..e68d96d 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -420,6 +420,8 @@ _mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, new_data = _mesa_align_malloc( size, ctx->Const.MinMapBufferAlignment ); if (new_data) { + _mesa_align_free( bufObj->Data ); + bufObj->Data = (GLubyte *) new_data; bufObj->Size = size; bufObj->Usage = usage; -- 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 11/17] Modified _mesa_buffer_data to use _mesa_align_malloc.
Fixed memory leak, thanks for the heads up! http://lists.freedesktop.org/archives/mesa-dev/2013-November/049178.html Best Regards, Siavash Eliasi. On 11/26/2013 01:14 AM, Aaron Watry wrote: On Sun, Nov 24, 2013 at 11:36 PM, Siavash Eliasi wrote: --- src/mesa/main/bufferobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index b27f592..5581a5d 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -416,9 +416,9 @@ _mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, { void * new_data; - (void) ctx; (void) target; + (void) target; - new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size ); + new_data = _mesa_align_malloc( size, ctx->Const.MinMapBufferAlignment ); realloc can be used to either allocate a new buffer or re-allocate an existing buffer (which may or may not return a different pointer). Given that, I think that this will leak the old buffer (if one has already been allocated). From looking at the rest of the surrounding code in the patch, we don't preserve the existing buffer contents, so I guess I'd just FREE(bufObj->Data) within the following if block before assigning bufObj->Data = newdata; --Aaron if (new_data) { bufObj->Data = (GLubyte *) new_data; bufObj->Size = size; -- 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 11/17] Modified _mesa_buffer_data to use _mesa_align_malloc.
Now I understand why _mesa_realloc is not appropriate to use here. From spec: glBufferData creates a new data store for the buffer object currently bound to target. Any pre-existing data store is deleted. The new data store is created with the specified size in bytes and usage. If data is NULL, a data store of the specified size is still created, but its contents remain uninitialized and thus undefined. Best regards, Siavash Eliasi. On 11/26/2013 09:34 AM, Siavash Eliasi wrote: Yes I think you are right, I guess *_mesa_align_realloc* is the correct function which should be used here. What do you think Ian? Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] Modified _mesa_align_free to have consistent behavior
This avoids accidental dereferencing of an invalid memory address by _mesa_align_free when passed pointer is NULL. Also cleaned up different places where it was used, to avoid double check of passed pointer. Now it is safe to pass NULL pointer to this function and expect same behavior like free(). Best Regards, Siavash Eliasi. Siavash Eliasi (1): Modified _mesa_align_free to have consistent behavior when dealing with NULL memory address. src/mesa/main/imports.c| 7 +-- src/mesa/math/m_matrix.c | 13 + src/mesa/program/prog_parameter.c | 3 +-- src/mesa/state_tracker/st_cb_texture.c | 6 ++ src/mesa/swrast/s_texture.c| 7 +++ src/mesa/tnl/t_vertex.c| 6 ++ src/mesa/vbo/vbo_exec_api.c| 9 - 7 files changed, 22 insertions(+), 29 deletions(-) -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] Modified _mesa_align_free to have consistent behavior when dealing with NULL memory address.
--- src/mesa/main/imports.c| 7 +-- src/mesa/math/m_matrix.c | 13 + src/mesa/program/prog_parameter.c | 3 +-- src/mesa/state_tracker/st_cb_texture.c | 6 ++ src/mesa/swrast/s_texture.c| 7 +++ src/mesa/tnl/t_vertex.c| 6 ++ src/mesa/vbo/vbo_exec_api.c| 9 - 7 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 277e947..edfc0d1 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -177,6 +177,9 @@ _mesa_align_free(void *ptr) #elif defined(_WIN32) && defined(_MSC_VER) _aligned_free(ptr); #else + if (ptr == NULL) + return; + void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); void *realAddr = *cubbyHole; free(realAddr); @@ -199,8 +202,8 @@ _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize, if (newBuf && oldBuffer && copySize > 0) { memcpy(newBuf, oldBuffer, copySize); } - if (oldBuffer) - _mesa_align_free(oldBuffer); + + _mesa_align_free(oldBuffer); return newBuf; #endif } diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c index 2902315..274f969 100644 --- a/src/mesa/math/m_matrix.c +++ b/src/mesa/math/m_matrix.c @@ -1488,14 +1488,11 @@ _math_matrix_ctr( GLmatrix *m ) void _math_matrix_dtr( GLmatrix *m ) { - if (m->m) { - _mesa_align_free( m->m ); - m->m = NULL; - } - if (m->inv) { - _mesa_align_free( m->inv ); - m->inv = NULL; - } + _mesa_align_free( m->m ); + m->m = NULL; + + _mesa_align_free( m->inv ); + m->inv = NULL; } /*@}*/ diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index 4d9cf08..54531d2 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -83,8 +83,7 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList) free((void *)paramList->Parameters[i].Name); } free(paramList->Parameters); - if (paramList->ParameterValues) - _mesa_align_free(paramList->ParameterValues); + _mesa_align_free(paramList->ParameterValues); free(paramList); } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index faa9ee3..f33d3cf 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -175,10 +175,8 @@ st_FreeTextureImageBuffer(struct gl_context *ctx, pipe_resource_reference(&stImage->pt, NULL); } - if (stImage->TexData) { - _mesa_align_free(stImage->TexData); - stImage->TexData = NULL; - } + _mesa_align_free(stImage->TexData); + stImage->TexData = NULL; } diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 27803c5..c08a4e9 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -164,10 +164,9 @@ _swrast_free_texture_image_buffer(struct gl_context *ctx, struct gl_texture_image *texImage) { struct swrast_texture_image *swImage = swrast_texture_image(texImage); - if (swImage->Buffer) { - _mesa_align_free(swImage->Buffer); - swImage->Buffer = NULL; - } + + _mesa_align_free(swImage->Buffer); + swImage->Buffer = NULL; free(swImage->ImageSlices); swImage->ImageSlices = NULL; diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index c7a745e..8c4195e 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -546,10 +546,8 @@ void _tnl_free_vertices( struct gl_context *ctx ) struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); struct tnl_clipspace_fastpath *fp, *tmp; - if (vtx->vertex_buf) { - _mesa_align_free(vtx->vertex_buf); - vtx->vertex_buf = NULL; - } + _mesa_align_free(vtx->vertex_buf); + vtx->vertex_buf = NULL; for (fp = vtx->fastpath ; fp ; fp = tmp) { tmp = fp->next; diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 600398c..f3c41e0 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -989,11 +989,10 @@ void vbo_use_buffer_objects(struct gl_context *ctx) /* Make sure this func is only used once */ assert(exec->vtx.bufferobj == ctx->Shared->NullBufferObj); - if (exec->vtx.buffer_map) { - _mesa_align_free(exec->vtx.buffer_map); - exec->vtx.buffer_map = NULL; - exec->vtx.buffer_ptr = NULL; - } + + _mesa_align_free(exec->vtx.buffer_map); + exec->vtx.buffer_map = NULL; + exec->vtx.buffer_ptr = NULL; /* Allocate a real buffer object now */ _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL); -- 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] Fixed memory leak.
Thank you very much Alex for the tip. I'll modify commits and send a v2 series of patches. Before that I want to make sure that patch #17 is done correctly. I'll be thankful if someone finds time to review and comment on this patch: [Mesa-dev] [PATCH 17/17] Deleted gl_extensions::ARB_map_buffer_alignment and all of its use cases. http://lists.freedesktop.org/archives/mesa-dev/2013-November/049047.html Regards, Siavash Eliasi. On 11/26/2013 10:26 PM, Alex Deucher wrote: On Tue, Nov 26, 2013 at 1:22 PM, Siavash Eliasi wrote: In general, when you fix problems in prior patches, you should integrate the fix into the original patch(es) where the problems were, update the commit message to note what bugs were fixed and then re-send the patch set. That prevents broken commits from getting into the git tree even if they are fixed in a later commit. You can use git rebase -i to integrate your fixes. Alex ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 00/17] Newbie Project : Enable ARB_map_buffer_alignment in all drivers
Hello, this is V2 series of patches to accomplish *Enable ARB_map_buffer_alignment in all drivers* newbie project suggested by Ian Romanick. Revision 2: - Fixed setting switch cases prior to PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT incorrectly. - Fixed memory leak. Best regards, Siavash Eliasi. Siavash Eliasi (17): softpipe: Modified allocation routine to use alignment of 64 instead of 16. softpipe: Modified softpipe to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. llvmpipe: Modified allocation routines to use alignment of 64 instead of 16. llvmpipe: Modified llvmpipe to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. i915: Modified i915_buffer_create to use memory allocation alignment of 64 instead of 16. i915: Modified i915g to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. svga: Modified svga to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. ilo: Modified ilo to return 4096 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. mesa: Modified Mesa state tracker to unconditionally enable ARB_map_buffer_alignment. mesa: Modified _mesa_init_constants to set ctx->Const.MinMapBufferAlignment to 64. mesa: Modified _mesa_buffer_data to use _mesa_align_malloc. radeon: Modified radeonBufferData to pass ctx->Const.MinMapBufferAlignment as the alignment value to radeon_bo_open. nouveau: Modified nouveau_bufferobj_data to pass ctx->Const.MinMapBufferAlignment as the alignment value to nouveau_bo_new. i915: Modified i915 intel_bufferobj_data to use _mesa_align_malloc instead of malloc. i965: Modified brw_initialize_context_constants to set ctx->Const.MinMapBufferAlignment to 4096. mesa: Modified extensions table to use o(dummy_true) instead of o(ARB_map_buffer_alignment). mesa: Deleted gl_extensions::ARB_map_buffer_alignment and all of its use cases. src/gallium/drivers/i915/i915_resource_buffer.c | 2 +- src/gallium/drivers/i915/i915_screen.c | 3 ++- src/gallium/drivers/ilo/ilo_screen.c| 2 +- src/gallium/drivers/llvmpipe/lp_screen.c| 3 ++- src/gallium/drivers/llvmpipe/lp_texture.c | 4 ++-- src/gallium/drivers/softpipe/sp_screen.c| 3 ++- src/gallium/drivers/softpipe/sp_texture.c | 2 +- src/gallium/drivers/svga/svga_screen.c | 3 ++- src/mesa/drivers/dri/i915/intel_buffer_objects.c| 4 ++-- src/mesa/drivers/dri/i965/brw_context.c | 2 ++ src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c| 3 ++- src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 2 +- src/mesa/main/bufferobj.c | 7 +-- src/mesa/main/context.c | 1 + src/mesa/main/extensions.c | 2 +- src/mesa/main/get.c | 1 - src/mesa/main/get_hash_params.py| 2 +- src/mesa/main/mtypes.h | 1 - src/mesa/state_tracker/st_extensions.c | 4 +--- 19 files changed, 29 insertions(+), 22 deletions(-) -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 02/17] softpipe: Modified softpipe to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT.
Revision 2: - Fixed setting switch cases prior to PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT incorrectly. --- src/gallium/drivers/softpipe/sp_screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 47ef20e..ab4fb4f 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -168,8 +168,9 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_START_INSTANCE: case PIPE_CAP_TEXTURE_MULTISAMPLE: - case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 0; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_CUBE_MAP_ARRAY: return 1; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 01/17] softpipe: Modified allocation routine to use alignment of 64 instead of 16.
--- src/gallium/drivers/softpipe/sp_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 370f2b4..fb20748 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -88,7 +88,7 @@ softpipe_resource_layout(struct pipe_screen *screen, return FALSE; if (allocate) { - spr->data = align_malloc(buffer_size, 16); + spr->data = align_malloc(buffer_size, 64); return spr->data != NULL; } else { -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 10/17] mesa: Modified _mesa_init_constants to set ctx->Const.MinMapBufferAlignment to 64.
--- src/mesa/main/context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 87a4a35..9c516a2 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -586,6 +586,7 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxSpotExponent = 128.0; ctx->Const.MaxViewportWidth = MAX_VIEWPORT_WIDTH; ctx->Const.MaxViewportHeight = MAX_VIEWPORT_HEIGHT; + ctx->Const.MinMapBufferAlignment = 64; /** GL_ARB_uniform_buffer_object */ ctx->Const.MaxCombinedUniformBlocks = 36; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 04/17] llvmpipe: Modified llvmpipe to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT.
Revision 2: - Fixed setting switch cases prior to PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT incorrectly. --- src/gallium/drivers/llvmpipe/lp_screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index f61df98..e27f148 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -219,9 +219,10 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 16; case PIPE_CAP_START_INSTANCE: case PIPE_CAP_TEXTURE_MULTISAMPLE: - case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: case PIPE_CAP_CUBE_MAP_ARRAY: return 0; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: return 1; case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE: -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 05/17] i915: Modified i915_buffer_create to use memory allocation alignment of 64 instead of 16.
--- src/gallium/drivers/i915/i915_resource_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c index 80ec43a..fd29524 100644 --- a/src/gallium/drivers/i915/i915_resource_buffer.c +++ b/src/gallium/drivers/i915/i915_resource_buffer.c @@ -135,7 +135,7 @@ i915_buffer_create(struct pipe_screen *screen, buf->b.vtbl = &i915_buffer_vtbl; pipe_reference_init(&buf->b.b.reference, 1); buf->b.b.screen = screen; - buf->data = align_malloc(template->width0, 16); + buf->data = align_malloc(template->width0, 64); buf->free_on_destroy = TRUE; if (!buf->data) -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 07/17] svga: Modified svga to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT.
Revision 2: - Fixed setting switch cases prior to PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT incorrectly. --- src/gallium/drivers/svga/svga_screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index c16be16..3244c95 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -261,13 +261,14 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_START_INSTANCE: case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_TEXTURE_MULTISAMPLE: - case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: case PIPE_CAP_CUBE_MAP_ARRAY: case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT: case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE: return 0; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: return 1; case PIPE_CAP_MAX_VIEWPORTS: -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 12/17] radeon: Modified radeonBufferData to pass ctx->Const.MinMapBufferAlignment as the alignment value to radeon_bo_open.
--- src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c index 40a16c3..ba7ab37 100644 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c @@ -103,7 +103,7 @@ radeonBufferData(struct gl_context * ctx, radeon_obj->bo = radeon_bo_open(radeon->radeonScreen->bom, 0, size, -32, +ctx->Const.MinMapBufferAlignment, RADEON_GEM_DOMAIN_GTT, 0); -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 15/17] i965: Modified brw_initialize_context_constants to set ctx->Const.MinMapBufferAlignment to 4096.
--- src/mesa/drivers/dri/i965/brw_context.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 6e09077..679ec0e 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -320,6 +320,8 @@ brw_initialize_context_constants(struct brw_context *brw) ctx->Const.MaxRenderbufferSize = 8192; + ctx->Const.MinMapBufferAlignment = 4096; + /* Hardware only supports a limited number of transform feedback buffers. * So we need to override the Mesa default (which is based only on software * limits). -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 09/17] mesa: Modified Mesa state tracker to unconditionally enable ARB_map_buffer_alignment.
--- src/mesa/state_tracker/st_extensions.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index e8d0902..4707447 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -743,9 +743,9 @@ void st_init_extensions(struct st_context *st) ctx->Const.MinMapBufferAlignment = screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); - if (ctx->Const.MinMapBufferAlignment >= 64) { - ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE; - } + + ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE; + if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) { ctx->Extensions.ARB_texture_buffer_object = GL_TRUE; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 06/17] i915: Modified i915g to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT.
Revision 2: - Fixed setting switch cases prior to PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT incorrectly. --- src/gallium/drivers/i915/i915_screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 77607d0..2ffe65b 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -212,9 +212,10 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_TEXTURE_MULTISAMPLE: - case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK: return 0; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME: case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 03/17] llvmpipe: Modified allocation routines to use alignment of 64 instead of 16.
--- src/gallium/drivers/llvmpipe/lp_texture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 0088b6a..d1ebeda 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -261,7 +261,7 @@ llvmpipe_resource_create(struct pipe_screen *_screen, * read/write always LP_RASTER_BLOCK_SIZE pixels, but the element * offset doesn't need to be aligned to LP_RASTER_BLOCK_SIZE. */ - lpr->data = align_malloc(bytes + (LP_RASTER_BLOCK_SIZE - 1) * 4 * sizeof(float), 16); + lpr->data = align_malloc(bytes + (LP_RASTER_BLOCK_SIZE - 1) * 4 * sizeof(float), 64); /* * buffers don't really have stride but it's probably safer * (for code doing same calculations for buffers and textures) @@ -746,7 +746,7 @@ llvmpipe_get_texture_image_address(struct llvmpipe_resource *lpr, static void alloc_image_data(struct llvmpipe_resource *lpr) { - uint alignment = MAX2(16, util_cpu_caps.cacheline); + uint alignment = MAX2(64, util_cpu_caps.cacheline); uint level; uint offset = 0; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 11/17] mesa: Modified _mesa_buffer_data to use _mesa_align_malloc.
Revision 2: - Fixed memory leak. --- src/mesa/main/bufferobj.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index b27f592..111bea3 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -416,9 +416,12 @@ _mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, { void * new_data; - (void) ctx; (void) target; + (void) target; + + if (bufObj->Data) + _mesa_align_free( bufObj->Data ); - new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size ); + new_data = _mesa_align_malloc( size, ctx->Const.MinMapBufferAlignment ); if (new_data) { bufObj->Data = (GLubyte *) new_data; bufObj->Size = size; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 16/17] mesa: Modified extensions table to use o(dummy_true) instead of o(ARB_map_buffer_alignment).
--- src/mesa/main/extensions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 104618c..6f73694 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -107,7 +107,7 @@ static const struct extension extension_table[] = { { "GL_ARB_instanced_arrays",o(ARB_instanced_arrays), GL, 2008 }, { "GL_ARB_internalformat_query", o(ARB_internalformat_query),GL, 2011 }, { "GL_ARB_invalidate_subdata", o(dummy_true), GL, 2012 }, - { "GL_ARB_map_buffer_alignment", o(ARB_map_buffer_alignment),GL, 2011 }, + { "GL_ARB_map_buffer_alignment",o(dummy_true), GL, 2011 }, { "GL_ARB_map_buffer_range",o(ARB_map_buffer_range), GL, 2008 }, { "GL_ARB_multisample", o(dummy_true), GLL,1994 }, { "GL_ARB_multitexture",o(dummy_true), GLL,1998 }, -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 14/17] i915: Modified i915 intel_bufferobj_data to use _mesa_align_malloc instead of malloc.
--- src/mesa/drivers/dri/i915/intel_buffer_objects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_buffer_objects.c b/src/mesa/drivers/dri/i915/intel_buffer_objects.c index bc58c70..4fbf954 100644 --- a/src/mesa/drivers/dri/i915/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/i915/intel_buffer_objects.c @@ -137,7 +137,7 @@ intel_bufferobj_data(struct gl_context * ctx, * contents anyway. */ if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) { -intel_obj->sys_buffer = malloc(size); +intel_obj->sys_buffer = _mesa_align_malloc(size, ctx->Const.MinMapBufferAlignment); if (intel_obj->sys_buffer != NULL) { if (data != NULL) memcpy(intel_obj->sys_buffer, data, size); @@ -337,7 +337,7 @@ intel_bufferobj_map_range(struct gl_context * ctx, if ((access & GL_MAP_INVALIDATE_RANGE_BIT) && drm_intel_bo_busy(intel_obj->buffer)) { if (access & GL_MAP_FLUSH_EXPLICIT_BIT) { -intel_obj->range_map_buffer = malloc(length); +intel_obj->range_map_buffer = _mesa_align_malloc(length, ctx->Const.MinMapBufferAlignment); obj->Pointer = intel_obj->range_map_buffer; } else { intel_obj->range_map_bo = drm_intel_bo_alloc(intel->bufmgr, -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 13/17] nouveau: Modified nouveau_bufferobj_data to pass ctx->Const.MinMapBufferAlignment as the alignment value to nouveau_bo_new.
--- src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c index 717c0b8..dc16585 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c @@ -95,7 +95,8 @@ nouveau_bufferobj_data(struct gl_context *ctx, GLenum target, GLsizeiptrARB size } else { /* Get a hardware BO */ ret = nouveau_bo_new(context_dev(ctx), -NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0, +NOUVEAU_BO_GART | NOUVEAU_BO_MAP, +ctx->Const.MinMapBufferAlignment, size, NULL, &nbo->bo); assert(!ret); } -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 17/17] mesa: Deleted gl_extensions::ARB_map_buffer_alignment and all of its use cases.
--- src/mesa/main/get.c| 1 - src/mesa/main/get_hash_params.py | 2 +- src/mesa/main/mtypes.h | 1 - src/mesa/state_tracker/st_extensions.c | 2 -- 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index eee8550..6293b02 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -369,7 +369,6 @@ EXTRA_EXT(OES_EGL_image_external); EXTRA_EXT(ARB_blend_func_extended); EXTRA_EXT(ARB_uniform_buffer_object); EXTRA_EXT(ARB_timer_query); -EXTRA_EXT(ARB_map_buffer_alignment); EXTRA_EXT(ARB_texture_cube_map_array); EXTRA_EXT(ARB_texture_buffer_range); EXTRA_EXT(ARB_texture_multisample); diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index c961fee..31f7867 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -715,7 +715,7 @@ descriptor=[ [ "TIMESTAMP", "LOC_CUSTOM, TYPE_INT64, 0, extra_ARB_timer_query" ], # GL_ARB_map_buffer_alignment - [ "MIN_MAP_BUFFER_ALIGNMENT", "CONTEXT_INT(Const.MinMapBufferAlignment), extra_ARB_map_buffer_alignment" ], + [ "MIN_MAP_BUFFER_ALIGNMENT", "CONTEXT_INT(Const.MinMapBufferAlignment), NO_EXTRA" ], # GL_ARB_texture_cube_map_array [ "TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_ARRAY_INDEX, extra_ARB_texture_cube_map_array" ], diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index ecfb5e0..6a52c27 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3339,7 +3339,6 @@ struct gl_extensions GLboolean ARB_half_float_vertex; GLboolean ARB_instanced_arrays; GLboolean ARB_internalformat_query; - GLboolean ARB_map_buffer_alignment; GLboolean ARB_map_buffer_range; GLboolean ARB_occlusion_query; GLboolean ARB_occlusion_query2; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 4707447..cbd5627 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -744,8 +744,6 @@ void st_init_extensions(struct st_context *st) ctx->Const.MinMapBufferAlignment = screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); - ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE; - if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) { ctx->Extensions.ARB_texture_buffer_object = GL_TRUE; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2 08/17] ilo: Modified ilo to return 4096 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT.
--- src/gallium/drivers/ilo/ilo_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index a345b70..466b21c 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -406,7 +406,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TEXTURE_MULTISAMPLE: return false; /* TODO */ case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: - return 0; + return 4096; case PIPE_CAP_CUBE_MAP_ARRAY: case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: return true; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/17] softpipe: Modified allocation routine to use alignment of 64 instead of 16.
Revision 2: - Changed allocation alignment in softpipe_displaytarget_layout. --- src/gallium/drivers/softpipe/sp_texture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 370f2b4..d5d0d9d 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -88,7 +88,7 @@ softpipe_resource_layout(struct pipe_screen *screen, return FALSE; if (allocate) { - spr->data = align_malloc(buffer_size, 16); + spr->data = align_malloc(buffer_size, 64); return spr->data != NULL; } else { @@ -128,7 +128,7 @@ softpipe_displaytarget_layout(struct pipe_screen *screen, spr->base.format, spr->base.width0, spr->base.height0, - 16, + 64, &spr->stride[0] ); return spr->dt != NULL; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/17] llvmpipe: Modified allocation routines to use alignment of 64 instead of 16.
Revision 2: - Changed allocation alignment of llvmpipe_displaytarget_layout. --- src/gallium/drivers/llvmpipe/lp_texture.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 0088b6a..fa75df8 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -200,7 +200,7 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen, lpr->base.bind, lpr->base.format, width, height, - 16, + 64, &lpr->row_stride[0] ); if (lpr->dt == NULL) @@ -261,7 +261,7 @@ llvmpipe_resource_create(struct pipe_screen *_screen, * read/write always LP_RASTER_BLOCK_SIZE pixels, but the element * offset doesn't need to be aligned to LP_RASTER_BLOCK_SIZE. */ - lpr->data = align_malloc(bytes + (LP_RASTER_BLOCK_SIZE - 1) * 4 * sizeof(float), 16); + lpr->data = align_malloc(bytes + (LP_RASTER_BLOCK_SIZE - 1) * 4 * sizeof(float), 64); /* * buffers don't really have stride but it's probably safer * (for code doing same calculations for buffers and textures) @@ -746,7 +746,7 @@ llvmpipe_get_texture_image_address(struct llvmpipe_resource *lpr, static void alloc_image_data(struct llvmpipe_resource *lpr) { - uint alignment = MAX2(16, util_cpu_caps.cacheline); + uint alignment = MAX2(64, util_cpu_caps.cacheline); uint level; uint offset = 0; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 17/17] mesa: Deleted gl_extensions::ARB_map_buffer_alignment and all of its use cases.
Revision 2: - Making GL_ARB_map_buffer_alignment a desktop OpenGL extension only. --- src/mesa/main/get.c| 1 - src/mesa/main/get_hash_params.py | 2 +- src/mesa/main/mtypes.h | 1 - src/mesa/state_tracker/st_extensions.c | 2 -- 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index eee8550..6293b02 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -369,7 +369,6 @@ EXTRA_EXT(OES_EGL_image_external); EXTRA_EXT(ARB_blend_func_extended); EXTRA_EXT(ARB_uniform_buffer_object); EXTRA_EXT(ARB_timer_query); -EXTRA_EXT(ARB_map_buffer_alignment); EXTRA_EXT(ARB_texture_cube_map_array); EXTRA_EXT(ARB_texture_buffer_range); EXTRA_EXT(ARB_texture_multisample); diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index c961fee..733f63f 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -715,7 +715,7 @@ descriptor=[ [ "TIMESTAMP", "LOC_CUSTOM, TYPE_INT64, 0, extra_ARB_timer_query" ], # GL_ARB_map_buffer_alignment - [ "MIN_MAP_BUFFER_ALIGNMENT", "CONTEXT_INT(Const.MinMapBufferAlignment), extra_ARB_map_buffer_alignment" ], + [ "MIN_MAP_BUFFER_ALIGNMENT", "CONTEXT_INT(Const.MinMapBufferAlignment), EXTRA_API_GL" ], # GL_ARB_texture_cube_map_array [ "TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_ARRAY_INDEX, extra_ARB_texture_cube_map_array" ], diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index ecfb5e0..6a52c27 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3339,7 +3339,6 @@ struct gl_extensions GLboolean ARB_half_float_vertex; GLboolean ARB_instanced_arrays; GLboolean ARB_internalformat_query; - GLboolean ARB_map_buffer_alignment; GLboolean ARB_map_buffer_range; GLboolean ARB_occlusion_query; GLboolean ARB_occlusion_query2; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 4707447..cbd5627 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -744,8 +744,6 @@ void st_init_extensions(struct st_context *st) ctx->Const.MinMapBufferAlignment = screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); - ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE; - if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) { ctx->Extensions.ARB_texture_buffer_object = GL_TRUE; -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/17] i915g: Modified i915_buffer_create to use memory allocation alignment of 64 instead of 16.
--- src/gallium/drivers/i915/i915_resource_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c index 80ec43a..fd29524 100644 --- a/src/gallium/drivers/i915/i915_resource_buffer.c +++ b/src/gallium/drivers/i915/i915_resource_buffer.c @@ -135,7 +135,7 @@ i915_buffer_create(struct pipe_screen *screen, buf->b.vtbl = &i915_buffer_vtbl; pipe_reference_init(&buf->b.b.reference, 1); buf->b.b.screen = screen; - buf->data = align_malloc(template->width0, 16); + buf->data = align_malloc(template->width0, 64); buf->free_on_destroy = TRUE; if (!buf->data) -- 1.8.4.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/17] i915g: Modified i915g to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT.
Revision 2: - Fixed setting switch cases prior to PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT incorrectly. --- src/gallium/drivers/i915/i915_screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 77607d0..2ffe65b 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -212,9 +212,10 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_TEXTURE_MULTISAMPLE: - case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK: return 0; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME: case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: -- 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 V2 05/17] i915: Modified i915_buffer_create to use memory allocation alignment of 64 instead of 16.
Thank you for reviewing these patches, changes to commit messages are done: http://lists.freedesktop.org/archives/mesa-dev/2013-December/049581.html http://lists.freedesktop.org/archives/mesa-dev/2013-December/049582.html Best regards, Siavash Eliasi. On 12/03/2013 06:36 AM, Stéphane Marchesin wrote: 5 and 6 look good. One nitpick, please prefix the i915g changes with "i915g" instead of "i915" so it's obvious which driver is being changed from just looking at a git log. Stéphane On Thu, Nov 28, 2013 at 12:56 AM, Siavash Eliasi wrote: --- src/gallium/drivers/i915/i915_resource_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c index 80ec43a..fd29524 100644 --- a/src/gallium/drivers/i915/i915_resource_buffer.c +++ b/src/gallium/drivers/i915/i915_resource_buffer.c @@ -135,7 +135,7 @@ i915_buffer_create(struct pipe_screen *screen, buf->b.vtbl = &i915_buffer_vtbl; pipe_reference_init(&buf->b.b.reference, 1); buf->b.b.screen = screen; - buf->data = align_malloc(template->width0, 16); + buf->data = align_malloc(template->width0, 64); buf->free_on_destroy = TRUE; if (!buf->data) -- 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 V2 00/17] Newbie Project : Enable ARB_map_buffer_alignment in all drivers
Hi again, it's about one week these patches are receiving feedback and they (v2) look fine to reviewers. May I send a v3 for final review? Best regards, Siavash Eliasi. On 11/28/2013 12:26 PM, Siavash Eliasi wrote: Hello, this is V2 series of patches to accomplish *Enable ARB_map_buffer_alignment in all drivers* newbie project suggested by Ian Romanick. Revision 2: - Fixed setting switch cases prior to PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT incorrectly. - Fixed memory leak. Best regards, Siavash Eliasi. Siavash Eliasi (17): softpipe: Modified allocation routine to use alignment of 64 instead of 16. softpipe: Modified softpipe to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. llvmpipe: Modified allocation routines to use alignment of 64 instead of 16. llvmpipe: Modified llvmpipe to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. i915: Modified i915_buffer_create to use memory allocation alignment of 64 instead of 16. i915: Modified i915g to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. svga: Modified svga to return 64 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. ilo: Modified ilo to return 4096 in case of PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT. mesa: Modified Mesa state tracker to unconditionally enable ARB_map_buffer_alignment. mesa: Modified _mesa_init_constants to set ctx->Const.MinMapBufferAlignment to 64. mesa: Modified _mesa_buffer_data to use _mesa_align_malloc. radeon: Modified radeonBufferData to pass ctx->Const.MinMapBufferAlignment as the alignment value to radeon_bo_open. nouveau: Modified nouveau_bufferobj_data to pass ctx->Const.MinMapBufferAlignment as the alignment value to nouveau_bo_new. i915: Modified i915 intel_bufferobj_data to use _mesa_align_malloc instead of malloc. i965: Modified brw_initialize_context_constants to set ctx->Const.MinMapBufferAlignment to 4096. mesa: Modified extensions table to use o(dummy_true) instead of o(ARB_map_buffer_alignment). mesa: Deleted gl_extensions::ARB_map_buffer_alignment and all of its use cases. src/gallium/drivers/i915/i915_resource_buffer.c | 2 +- src/gallium/drivers/i915/i915_screen.c | 3 ++- src/gallium/drivers/ilo/ilo_screen.c| 2 +- src/gallium/drivers/llvmpipe/lp_screen.c| 3 ++- src/gallium/drivers/llvmpipe/lp_texture.c | 4 ++-- src/gallium/drivers/softpipe/sp_screen.c| 3 ++- src/gallium/drivers/softpipe/sp_texture.c | 2 +- src/gallium/drivers/svga/svga_screen.c | 3 ++- src/mesa/drivers/dri/i915/intel_buffer_objects.c| 4 ++-- src/mesa/drivers/dri/i965/brw_context.c | 2 ++ src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c| 3 ++- src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 2 +- src/mesa/main/bufferobj.c | 7 +-- src/mesa/main/context.c | 1 + src/mesa/main/extensions.c | 2 +- src/mesa/main/get.c | 1 - src/mesa/main/get_hash_params.py| 2 +- src/mesa/main/mtypes.h | 1 - src/mesa/state_tracker/st_extensions.c | 4 +--- 19 files changed, 29 insertions(+), 22 deletions(-) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V2] Modified _mesa_align_free to have consistent behavior when dealing with NULL memory address.
Revision 2: - Avoiding compile error on MSVC and possible warnings on other compilers. - Added comment regards passing NULL pointer being safe. --- src/mesa/main/imports.c| 14 +- src/mesa/math/m_matrix.c | 13 + src/mesa/program/prog_parameter.c | 3 +-- src/mesa/state_tracker/st_cb_texture.c | 6 ++ src/mesa/swrast/s_texture.c| 7 +++ src/mesa/tnl/t_vertex.c| 6 ++ src/mesa/vbo/vbo_exec_api.c| 9 - 7 files changed, 26 insertions(+), 32 deletions(-) diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 277e947..4afe156 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -168,6 +168,8 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment) * \param ptr pointer to the memory to be freed. * The actual address to free is stored in the word immediately before the * address the client sees. + * Note that it is legal to pass NULL pointer to this function and will be + * handled accordingly. */ void _mesa_align_free(void *ptr) @@ -177,9 +179,11 @@ _mesa_align_free(void *ptr) #elif defined(_WIN32) && defined(_MSC_VER) _aligned_free(ptr); #else - void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); - void *realAddr = *cubbyHole; - free(realAddr); + if (ptr) { + void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); + void *realAddr = *cubbyHole; + free(realAddr); + } #endif /* defined(HAVE_POSIX_MEMALIGN) */ } @@ -199,8 +203,8 @@ _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize, if (newBuf && oldBuffer && copySize > 0) { memcpy(newBuf, oldBuffer, copySize); } - if (oldBuffer) - _mesa_align_free(oldBuffer); + + _mesa_align_free(oldBuffer); return newBuf; #endif } diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c index 2902315..274f969 100644 --- a/src/mesa/math/m_matrix.c +++ b/src/mesa/math/m_matrix.c @@ -1488,14 +1488,11 @@ _math_matrix_ctr( GLmatrix *m ) void _math_matrix_dtr( GLmatrix *m ) { - if (m->m) { - _mesa_align_free( m->m ); - m->m = NULL; - } - if (m->inv) { - _mesa_align_free( m->inv ); - m->inv = NULL; - } + _mesa_align_free( m->m ); + m->m = NULL; + + _mesa_align_free( m->inv ); + m->inv = NULL; } /*@}*/ diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index 4d9cf08..54531d2 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -83,8 +83,7 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList) free((void *)paramList->Parameters[i].Name); } free(paramList->Parameters); - if (paramList->ParameterValues) - _mesa_align_free(paramList->ParameterValues); + _mesa_align_free(paramList->ParameterValues); free(paramList); } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index faa9ee3..f33d3cf 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -175,10 +175,8 @@ st_FreeTextureImageBuffer(struct gl_context *ctx, pipe_resource_reference(&stImage->pt, NULL); } - if (stImage->TexData) { - _mesa_align_free(stImage->TexData); - stImage->TexData = NULL; - } + _mesa_align_free(stImage->TexData); + stImage->TexData = NULL; } diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 27803c5..c08a4e9 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -164,10 +164,9 @@ _swrast_free_texture_image_buffer(struct gl_context *ctx, struct gl_texture_image *texImage) { struct swrast_texture_image *swImage = swrast_texture_image(texImage); - if (swImage->Buffer) { - _mesa_align_free(swImage->Buffer); - swImage->Buffer = NULL; - } + + _mesa_align_free(swImage->Buffer); + swImage->Buffer = NULL; free(swImage->ImageSlices); swImage->ImageSlices = NULL; diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index c7a745e..8c4195e 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -546,10 +546,8 @@ void _tnl_free_vertices( struct gl_context *ctx ) struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); struct tnl_clipspace_fastpath *fp, *tmp; - if (vtx->vertex_buf) { - _mesa_align_free(vtx->vertex_buf); - vtx->vertex_buf = NULL; - } + _mesa_align_free(vtx->vertex_buf); + vtx->vertex_buf = NULL; for (fp = vtx->fastpath ; fp ; fp = tmp) { tmp = fp->next; diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 600398c..f3c41e0 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -989,11 +989,10 @@ void vbo_use_buffer_objects(struct gl_context *ctx) /* Make sure this func is only used once */ assert(exec->v
Re: [Mesa-dev] [PATCH] Modified _mesa_align_free to have consistent behavior when dealing with NULL memory address.
On 12/03/2013 09:48 PM, Brian Paul wrote: On 11/26/2013 10:59 PM, Siavash Eliasi wrote: --- src/mesa/main/imports.c| 7 +-- src/mesa/math/m_matrix.c | 13 + src/mesa/program/prog_parameter.c | 3 +-- src/mesa/state_tracker/st_cb_texture.c | 6 ++ src/mesa/swrast/s_texture.c| 7 +++ src/mesa/tnl/t_vertex.c| 6 ++ src/mesa/vbo/vbo_exec_api.c| 9 - 7 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 277e947..edfc0d1 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -177,6 +177,9 @@ _mesa_align_free(void *ptr) #elif defined(_WIN32) && defined(_MSC_VER) _aligned_free(ptr); #else + if (ptr == NULL) + return; + We can't have code before declarations like this (MSVC will error and some other compilers warn depending on the C variant being targeted.) So, how about: if (ptr) { void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); void *realAddr = *cubbyHole; free(realAddr); } Maybe update the comment on the function to say that passing a NULL pointer is legal. Thanks for reviewing, all suggested changes are done. Here is the V2 patch containing those changes: [PATCH V2] Modified _mesa_align_free to have consistent behavior when dealing with NULL memory address http://lists.freedesktop.org/archives/mesa-dev/2013-December/049650.html The rest looks fine. With that fixed: Reviewed-by: Brian Paul Do you need someone to push patches for you? Yes please. I don't have write access. Best regards, Siavash Eliasi. void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); void *realAddr = *cubbyHole; free(realAddr); @@ -199,8 +202,8 @@ _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize, if (newBuf && oldBuffer && copySize > 0) { memcpy(newBuf, oldBuffer, copySize); } - if (oldBuffer) - _mesa_align_free(oldBuffer); + + _mesa_align_free(oldBuffer); return newBuf; #endif } diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c index 2902315..274f969 100644 --- a/src/mesa/math/m_matrix.c +++ b/src/mesa/math/m_matrix.c @@ -1488,14 +1488,11 @@ _math_matrix_ctr( GLmatrix *m ) void _math_matrix_dtr( GLmatrix *m ) { - if (m->m) { - _mesa_align_free( m->m ); - m->m = NULL; - } - if (m->inv) { - _mesa_align_free( m->inv ); - m->inv = NULL; - } + _mesa_align_free( m->m ); + m->m = NULL; + + _mesa_align_free( m->inv ); + m->inv = NULL; } /*@}*/ diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index 4d9cf08..54531d2 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -83,8 +83,7 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList) free((void *)paramList->Parameters[i].Name); } free(paramList->Parameters); - if (paramList->ParameterValues) - _mesa_align_free(paramList->ParameterValues); + _mesa_align_free(paramList->ParameterValues); free(paramList); } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index faa9ee3..f33d3cf 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -175,10 +175,8 @@ st_FreeTextureImageBuffer(struct gl_context *ctx, pipe_resource_reference(&stImage->pt, NULL); } - if (stImage->TexData) { - _mesa_align_free(stImage->TexData); - stImage->TexData = NULL; - } + _mesa_align_free(stImage->TexData); + stImage->TexData = NULL; } diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 27803c5..c08a4e9 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -164,10 +164,9 @@ _swrast_free_texture_image_buffer(struct gl_context *ctx, struct gl_texture_image *texImage) { struct swrast_texture_image *swImage = swrast_texture_image(texImage); - if (swImage->Buffer) { - _mesa_align_free(swImage->Buffer); - swImage->Buffer = NULL; - } + + _mesa_align_free(swImage->Buffer); + swImage->Buffer = NULL; free(swImage->ImageSlices); swImage->ImageSlices = NULL; diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index c7a745e..8c4195e 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -546,10 +546,8 @@ void _tnl_free_vertices( struct gl_context *ctx ) struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); struct tnl_clipspace_fastpath *fp, *tmp; - if (vtx->vertex_buf) { - _mesa_align_free(vtx->vertex_buf); - vtx->vertex_buf = NULL; - } + _me
[Mesa-dev] [PATCH] r600g: Removed unnecessary positivity check for unsigned int variable.
--- 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] hw_gl_select branch status
Hello dear mesa developers, What is current status of hw_gl_select branch? Is there any reason keeping it back from being merged into the master branch? Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] hw_gl_select branch status
On 06/03/2013 08:11 PM, Brian Paul wrote: On Mon, Jun 3, 2013 at 7:26 AM, Alex Deucher <mailto:alexdeuc...@gmail.com>> wrote: On Mon, Jun 3, 2013 at 3:22 AM, Siavash Eliasi mailto:siavashser...@gmail.com>> wrote: > Hello dear mesa developers, > > What is current status of hw_gl_select branch? Is there any reason keeping > it back from being merged into the master branch? IIRC, Brian wanted to review it a bit more, but I guess he never got to it. Yeah, that was a long time ago. I'll try to take a look this week. -Brian I really appreciate your work to get this patch merged. This patch will hopefully make workflow a lot more pleasant for all Blender users. Thank you all for brilliant work! Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev