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.cpp51
1 files changed, 42 insertions, 9 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 23da0faa47..aa95681d32 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -137,10 +137,10 @@
#include "stringize.h"
#include "llcoros.h"
#include "llexception.h"
+#if LL_DARWIN || LL_LINUX || __FreeBSD__
#include "cef/dullahan_version.h"
-#if !LL_LINUX
+#endif
#include "vlc/libvlc_version.h"
-#endif // LL_LINUX
#if LL_DARWIN
#include "llwindowmacosx.h"
@@ -255,6 +255,7 @@ using namespace LL;
#include "llcoproceduremanager.h"
#include "llviewereventrecorder.h"
+#include <chrono>
#include "rlvactions.h"
#include "rlvcommon.h"
#include "rlvhandler.h"
@@ -314,6 +315,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
@@ -544,11 +547,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");
@@ -680,7 +685,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
@@ -914,7 +919,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";
@@ -995,6 +1000,7 @@ bool LLAppViewer::init()
return false;
}
+#if defined(__i386__) || defined(__x86_64__) || defined(__amd64__)
// Without SSE2 support we will crash almost immediately, warn here.
if (!gSysCPU.hasSSE2())
{
@@ -1006,6 +1012,7 @@ bool LLAppViewer::init()
// quit immediately
return false;
}
+#endif
// alert the user if they are using unsupported hardware
if (!gSavedSettings.getBOOL("AlertedUnsupportedHardware"))
@@ -1169,7 +1176,7 @@ bool LLAppViewer::init()
gGLActive = false;
-#if LL_RELEASE_FOR_DOWNLOAD && !LL_LINUX
+#if 0 // LL_RELEASE_FOR_DOWNLOAD && !LL_LINUX
// Skip updater if this is a non-interactive instance
if (!gSavedSettings.getBOOL("CmdLineSkipUpdater") && !gNonInteractive)
{
@@ -1485,6 +1492,13 @@ void sendGameControlInput()
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.
@@ -1655,6 +1669,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");
@@ -1667,6 +1693,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)
@@ -1857,7 +1888,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())
{
@@ -3544,7 +3575,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["LIBCEF_VERSION"] = cef_ver_codec.str();
-#if !LL_LINUX
+//#if !LL_LINUX
std::ostringstream vlc_ver_codec;
vlc_ver_codec << LIBVLC_VERSION_MAJOR;
vlc_ver_codec << ".";
@@ -3552,9 +3583,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 = (S32)LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN);
if (packets_in > 0)
@@ -5617,7 +5650,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;