diff options
Diffstat (limited to 'indra/llwindow')
36 files changed, 90 insertions, 40 deletions
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 341bddfffd..4c6e706119 100644..100755 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -32,12 +32,17 @@ include_directories( ${LLXML_INCLUDE_DIRS} ${DIRECTX_INCLUDE_DIR} ) +include_directories(SYSTEM + ${LLCOMMON_SYSTEM_INCLUDE_DIRS} + ${LLXML_SYSTEM_INCLUDE_DIRS} + ) set(llwindow_SOURCE_FILES llkeyboard.cpp llkeyboardheadless.cpp llwindowheadless.cpp llwindowcallbacks.cpp + llwindow.cpp ) set(llwindow_HEADER_FILES @@ -50,7 +55,6 @@ set(llwindow_HEADER_FILES ) set(viewer_SOURCE_FILES - llwindow.cpp llmousehandler.cpp ) @@ -62,13 +66,43 @@ set(viewer_HEADER_FILES # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level -if (LINUX AND VIEWER) +if (LINUX) set(llwindow_LINK_LIBRARIES + ${LLCOMMON_LIBRARIES} + ${LLIMAGE_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLRENDER_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLWINDOW_LIBRARIES} + ${LLXML_LIBRARIES} ${UI_LIBRARIES} # for GTK ${SDL_LIBRARY} fontconfig # For FCInit and other FC* functions. ) -endif (LINUX AND VIEWER) + + list(APPEND viewer_SOURCE_FILES + llkeyboardsdl.cpp + llwindowsdl.cpp + ) + list(APPEND viewer_HEADER_FILES + llkeyboardsdl.h + llwindowsdl.h + ) + + if (BUILD_HEADLESS) + set(llwindowheadless_LINK_LIBRARIES + ${LLCOMMON_LIBRARIES} + ${LLIMAGE_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLRENDER_HEADLESS_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLWINDOW_HEADLESS_LIBRARIES} + ${LLXML_LIBRARIES} + fontconfig # For FCInit and other FC* functions. + ) + endif (BUILD_HEADLESS) + +endif (LINUX) if (DARWIN) list(APPEND llwindow_SOURCE_FILES @@ -91,16 +125,6 @@ if (DARWIN) ) endif (DARWIN) -if (LINUX AND VIEWER) - list(APPEND viewer_SOURCE_FILES - llkeyboardsdl.cpp - llwindowsdl.cpp - ) - list(APPEND viewer_HEADER_FILES - llkeyboardsdl.h - llwindowsdl.h - ) -endif (LINUX AND VIEWER) if (WINDOWS) list(APPEND llwindow_SOURCE_FILES @@ -133,40 +157,41 @@ endif (SOLARIS) set_source_files_properties(${llwindow_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) -if (SERVER AND NOT WINDOWS AND NOT DARWIN) - set(server_SOURCE_FILES +if (BUILD_HEADLESS) + set(llwindowheadless_SOURCE_FILES llwindowmesaheadless.cpp + llmousehandler.cpp ) - set(server_HEADER_FILES + set(llwindowheadless_HEADER_FILES llwindowmesaheadless.h - ) - copy_server_sources( - llwindow - ) - - - set_source_files_properties( - ${server_SOURCE_FILES} - PROPERTIES - COMPILE_FLAGS "-DLL_MESA=1 -DLL_MESA_HEADLESS=1" + llmousehandler.h ) add_library (llwindowheadless ${llwindow_SOURCE_FILES} - ${server_SOURCE_FILES} + ${llwindowheadless_SOURCE_FILES} ) - target_link_libraries (llwindowheadless ${llwindow_LINK_LIBRARIES}) -endif (SERVER AND NOT WINDOWS AND NOT DARWIN) + set_property(TARGET llwindowheadless + PROPERTY COMPILE_DEFINITIONS LL_MESA=1 LL_MESA_HEADLESS=1 + ) + target_link_libraries (llwindowheadless ${llwindowheadless_LINK_LIBRARIES} dl) +endif (BUILD_HEADLESS) if (llwindow_HEADER_FILES) list(APPEND llwindow_SOURCE_FILES ${llwindow_HEADER_FILES}) endif (llwindow_HEADER_FILES) + list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES}) -if (VIEWER) add_library (llwindow ${llwindow_SOURCE_FILES} ${viewer_SOURCE_FILES} ) + +if (SDL_FOUND) + set_property(TARGET llwindow + PROPERTY COMPILE_DEFINITIONS LL_SDL=1 + ) +endif (SDL_FOUND) + target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES}) -endif (VIEWER) diff --git a/indra/llwindow/GL/glh_extensions.h b/indra/llwindow/GL/glh_extensions.h index d89d85930b..554cb1731f 100644..100755 --- a/indra/llwindow/GL/glh_extensions.h +++ b/indra/llwindow/GL/glh_extensions.h @@ -113,7 +113,7 @@ static const char* EatNonWhiteSpace(const char *str) int glh_init_extensions(const char *origReqExts) { // Length of requested extensions string - unsigned reqExtsLen; + //unsigned reqExtsLen; char *reqExts; // Ptr for individual extensions within reqExts char *reqExt; @@ -155,8 +155,8 @@ int glh_init_extensions(const char *origReqExts) return TRUE; } reqExts = strdup(origReqExts); - reqExtsLen = (S32)strlen(reqExts); /* + reqExtsLen = (S32)strlen(reqExts); if (NULL == gGLHExts.mUnsupportedExts) { gGLHExts.mUnsupportedExts = (char*)malloc(reqExtsLen + 1); diff --git a/indra/llwindow/GL/glh_genext.h b/indra/llwindow/GL/glh_genext.h index cd5d1604a8..cd5d1604a8 100644..100755 --- a/indra/llwindow/GL/glh_genext.h +++ b/indra/llwindow/GL/glh_genext.h diff --git a/indra/llwindow/lldragdropwin32.cpp b/indra/llwindow/lldragdropwin32.cpp index 15acddd987..15acddd987 100644..100755 --- a/indra/llwindow/lldragdropwin32.cpp +++ b/indra/llwindow/lldragdropwin32.cpp diff --git a/indra/llwindow/lldragdropwin32.h b/indra/llwindow/lldragdropwin32.h index 929e7f9e37..929e7f9e37 100644..100755 --- a/indra/llwindow/lldragdropwin32.h +++ b/indra/llwindow/lldragdropwin32.h diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index 3579b5d42f..3579b5d42f 100644..100755 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp diff --git a/indra/llwindow/lldxhardware.h b/indra/llwindow/lldxhardware.h index 61a32bf0fb..61a32bf0fb 100644..100755 --- a/indra/llwindow/lldxhardware.h +++ b/indra/llwindow/lldxhardware.h diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index 8b356ba138..8b356ba138 100644..100755 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h index c155c1b362..c155c1b362 100644..100755 --- a/indra/llwindow/llkeyboard.h +++ b/indra/llwindow/llkeyboard.h diff --git a/indra/llwindow/llkeyboardheadless.cpp b/indra/llwindow/llkeyboardheadless.cpp index c87617c9ff..c87617c9ff 100644..100755 --- a/indra/llwindow/llkeyboardheadless.cpp +++ b/indra/llwindow/llkeyboardheadless.cpp diff --git a/indra/llwindow/llkeyboardheadless.h b/indra/llwindow/llkeyboardheadless.h index 4e666f8ce8..4e666f8ce8 100644..100755 --- a/indra/llwindow/llkeyboardheadless.h +++ b/indra/llwindow/llkeyboardheadless.h diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp index 7f8f303517..7f8f303517 100644..100755 --- a/indra/llwindow/llkeyboardmacosx.cpp +++ b/indra/llwindow/llkeyboardmacosx.cpp diff --git a/indra/llwindow/llkeyboardmacosx.h b/indra/llwindow/llkeyboardmacosx.h index f09ff720ce..f09ff720ce 100644..100755 --- a/indra/llwindow/llkeyboardmacosx.h +++ b/indra/llwindow/llkeyboardmacosx.h diff --git a/indra/llwindow/llkeyboardsdl.cpp b/indra/llwindow/llkeyboardsdl.cpp index 7c9aa1d340..7c9aa1d340 100644..100755 --- a/indra/llwindow/llkeyboardsdl.cpp +++ b/indra/llwindow/llkeyboardsdl.cpp diff --git a/indra/llwindow/llkeyboardsdl.h b/indra/llwindow/llkeyboardsdl.h index 02a71425f1..02a71425f1 100644..100755 --- a/indra/llwindow/llkeyboardsdl.h +++ b/indra/llwindow/llkeyboardsdl.h diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index be3fe5deb0..be3fe5deb0 100644..100755 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp diff --git a/indra/llwindow/llkeyboardwin32.h b/indra/llwindow/llkeyboardwin32.h index b7da450164..b7da450164 100644..100755 --- a/indra/llwindow/llkeyboardwin32.h +++ b/indra/llwindow/llkeyboardwin32.h diff --git a/indra/llwindow/llmousehandler.cpp b/indra/llwindow/llmousehandler.cpp index 8695e92f77..8695e92f77 100644..100755 --- a/indra/llwindow/llmousehandler.cpp +++ b/indra/llwindow/llmousehandler.cpp diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h index d825a3424c..d825a3424c 100644..100755 --- a/indra/llwindow/llmousehandler.h +++ b/indra/llwindow/llmousehandler.h diff --git a/indra/llwindow/llpreeditor.h b/indra/llwindow/llpreeditor.h index 9802fd8606..9802fd8606 100644..100755 --- a/indra/llwindow/llpreeditor.h +++ b/indra/llwindow/llpreeditor.h diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 93b9d36939..93b9d36939 100644..100755 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index e9147d552e..78186004b8 100644..100755 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -42,6 +42,7 @@ class LLWindowCallbacks; class LLWindow : public LLInstanceTracker<LLWindow> { public: + struct LLWindowResolution { S32 mWidth; diff --git a/indra/llwindow/llwindowcallbacks.cpp b/indra/llwindow/llwindowcallbacks.cpp index 9712ae1d91..9712ae1d91 100644..100755 --- a/indra/llwindow/llwindowcallbacks.cpp +++ b/indra/llwindow/llwindowcallbacks.cpp diff --git a/indra/llwindow/llwindowcallbacks.h b/indra/llwindow/llwindowcallbacks.h index 7da5959700..7da5959700 100644..100755 --- a/indra/llwindow/llwindowcallbacks.h +++ b/indra/llwindow/llwindowcallbacks.h diff --git a/indra/llwindow/llwindowheadless.cpp b/indra/llwindow/llwindowheadless.cpp index e6e6bc67ff..e6e6bc67ff 100644..100755 --- a/indra/llwindow/llwindowheadless.cpp +++ b/indra/llwindow/llwindowheadless.cpp diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h index 1f767f4c97..1f767f4c97 100644..100755 --- a/indra/llwindow/llwindowheadless.h +++ b/indra/llwindow/llwindowheadless.h diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 7893dedda4..7893dedda4 100644..100755 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index bebb537cd8..bebb537cd8 100644..100755 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 97637c937f..97637c937f 100644..100755 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index af83b50097..af83b50097 100644..100755 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h diff --git a/indra/llwindow/llwindowmesaheadless.cpp b/indra/llwindow/llwindowmesaheadless.cpp index 11c22ac94e..11c22ac94e 100644..100755 --- a/indra/llwindow/llwindowmesaheadless.cpp +++ b/indra/llwindow/llwindowmesaheadless.cpp diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h index 8f70aee4f6..8f70aee4f6 100644..100755 --- a/indra/llwindow/llwindowmesaheadless.h +++ b/indra/llwindow/llwindowmesaheadless.h diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index a15114cb9b..205466e936 100644..100755 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -1636,35 +1636,53 @@ void check_vm_bloat() { #if LL_LINUX // watch our own VM and RSS sizes, warn if we bloated rapidly - FILE *fp = fopen("/proc/self/stat", "r"); + static const std::string STATS_FILE = "/proc/self/stat"; + FILE *fp = fopen(STATS_FILE.c_str(), "r"); if (fp) { static long long last_vm_size = 0; static long long last_rss_size = 0; const long long significant_vm_difference = 250 * 1024*1024; const long long significant_rss_difference = 50 * 1024*1024; + long long this_vm_size = 0; + long long this_rss_size = 0; ssize_t res; size_t dummy; - char *ptr; + char *ptr = NULL; for (int i=0; i<22; ++i) // parse past the values we don't want { - ptr = NULL; res = getdelim(&ptr, &dummy, ' ', fp); + if (-1 == res) + { + llwarns << "Unable to parse " << STATS_FILE << llendl; + goto finally; + } free(ptr); + ptr = NULL; } // 23rd space-delimited entry is vsize - ptr = NULL; res = getdelim(&ptr, &dummy, ' ', fp); llassert(ptr); - long long this_vm_size = atoll(ptr); + if (-1 == res) + { + llwarns << "Unable to parse " << STATS_FILE << llendl; + goto finally; + } + this_vm_size = atoll(ptr); free(ptr); - // 24th space-delimited entry is RSS ptr = NULL; + // 24th space-delimited entry is RSS res = getdelim(&ptr, &dummy, ' ', fp); llassert(ptr); - long long this_rss_size = getpagesize() * atoll(ptr); + if (-1 == res) + { + llwarns << "Unable to parse " << STATS_FILE << llendl; + goto finally; + } + this_rss_size = getpagesize() * atoll(ptr); free(ptr); + ptr = NULL; llinfos << "VM SIZE IS NOW " << (this_vm_size/(1024*1024)) << " MB, RSS SIZE IS NOW " << (this_rss_size/(1024*1024)) << " MB" << llendl; @@ -1697,6 +1715,12 @@ void check_vm_bloat() last_rss_size = this_rss_size; last_vm_size = this_vm_size; +finally: + if (NULL != ptr) + { + free(ptr); + ptr = NULL; + } fclose(fp); } #endif // LL_LINUX diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index c5ce892a04..c5ce892a04 100644..100755 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 43c0090993..43c0090993 100644..100755 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 54c9ac4d4d..54c9ac4d4d 100644..100755 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h |