summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp90
1 files changed, 68 insertions, 22 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 74adcbb2d1..c6a7ecdaa1 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -132,13 +132,17 @@
#include "stringize.h"
#include "llcoros.h"
#include "llexception.h"
-#if !LL_LINUX
+#if LL_DARWIN || LL_LINUX || __FreeBSD__
#include "cef/dullahan_version.h"
+#endif
#include "vlc/libvlc_version.h"
-#endif // LL_LINUX
#if LL_DARWIN
+#if LL_SDL
+#include "llwindowsdl.h"
+#else
#include "llwindowmacosx.h"
+#endif // LL_SDL
#endif
// Third party library includes
@@ -252,6 +256,8 @@ using namespace LL;
#include "llcoproceduremanager.h"
#include "llviewereventrecorder.h"
+#include <chrono>
+
// *FIX: These extern globals should be cleaned up.
// The globals either represent state/config/resource-storage of either
// this app, or another 'component' of the viewer. App globals should be
@@ -266,10 +272,6 @@ using namespace LL;
// define a self-registering event API object
#include "llappviewerlistener.h"
-#if LL_LINUX && LL_GTK
-#include "glib.h"
-#endif // (LL_LINUX) && LL_GTK
-
#if LL_MSVC
// disable boost::lexical_cast warning
#pragma warning (disable:4702)
@@ -312,6 +314,8 @@ S32 gLastExecDuration = -1; // (<0 indicates unknown)
# define LL_PLATFORM_KEY "mac"
#elif LL_LINUX
# define LL_PLATFORM_KEY "lnx"
+#elif __FreeBSD__
+# define LL_PLATFORM_KEY "bsd"
#else
# error "Unknown Platform"
#endif
@@ -387,6 +391,7 @@ static std::string gLaunchFileOnQuit;
// Used on Win32 for other apps to identify our window (eg, win_setup)
const char* const VIEWER_WINDOW_CLASSNAME = "Second Life";
+
//----------------------------------------------------------------------------
// List of entries from strings.xml to always replace
@@ -530,11 +535,13 @@ static void settings_to_globals()
{
LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize"));
-#if LL_DARWIN
+//#if LL_DARWIN
LLRender::sGLCoreProfile = true;
+/*
#else
LLRender::sGLCoreProfile = gSavedSettings.getBOOL("RenderGLContextCoreProfile");
#endif
+*/
LLRender::sNsightDebugSupport = gSavedSettings.getBOOL("RenderNsightDebugSupport");
LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic");
LLImageGL::sCompressTextures = gSavedSettings.getBOOL("RenderCompressTextures");
@@ -561,7 +568,11 @@ static void settings_to_globals()
LLWorldMapView::setScaleSetting(gSavedSettings.getF32("MapScale"));
#if LL_DARWIN
+#if LL_SDL
+ LLWindowSDL::sUseMultGL = gSavedSettings.getBOOL("RenderAppleUseMultGL");
+#else
LLWindowMacOSX::sUseMultGL = gSavedSettings.getBOOL("RenderAppleUseMultGL");
+#endif // LL_SDL
gHiDPISupport = gSavedSettings.getBOOL("RenderHiDPI");
#endif
}
@@ -667,7 +678,7 @@ LLAppViewer::LLAppViewer()
// Need to do this initialization before we do anything else, since anything
// that touches files should really go through the lldir API
- gDirUtilp->initAppDirs("SecondLife");
+ gDirUtilp->initAppDirs("Megapahit");
//
// IMPORTANT! Do NOT put anything that will write
// into the log files during normal startup until AFTER
@@ -886,7 +897,7 @@ bool LLAppViewer::init()
std::string mime_types_name;
#if LL_DARWIN
mime_types_name = "mime_types_mac.xml";
-#elif LL_LINUX
+#elif LL_LINUX || __FreeBSD__
mime_types_name = "mime_types_linux.xml";
#else
mime_types_name = "mime_types.xml";
@@ -962,6 +973,7 @@ bool LLAppViewer::init()
return 0;
}
+#if defined(__i386__) || defined(__x86_64__) || defined(__amd64__)
// Without SSE2 support we will crash almost immediately, warn here.
if (!gSysCPU.hasSSE2())
{
@@ -973,6 +985,7 @@ bool LLAppViewer::init()
OSMB_OK);
return 0;
}
+#endif
// alert the user if they are using unsupported hardware
if(!gSavedSettings.getBOOL("AlertedUnsupportedHardware"))
@@ -1125,7 +1138,7 @@ bool LLAppViewer::init()
gGLActive = FALSE;
-#if LL_RELEASE_FOR_DOWNLOAD
+#if 0 // LL_RELEASE_FOR_DOWNLOAD && !LL_LINUX
// Skip updater if this is a non-interactive instance
if (!gSavedSettings.getBOOL("CmdLineSkipUpdater") && !gNonInteractive)
{
@@ -1357,6 +1370,13 @@ bool LLAppViewer::frame()
bool LLAppViewer::doFrame()
{
+ static LLCachedControl<U32> fpsLimitMaxFps(gSavedSettings, "MaxFPS", 0);
+
+ using TimePoint = std::chrono::steady_clock::time_point;
+
+ U64 fpsLimitSleepFor = 0;
+ TimePoint fpsLimitFrameStartTime = std::chrono::steady_clock::now();
+
LL_RECORD_BLOCK_TIME(FTM_FRAME);
{
// and now adjust the visuals from previous frame.
@@ -1527,6 +1547,18 @@ bool LLAppViewer::doFrame()
}
}
+ if(fpsLimitMaxFps > 0)
+ {
+ auto elapsed = std::chrono::steady_clock::now() - fpsLimitFrameStartTime;
+
+ long long fpsLimitFrameTime = std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count();
+ U64 desired_time_us = (U32)(1000000.f / fpsLimitMaxFps);
+ if((fpsLimitFrameTime+1000) < desired_time_us)
+ {
+ fpsLimitSleepFor = (desired_time_us - fpsLimitFrameTime - 1000) * 1.0;
+ }
+ }
+
{
LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df pauseMainloopTimeout" )
pingMainloopTimeout("Main:Sleep");
@@ -1539,6 +1571,11 @@ bool LLAppViewer::doFrame()
//LL_RECORD_BLOCK_TIME(SLEEP2);
LL_PROFILE_ZONE_WARN( "Sleep2" )
+ if(fpsLimitSleepFor)
+ {
+ usleep(fpsLimitSleepFor);
+ }
+
// yield some time to the os based on command line option
static LLCachedControl<S32> yield_time(gSavedSettings, "YieldTime", -1);
if(yield_time >= 0)
@@ -1728,7 +1765,7 @@ bool LLAppViewer::cleanup()
// one because it happens just after mFastTimerLogThread is deleted. This
// comment is in case we guessed wrong, so we can move it here instead.
-#if LL_LINUX
+#if LL_LINUX || __FreeBSD__
// remove any old breakpad minidump files from the log directory
if (! isError())
{
@@ -2354,6 +2391,14 @@ void LLAppViewer::initLoggingAndGetLastDuration()
{
LL_WARNS("MarkerFile") << duration_log_msg << LL_ENDL;
}
+
+ std::string user_data_path_cef_log = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "cef.log");
+ if (gDirUtilp->fileExists(user_data_path_cef_log))
+ {
+ std::string user_data_path_cef_old = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "cef.old");
+ LLFile::remove(user_data_path_cef_old, ENOENT);
+ LLFile::rename(user_data_path_cef_log, user_data_path_cef_old);
+ }
}
}
@@ -2994,9 +3039,10 @@ void LLAppViewer::initStrings()
std::string strings_path_full = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, strings_file);
if (strings_path_full.empty() || !LLFile::isfile(strings_path_full))
{
+ std::string crash_reason;
if (strings_path_full.empty())
{
- LL_WARNS() << "The file '" << strings_file << "' is not found" << LL_ENDL;
+ crash_reason = "The file '" + strings_file + "' is not found";
}
else
{
@@ -3004,24 +3050,23 @@ void LLAppViewer::initStrings()
int rc = LLFile::stat(strings_path_full, &st);
if (rc != 0)
{
- LL_WARNS() << "The file '" << strings_path_full << "' failed to get status. Error code: " << rc << LL_ENDL;
+ crash_reason = "The file '" + strings_path_full + "' failed to get status. Error code: " + std::to_string(rc);
}
else if (S_ISDIR(st.st_mode))
{
- LL_WARNS() << "The filename '" << strings_path_full << "' is a directory name" << LL_ENDL;
+ crash_reason = "The filename '" + strings_path_full + "' is a directory name";
}
else
{
- LL_WARNS() << "The filename '" << strings_path_full << "' doesn't seem to be a regular file name" << LL_ENDL;
+ crash_reason = "The filename '" + strings_path_full + "' doesn't seem to be a regular file name";
}
}
// initial check to make sure files are there failed
gDirUtilp->dumpCurrentDirectories(LLError::LEVEL_WARN);
LLError::LLUserWarningMsg::showMissingFiles();
- LL_ERRS() << "Viewer failed to find localization and UI files."
- << " Please reinstall viewer from https://secondlife.com/support/downloads"
- << " and contact https://support.secondlife.com if issue persists after reinstall." << LL_ENDL;
+ LL_ERRS() << "Viewer failed to open some of localization and UI files."
+ << " " << crash_reason << "." << LL_ENDL;
}
LLTransUtil::parseStrings(strings_file, default_trans_args);
LLTransUtil::parseLanguageStrings("language_settings.xml");
@@ -3375,7 +3420,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["VOICE_VERSION"] = LLTrans::getString("NotConnected");
}
-#if !LL_LINUX
+#if LL_DARWIN || LL_LINUX || __FreeBSD__
std::ostringstream cef_ver_codec;
cef_ver_codec << "Dullahan: ";
cef_ver_codec << DULLAHAN_VERSION_MAJOR;
@@ -3405,7 +3450,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["LIBCEF_VERSION"] = "Undefined";
#endif
-#if !LL_LINUX
+//#if !LL_LINUX
std::ostringstream vlc_ver_codec;
vlc_ver_codec << LIBVLC_VERSION_MAJOR;
vlc_ver_codec << ".";
@@ -3413,9 +3458,11 @@ LLSD LLAppViewer::getViewerInfo() const
vlc_ver_codec << ".";
vlc_ver_codec << LIBVLC_VERSION_REVISION;
info["LIBVLC_VERSION"] = vlc_ver_codec.str();
+/*
#else
info["LIBVLC_VERSION"] = "Undefined";
#endif
+*/
S32 packets_in = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN);
if (packets_in > 0)
@@ -5440,7 +5487,7 @@ void LLAppViewer::forceErrorBreakpoint()
LL_WARNS() << "Forcing a deliberate breakpoint" << LL_ENDL;
#ifdef LL_WINDOWS
DebugBreak();
-#else
+#elif __i386__ || __x86_64__
asm ("int $3");
#endif
return;
@@ -5693,4 +5740,3 @@ void LLAppViewer::metricsSend(bool enable_reporting)
// resolution in time.
gViewerAssetStats->restart();
}
-