summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorprep <prep@lindenlab.com>2013-03-11 14:45:53 -0400
committerprep <prep@lindenlab.com>2013-03-11 14:45:53 -0400
commit207d9fd767895a3470722fb298eeef4f338e479a (patch)
tree050b5c2c1d88b910aeebe8c8be04c19f548bb123 /indra/llwindow
parent82c92ce5a97d6a83505c775348aef692e18e42ed (diff)
parentfe042430b03667abcd6b72ef9cc27d82d85f4242 (diff)
Viewer-chui merge
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/CMakeLists.txt97
-rw-r--r--indra/llwindow/GL/glh_extensions.h4
-rw-r--r--indra/llwindow/llwindowmacosx.cpp3
-rw-r--r--indra/llwindow/llwindowmacosx.h2
-rw-r--r--indra/llwindow/llwindowmesaheadless.cpp29
-rw-r--r--indra/llwindow/llwindowmesaheadless.h3
-rw-r--r--indra/llwindow/llwindowsdl.cpp13
-rw-r--r--indra/llwindow/llwindowsdl.h2
8 files changed, 87 insertions, 66 deletions
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt
index 341bddfffd..ad010164eb 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
+ llmousehandler.h
)
- copy_server_sources(
- llwindow
- )
-
-
- set_source_files_properties(
- ${server_SOURCE_FILES}
- PROPERTIES
- COMPILE_FLAGS "-DLL_MESA=1 -DLL_MESA_HEADLESS=1"
- )
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}
+list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES})
+
+add_library (llwindow
+ ${llwindow_SOURCE_FILES}
+ ${viewer_SOURCE_FILES}
+ )
+
+if (SDL_FOUND)
+ set_property(TARGET llwindow
+ PROPERTY COMPILE_DEFINITIONS LL_SDL=1
)
- target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES})
-endif (VIEWER)
+endif (SDL_FOUND)
+
+target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES})
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/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 97637c937f..413a9df616 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -210,7 +210,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
- BOOL disable_vsync, BOOL use_gl,
+ BOOL disable_vsync,
BOOL ignore_pixel_depth,
U32 fsaa_samples)
: LLWindow(NULL, fullscreen, flags)
@@ -228,7 +228,6 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
gKeyboard = new LLKeyboardMacOSX();
gKeyboard->setCallbacks(callbacks);
- // Ignore use_gl for now, only used for drones on PC
mWindow = NULL;
mContext = NULL;
mPixelFormat = NULL;
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index af83b50097..fcb738ed0f 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -122,7 +122,7 @@ public:
protected:
LLWindowMacOSX(LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
- BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
+ BOOL fullscreen, BOOL clearBg, BOOL disable_vsync,
BOOL ignore_pixel_depth,
U32 fsaa_samples);
~LLWindowMacOSX();
diff --git a/indra/llwindow/llwindowmesaheadless.cpp b/indra/llwindow/llwindowmesaheadless.cpp
index 11c22ac94e..2b668d3fc4 100644
--- a/indra/llwindow/llwindowmesaheadless.cpp
+++ b/indra/llwindow/llwindowmesaheadless.cpp
@@ -41,28 +41,25 @@ U16 *gMesaBuffer = NULL;
LLWindowMesaHeadless::LLWindowMesaHeadless(LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
U32 flags, BOOL fullscreen, BOOL clearBg,
- BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth)
+ BOOL disable_vsync, BOOL ignore_pixel_depth)
: LLWindow(callbacks, fullscreen, flags)
{
- if (use_gl)
- {
- llinfos << "MESA Init" << llendl;
- mMesaContext = OSMesaCreateContextExt( GL_RGBA, 32, 0, 0, NULL );
-
- /* Allocate the image buffer */
- mMesaBuffer = new unsigned char [width * height * 4 * MESA_CHANNEL_SIZE];
- llassert(mMesaBuffer);
+ llinfos << "MESA Init" << llendl;
+ mMesaContext = OSMesaCreateContextExt( GL_RGBA, 32, 0, 0, NULL );
- gMesaBuffer = (U16*)mMesaBuffer;
+ /* Allocate the image buffer */
+ mMesaBuffer = new unsigned char [width * height * 4 * MESA_CHANNEL_SIZE];
+ llassert(mMesaBuffer);
- /* Bind the buffer to the context and make it current */
- if (!OSMesaMakeCurrent( mMesaContext, mMesaBuffer, MESA_CHANNEL_TYPE, width, height ))
- {
- llerrs << "MESA: OSMesaMakeCurrent failed!" << llendl;
- }
+ gMesaBuffer = (U16*)mMesaBuffer;
- llverify(gGLManager.initGL());
+ /* Bind the buffer to the context and make it current */
+ if (!OSMesaMakeCurrent( mMesaContext, mMesaBuffer, MESA_CHANNEL_TYPE, width, height ))
+ {
+ llerrs << "MESA: OSMesaMakeCurrent failed!" << llendl;
}
+
+ llverify(gGLManager.initGL());
}
diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h
index 8f70aee4f6..c8d2bf2824 100644
--- a/indra/llwindow/llwindowmesaheadless.h
+++ b/indra/llwindow/llwindowmesaheadless.h
@@ -51,6 +51,7 @@ public:
/*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;};
/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;};
+ /*virtual*/ BOOL setSizeImpl(LLCoordWindow size) {return FALSE;};
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
@@ -97,7 +98,7 @@ public:
LLWindowMesaHeadless(LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
U32 flags, BOOL fullscreen, BOOL clearBg,
- BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
+ BOOL disable_vsync, BOOL ignore_pixel_depth);
~LLWindowMesaHeadless();
private:
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index a15114cb9b..0d2e0f78c1 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -186,7 +186,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
const std::string& title, S32 x, S32 y, S32 width,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
- BOOL disable_vsync, BOOL use_gl,
+ BOOL disable_vsync,
BOOL ignore_pixel_depth, U32 fsaa_samples)
: LLWindow(callbacks, fullscreen, flags),
Lock_Display(NULL),
@@ -197,7 +197,6 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
gKeyboard->setCallbacks(callbacks);
// Note that we can't set up key-repeat until after SDL has init'd video
- // Ignore use_gl for now, only used for drones on PC
mWindow = NULL;
mNeedsResize = FALSE;
mOverrideAspectRatio = 0.f;
@@ -1644,24 +1643,24 @@ void check_vm_bloat()
const long long significant_vm_difference = 250 * 1024*1024;
const long long significant_rss_difference = 50 * 1024*1024;
- ssize_t res;
size_t dummy;
char *ptr;
- for (int i=0; i<22; ++i) // parse past the values we don't want
+ size_t delim_result = 0;
+ for (int i=0; i<22 && delim_result > -1; ++i) // parse past the values we don't want
{
ptr = NULL;
- res = getdelim(&ptr, &dummy, ' ', fp);
+ delim_result = getdelim(&ptr, &dummy, ' ', fp);
free(ptr);
}
// 23rd space-delimited entry is vsize
ptr = NULL;
- res = getdelim(&ptr, &dummy, ' ', fp);
+ delim_result = getdelim(&ptr, &dummy, ' ', fp);
llassert(ptr);
long long this_vm_size = atoll(ptr);
free(ptr);
// 24th space-delimited entry is RSS
ptr = NULL;
- res = getdelim(&ptr, &dummy, ' ', fp);
+ delim_result = getdelim(&ptr, &dummy, ' ', fp);
llassert(ptr);
long long this_rss_size = getpagesize() * atoll(ptr);
free(ptr);
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index c5ce892a04..d430e3d83b 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -147,7 +147,7 @@ public:
protected:
LLWindowSDL(LLWindowCallbacks* callbacks,
const std::string& title, int x, int y, int width, int height, U32 flags,
- BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
+ BOOL fullscreen, BOOL clearBg, BOOL disable_vsync,
BOOL ignore_pixel_depth, U32 fsaa_samples);
~LLWindowSDL();