diff --git a/CMakeLists.txt b/CMakeLists.txt index d8dc6cd729..37daaf09f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,8 @@ if(OPENGL_FOUND) if (DL_LIBRARY) target_link_libraries(kdeinit_kwin ${DL_LIBRARY}) endif(DL_LIBRARY) + # must be after opengl, to be initialized first by the linker + target_link_libraries(kdeinit_kwin kwinnvidiahack) endif(OPENGL_FOUND) if (X11_Xrandr_FOUND) target_link_libraries(kdeinit_kwin ${X11_Xrandr_LIB}) @@ -91,6 +93,18 @@ install(TARGETS kdeinit_kwin DESTINATION ${LIB_INSTALL_DIR} ) target_link_libraries( kwin kdeinit_kwin ) install(TARGETS kwin DESTINATION ${BIN_INSTALL_DIR}) + +########### next target ############### + +set( kwinnvidiahack_LIB_SRCS + nvidiahack.cpp ) + + +kde4_add_library(kwinnvidiahack SHARED ${kwinnvidiahack_LIB_SRCS}) + +set_target_properties(kwinnvidiahack PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) +install(TARGETS kwinnvidiahack DESTINATION ${LIB_INSTALL_DIR} ) + ########### install files ############### install( FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) diff --git a/COMPOSITE_TODO b/COMPOSITE_TODO index 105689df20..457e262113 100644 --- a/COMPOSITE_TODO +++ b/COMPOSITE_TODO @@ -56,9 +56,6 @@ KDE 4.0 TODO - shm mode needs support for more data formats than GL_BGRA -? __GL_YIELD=NOTHING -? LIBGL_ALWAYS_INDIRECT - - check what works with XRender - should OpenGL fall back to XRender if OpenGL initialization fails? @@ -151,10 +148,6 @@ OpenGL TODO % AIGLX support - should work -+ - it needs indirect rendering, should be autodetected and disabled somehow -% - may require LIBGL_ALWAYS_INDIRECT set with older X.org - (http://lists.kde.org/?l=kwin&m=116439615124838&w=2) - (http://lists.freedesktop.org/archives/xorg/2006-December/020323.html) / GL_ARB_texture_rectangle vs GL_ARB_texture_non_power_of_two % - works; bugs in tfp_mode with power_of_two textures @@ -181,8 +174,11 @@ OpenGL TODO - this now works for 16bpp, but maybe not 15bpp or less - endian issues? -% __GL_YIELD=NOTHING for NVidia reportedly improves perceived performance - - it needs to be set somehow (http://lists.kde.org/?l=kwin&m=117794153720348&w=2) ++ support for __GL_YIELD=NOTHING and LIBGL_ALWAYS_INDIRECT should be possibly less hacky + - or at least not hardcoded (although, does that matter?) + - (http://lists.kde.org/?l=kwin&m=116439615124838&w=2) + - (http://lists.freedesktop.org/archives/xorg/2006-December/020323.html) + XRender TODO ============================== diff --git a/main.cpp b/main.cpp index f1553918bf..4e308a94e6 100644 --- a/main.cpp +++ b/main.cpp @@ -407,6 +407,8 @@ KDE_EXPORT int kdemain( int argc, char * argv[] ) signal(SIGINT, SIG_IGN); if (signal(SIGHUP, KWin::sighandler) == SIG_IGN) signal(SIGHUP, SIG_IGN); + // HACK this is needed for AIGLX + setenv( "LIBGL_ALWAYS_INDIRECT","1", true ); KWin::Application a; KWin::SessionManager weAreIndeed; KWin::SessionSaveDoneHelper helper; diff --git a/nvidiahack.cpp b/nvidiahack.cpp new file mode 100644 index 0000000000..ccf1fad579 --- /dev/null +++ b/nvidiahack.cpp @@ -0,0 +1,38 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Lubos Lunak + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ + +/* + + The only purpose of this file is to be later in the link order than + (nvidia's) libGL, thus being initialized by the dynamic linker before it, + allowing it to set __GL_YIELD=NOTHING soon enough for libGL to notice it. + +*/ + +#include +#include + +class kwinnvidiahack + { + public: + kwinnvidiahack() { setenv( "__GL_YIELD", "NOTHING", true ); } + }; + +kwinnvidiahack kwinnvidiahackinst;