From 0045a70d9619a5b0f3da9853c75587b765c1150a Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Sat, 1 Aug 2009 22:23:57 +0000 Subject: [PATCH] Allow users enabling workaround for menus with some Mesa3D drivers. Define the env var BLENDER_FORCE_SWAPBUFFERS to enable (1, yes, oui, the value does not matter, code just checks for existence). The issue seems to happen with Intel and Radeon, but enabling myswapbuffers() hack solves it (or reduces to just flicker) for now. https://bugs.freedesktop.org/show_bug.cgi?id=21774 Reported by Philippe Van Hecke. --- source/blender/src/glutil.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/blender/src/glutil.c b/source/blender/src/glutil.c index 69a44aff1e4..bb9b1be08b6 100644 --- a/source/blender/src/glutil.c +++ b/source/blender/src/glutil.c @@ -775,6 +775,20 @@ int is_a_really_crappy_nvidia_card(void) return well_is_it; } +int troublesome_mesa_buffers(void) +{ + static int check = -1; + + /* Driver bug is reported upstream, it should be fixed at some point, so do not hardcode */ + /* It has been reported to happen with intel and radeon drivers, must be something more general (DRI?) */ + /* https://bugs.freedesktop.org/show_bug.cgi?id=21774 */ + if (check == -1) { + check = (getenv("BLENDER_FORCE_SWAPBUFFERS") != NULL); + } + + return check; +} + void bglFlush(void) { glFlush(); @@ -782,6 +796,10 @@ void bglFlush(void) if(is_a_really_crappy_intel_card()) myswapbuffers(); //hack to get mac intel graphics to show frontbuffer #endif +#ifdef __linux__ + if(troublesome_mesa_buffers()) + myswapbuffers(); +#endif }