summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorGraham Madarasz <graham@lindenlab.com>2013-04-30 19:50:05 -0700
committerGraham Madarasz <graham@lindenlab.com>2013-04-30 19:50:05 -0700
commit806d09b1143894ad66cea2c228f467e8c39a8adf (patch)
tree512bfa5d5a8fe92ac4616fd9169e1c458b0e8b87 /indra/llwindow
parentb06ec66a5d11628905da256e084d0036f39ba529 (diff)
Merge 3.5.1 into Materials
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/CMakeLists.txt87
-rw-r--r--indra/llwindow/GL/glh_extensions.h4
-rw-r--r--indra/llwindow/llwindowsdl.cpp38
3 files changed, 89 insertions, 40 deletions
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt
index 341bddfffd..4c6e706119 100644
--- 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
--- 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/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index a15114cb9b..205466e936 100644
--- 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