From ae2e40d5d7c6620b1f3c2418201a60ac05542a5a Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 18 Nov 2016 17:54:35 +0100 Subject: [PATCH 1/6] Merge "MAINT-6818 Fix for LLImageBase::allocateData crash" with our fix --- indra/llimage/llimage.cpp | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 219462faab..3025bdaf6e 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -721,19 +721,21 @@ void LLImageBase::deleteData() // virtual U8* LLImageBase::allocateData(S32 size) { + //make this function thread-safe. + static const U32 MAX_BUFFER_SIZE = 4096 * 4096 * 16; //256 MB + mBadBufferAllocation = false; + if (size < 0) { size = mWidth * mHeight * mComponents; if (size <= 0) { LL_WARNS() << llformat("LLImageBase::allocateData called with bad dimensions: %dx%dx%d",mWidth,mHeight,(S32)mComponents) << LL_ENDL; - return NULL; + mBadBufferAllocation = true; } - } - - //make this function thread-safe. - static const U32 MAX_BUFFER_SIZE = 4096 * 4096 * 16 ; //256 MB - if (size < 1 || size > MAX_BUFFER_SIZE) + } + + if (!mBadBufferAllocation && (size < 1 || size > MAX_BUFFER_SIZE)) { LL_INFOS() << "width: " << mWidth << " height: " << mHeight << " components: " << mComponents << LL_ENDL ; if(mAllowOverSize) @@ -743,26 +745,31 @@ U8* LLImageBase::allocateData(S32 size) else { LL_WARNS() << "LLImageBase::allocateData: bad size: " << size << LL_ENDL; - return NULL; + mBadBufferAllocation = true; } } - if (!mData || size != mDataSize) + + if (!mBadBufferAllocation && (!mData || size != mDataSize)) { deleteData(); // virtual - mBadBufferAllocation = false ; mData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); if (!mData) { - LL_WARNS() << "Failed to allocate image data, size: " << size << " width: " << mWidth << " height: " << mHeight << LL_ENDL; - size = 0 ; - mWidth = mHeight = 0 ; - mBadBufferAllocation = true ; - addAllocationError(); + LL_WARNS() << "Failed to allocate image data size [" << size << "]" << LL_ENDL; + mBadBufferAllocation = true; } - mDataSize = size; - claimMem(mDataSize); } + if (mBadBufferAllocation) + { + size = 0; + mWidth = mHeight = 0; + mData = NULL; + addAllocationError(); + } + mDataSize = size; + claimMem(mDataSize); + return mData; } From a3acf2b33950d7755f999e297ec707ab45a09a3d Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 19 Nov 2016 10:04:03 +0100 Subject: [PATCH 2/6] FIRE-20377: LLLineEditor not disabled properly --- indra/llui/lllineeditor.cpp | 9 +++++++++ indra/llui/lllineeditor.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 559be2503f..ab126c8501 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -240,6 +240,15 @@ LLLineEditor::~LLLineEditor() gFocusMgr.releaseFocusIfNeeded( this ); } +// Enabling LLLineEditor via XUI breaks enabled-state +void LLLineEditor::initFromParams(const LLLineEditor::Params& params) +{ + LLUICtrl::initFromParams(params); + LLUICtrl::setEnabled(TRUE); + setEnabled(params.enabled); +} +// + void LLLineEditor::onFocusReceived() { gEditMenuHandler = this; diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 8f6c2d30b4..0e623b23fd 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -108,6 +108,10 @@ public: Params(); }; + + // Enabling LLLineEditor via XUI breaks enabled-state + void initFromParams(const LLLineEditor::Params& params); + protected: LLLineEditor(const Params&); friend class LLUICtrlFactory; From a8a3ec7bbc3ddb1092dfa5cba87fa8323823d20a Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 19 Nov 2016 10:42:21 +0100 Subject: [PATCH 3/6] FIRE-20378 / FIRE-20382: Breaks memory detection an 4K monitor workaround; No idea why this was added here to fix DPI override - only thing done here is querying data, not setting anything --- indra/newview/llappviewerwin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 0a20e796c5..2817076b9c 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -642,7 +642,7 @@ bool LLAppViewerWin32::initHardwareTest() // Do driver verification and initialization based on DirectX // hardware polling and driver versions // - if (TRUE == gSavedSettings.getBOOL("ProbeHardwareOnStartup") && FALSE == gSavedSettings.getBOOL("NoHardwareProbe")) + if (/*TRUE == gSavedSettings.getBOOL("ProbeHardwareOnStartup") &&*/ FALSE == gSavedSettings.getBOOL("NoHardwareProbe")) // FIRE-20378 / FIRE-20382: Breaks memory detection an 4K monitor workaround { // per DEV-11631 - disable hardware probing for everything // but vram. From 0aafb257de4cc99aa207529de0315ea9db8928c0 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 19 Nov 2016 10:42:29 +0100 Subject: [PATCH 4/6] Fix support URL --- indra/newview/llappviewerwin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 2817076b9c..cf47b3b0f0 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -673,7 +673,7 @@ bool LLAppViewerWin32::initHardwareTest() if (OSBTN_NO== button) { LL_INFOS("AppInit") << "User quitting after failed DirectX 9 detection" << LL_ENDL; - LLWeb::loadURLExternal("http://secondlife.com/support/", false); + LLWeb::loadURLExternal("http://www.firestormviewer.org/support", false); return false; } gWarningSettings.setBOOL("AboutDirectX9", FALSE); From 8aee17b8d1e30f2bddf1c17e212f1fab3953428a Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 19 Nov 2016 12:05:21 +0100 Subject: [PATCH 5/6] Set DPI-awareness via manifest again --- indra/newview/llappviewerwin32.cpp | 3 ++- indra/tools/manifests/compatibility.manifest | 5 +++++ indra/tools/manifests/legacy.manifest | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index cf47b3b0f0..f17628980b 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -304,7 +304,8 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, DWORD heap_enable_lfh_error[MAX_HEAPS]; S32 num_heaps = 0; - LLWindowWin32::setDPIAwareness(); + // Set via manifest + //LLWindowWin32::setDPIAwareness(); #if WINDOWS_CRT_MEM_CHECKS && !INCLUDE_VLD _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // dump memory leaks on exit diff --git a/indra/tools/manifests/compatibility.manifest b/indra/tools/manifests/compatibility.manifest index 31106cc4d5..6e80aff779 100644 --- a/indra/tools/manifests/compatibility.manifest +++ b/indra/tools/manifests/compatibility.manifest @@ -23,4 +23,9 @@ + + + true/PM + + diff --git a/indra/tools/manifests/legacy.manifest b/indra/tools/manifests/legacy.manifest index 2ec1cfcee6..899438c020 100644 --- a/indra/tools/manifests/legacy.manifest +++ b/indra/tools/manifests/legacy.manifest @@ -9,4 +9,9 @@ + + + true/PM + + From 12f0dd7c60ef0f5baa6af2a2b5dc06fc2eab576c Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 19 Nov 2016 12:05:40 +0100 Subject: [PATCH 6/6] Fix DPI scaling calculation --- indra/llwindow/llwindowwin32.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 8ef742262a..f55be68520 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -2644,7 +2644,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ case WM_DPICHANGED: { LPRECT lprc_new_scale; - F32 new_scale = LOWORD(w_param) / USER_DEFAULT_SCREEN_DPI; + // Fix DPI scaling + //F32 new_scale = LOWORD(w_param) / USER_DEFAULT_SCREEN_DPI; + F32 new_scale = F32(LOWORD(w_param)) / F32(USER_DEFAULT_SCREEN_DPI); + // lprc_new_scale = (LPRECT)l_param; S32 new_width = lprc_new_scale->right - lprc_new_scale->left; S32 new_height = lprc_new_scale->bottom - lprc_new_scale->top; @@ -4060,7 +4063,10 @@ F32 LLWindowWin32::getSystemUISize() hr = pGDFM(hMonitor, MDT_EFFECTIVE_DPI, &dpix, &dpiy); if (hr == S_OK) { - scale_value = dpix / USER_DEFAULT_SCREEN_DPI; + // Fix DPI scaling + //scale_value = dpix / USER_DEFAULT_SCREEN_DPI; + scale_value = F32(dpix) / F32(USER_DEFAULT_SCREEN_DPI); + // } else { @@ -4079,7 +4085,10 @@ F32 LLWindowWin32::getSystemUISize() else { LL_WARNS() << "Could not load shcore.dll library (included by from Win 8.1 SDK). Using legacy DPI awareness API of Win XP/7" << LL_ENDL; - scale_value = GetDeviceCaps(hdc, LOGPIXELSX) / USER_DEFAULT_SCREEN_DPI; + // Fix DPI scaling + //scale_value = GetDeviceCaps(hdc, LOGPIXELSX) / USER_DEFAULT_SCREEN_DPI; + scale_value = F32(GetDeviceCaps(hdc, LOGPIXELSX)) / F32(USER_DEFAULT_SCREEN_DPI); + // } ReleaseDC(hWnd, hdc);