mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 3 changesets (bug 980027) for causing a serious race in hal with the pref service
Backed out changeset 5cd05df56f67 (bug 980027) Backed out changeset 6344d6606517 (bug 980027) Backed out changeset 098a43b537e9 (bug 980027)
This commit is contained in:
parent
7235f549a1
commit
a5a3ec121e
@ -676,19 +676,6 @@ pref("hal.processPriorityManager.gonk.BACKGROUND.Nice", 18);
|
||||
// Processes get this niceness when they have low CPU priority.
|
||||
pref("hal.processPriorityManager.gonk.LowCPUNice", 18);
|
||||
|
||||
// By default the compositor thread on gonk runs without real-time priority. RT
|
||||
// priority can be enabled by setting this pref to a value between 1 and 99.
|
||||
// Note that audio processing currently runs at RT priority 2 or 3 at most.
|
||||
//
|
||||
// If RT priority is disabled, then the compositor nice value is used. The
|
||||
// code will default to ANDROID_PRIORITY_URGENT_DISPLAY which is -8. Per gfx
|
||||
// request we are keeping the compositor at nice level 0 until we can complete
|
||||
// the investigation in bug 982972.
|
||||
//
|
||||
// Do not change these values without gfx team review.
|
||||
pref("hal.gonk.compositor.rt_priority", 0);
|
||||
pref("hal.gonk.compositor.nice", 0);
|
||||
|
||||
// Fire a memory pressure event when the system has less than Xmb of memory
|
||||
// remaining. You should probably set this just above Y.KillUnderKB for
|
||||
// the highest priority class Y that you want to make an effort to keep alive.
|
||||
|
@ -51,8 +51,6 @@
|
||||
#endif
|
||||
#include "GeckoProfiler.h"
|
||||
#include "mozilla/ipc/ProtocolTypes.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/HalTypes.h"
|
||||
|
||||
using namespace base;
|
||||
using namespace mozilla;
|
||||
@ -111,11 +109,6 @@ static void ReleaseCompositorThread()
|
||||
}
|
||||
}
|
||||
|
||||
static void SetThreadPriority()
|
||||
{
|
||||
hal::SetCurrentThreadPriority(hal::THREAD_PRIORITY_COMPOSITOR);
|
||||
}
|
||||
|
||||
void
|
||||
CompositorParent::StartUpWithExistingThread(MessageLoop* aMsgLoop,
|
||||
PlatformThreadId aThreadID)
|
||||
@ -169,7 +162,6 @@ bool CompositorParent::CreateThread()
|
||||
sCompositorThread = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -208,8 +200,6 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
|
||||
CompositorLoop()->PostTask(FROM_HERE, NewRunnableFunction(&AddCompositor,
|
||||
this, &mCompositorID));
|
||||
|
||||
CompositorLoop()->PostTask(FROM_HERE, NewRunnableFunction(SetThreadPriority));
|
||||
|
||||
mRootLayerTreeID = AllocateLayerTreeId();
|
||||
sIndirectLayerTrees[mRootLayerTreeID].mParent = this;
|
||||
|
||||
|
18
hal/Hal.cpp
18
hal/Hal.cpp
@ -871,12 +871,6 @@ SetProcessPriority(int aPid,
|
||||
aBackgroundLRU));
|
||||
}
|
||||
|
||||
void
|
||||
SetCurrentThreadPriority(ThreadPriority aPriority)
|
||||
{
|
||||
PROXY_IF_SANDBOXED(SetCurrentThreadPriority(aPriority));
|
||||
}
|
||||
|
||||
// From HalTypes.h.
|
||||
const char*
|
||||
ProcessPriorityToString(ProcessPriority aPriority)
|
||||
@ -904,18 +898,6 @@ ProcessPriorityToString(ProcessPriority aPriority)
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
ThreadPriorityToString(ThreadPriority aPriority)
|
||||
{
|
||||
switch (aPriority) {
|
||||
case THREAD_PRIORITY_COMPOSITOR:
|
||||
return "COMPOSITOR";
|
||||
default:
|
||||
MOZ_ASSERT(false);
|
||||
return "???";
|
||||
}
|
||||
}
|
||||
|
||||
// From HalTypes.h.
|
||||
const char*
|
||||
ProcessPriorityToString(ProcessPriority aPriority,
|
||||
|
@ -496,13 +496,6 @@ void SetProcessPriority(int aPid,
|
||||
hal::ProcessCPUPriority aCPUPriority,
|
||||
uint32_t aLRU = 0);
|
||||
|
||||
/**
|
||||
* Set the current thread's priority to appropriate platform-specific value for
|
||||
* given functionality. Instead of providing arbitrary priority numbers you
|
||||
* must specify a type of function like THREAD_PRIORITY_COMPOSITOR.
|
||||
*/
|
||||
void SetCurrentThreadPriority(hal::ThreadPriority aPriority);
|
||||
|
||||
/**
|
||||
* Register an observer for the FM radio.
|
||||
*/
|
||||
|
@ -99,16 +99,6 @@ enum ProcessCPUPriority {
|
||||
NUM_PROCESS_CPU_PRIORITY
|
||||
};
|
||||
|
||||
// Values that can be passed to hal::SetThreadPriority(). These should be
|
||||
// functional in nature, such as COMPOSITOR, instead of levels, like LOW/HIGH.
|
||||
// This allows us to tune our priority scheme for the system in one place such
|
||||
// that it makes sense holistically for the overall operating system. On gonk
|
||||
// or android we may want different priority schemes than on windows, etc.
|
||||
enum ThreadPriority {
|
||||
THREAD_PRIORITY_COMPOSITOR,
|
||||
NUM_THREAD_PRIORITY
|
||||
};
|
||||
|
||||
// Convert a ProcessPriority enum value (with an optional ProcessCPUPriority)
|
||||
// to a string. The strings returned by this function are statically
|
||||
// allocated; do not attempt to free one!
|
||||
@ -122,14 +112,6 @@ const char*
|
||||
ProcessPriorityToString(ProcessPriority aPriority,
|
||||
ProcessCPUPriority aCPUPriority);
|
||||
|
||||
// Convert a ThreadPriority enum value to a string. The strings returned by
|
||||
// this function are statically allocated; do not attempt to free one!
|
||||
//
|
||||
// If you pass an unknown process priority (or NUM_THREAD_PRIORITY), we
|
||||
// fatally assert in debug builds and otherwise return "???".
|
||||
const char *
|
||||
ThreadPriorityToString(ThreadPriority aPriority);
|
||||
|
||||
/**
|
||||
* Used by ModifyWakeLock
|
||||
*/
|
||||
|
@ -1,20 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "Hal.h"
|
||||
|
||||
using namespace mozilla::hal;
|
||||
|
||||
namespace mozilla {
|
||||
namespace hal_impl {
|
||||
|
||||
void
|
||||
SetCurrentThreadPriority(ThreadPriority aPriority)
|
||||
{
|
||||
HAL_LOG(("FallbackThreadPriority - SetCurrentThreadPriority(%d)\n",
|
||||
ThreadPriorityToString(aPriority)));
|
||||
}
|
||||
|
||||
} // hal_impl
|
||||
} // namespace mozilla
|
@ -27,7 +27,6 @@
|
||||
#include <sys/resource.h>
|
||||
#include <time.h>
|
||||
#include <asm/page.h>
|
||||
#include <sched.h>
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
|
||||
@ -39,7 +38,6 @@
|
||||
#include "hardware_legacy/vibrator.h"
|
||||
#include "hardware_legacy/power.h"
|
||||
#include "libdisplay/GonkDisplay.h"
|
||||
#include "utils/threads.h"
|
||||
|
||||
#include "base/message_loop.h"
|
||||
|
||||
@ -1356,14 +1354,6 @@ SetNiceForPid(int aPid, int aNice)
|
||||
|
||||
int tid = static_cast<int>(tidlong);
|
||||
|
||||
// Do not set the priority of threads running with a real-time policy
|
||||
// as part of the bulk process adjustment. These threads need to run
|
||||
// at their specified priority in order to meet timing guarantees.
|
||||
int schedPolicy = sched_getscheduler(tid);
|
||||
if (schedPolicy == SCHED_FIFO || schedPolicy == SCHED_RR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
// Get and set the task's new priority.
|
||||
int origtaskpriority = getpriority(PRIO_PROCESS, tid);
|
||||
@ -1376,15 +1366,6 @@ SetNiceForPid(int aPid, int aNice)
|
||||
|
||||
int newtaskpriority =
|
||||
std::max(origtaskpriority - origProcPriority + aNice, aNice);
|
||||
|
||||
// Do not reduce priority of threads already running at priorities greater
|
||||
// than normal. These threads are likely special service threads that need
|
||||
// elevated priorities to process audio, display composition, etc.
|
||||
if (newtaskpriority > origtaskpriority &&
|
||||
origtaskpriority < ANDROID_PRIORITY_NORMAL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
rv = setpriority(PRIO_PROCESS, tid, newtaskpriority);
|
||||
|
||||
if (rv) {
|
||||
@ -1479,54 +1460,6 @@ SetProcessPriority(int aPid,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SetCurrentThreadPriority(ThreadPriority aPriority)
|
||||
{
|
||||
int policy = SCHED_OTHER;
|
||||
int priorityOrNice = ANDROID_PRIORITY_NORMAL;
|
||||
|
||||
switch(aPriority) {
|
||||
case THREAD_PRIORITY_COMPOSITOR:
|
||||
priorityOrNice = Preferences::GetInt("hal.gonk.compositor.rt_priority", 0);
|
||||
if (priorityOrNice >= sched_get_priority_min(SCHED_FIFO) &&
|
||||
priorityOrNice <= sched_get_priority_max(SCHED_FIFO)) {
|
||||
policy = SCHED_FIFO;
|
||||
} else {
|
||||
priorityOrNice = Preferences::GetInt("hal.gonk.compositor.nice",
|
||||
ANDROID_PRIORITY_URGENT_DISPLAY);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LOG("Unrecognized thread priority %d; Doing nothing", aPriority);
|
||||
return;
|
||||
}
|
||||
|
||||
int tid = gettid();
|
||||
int rv = 0;
|
||||
|
||||
// If a RT scheduler policy is used, then we must set the priority using
|
||||
// sched_setscheduler() and the sched_param.sched_priority value.
|
||||
if (policy == SCHED_FIFO || policy == SCHED_RR) {
|
||||
LOG("Setting thread %d to priority level %s; RT priority %d",
|
||||
tid, ThreadPriorityToString(aPriority), priorityOrNice);
|
||||
sched_param schedParam;
|
||||
schedParam.sched_priority = priorityOrNice;
|
||||
rv = sched_setscheduler(tid, policy, &schedParam);
|
||||
|
||||
// Otherwise priority is solely defined by the nice level, so use the
|
||||
// setpriority() function.
|
||||
} else {
|
||||
LOG("Setting thread %d to priority level %s; nice level %d",
|
||||
tid, ThreadPriorityToString(aPriority), priorityOrNice);
|
||||
rv = setpriority(PRIO_PROCESS, tid, priorityOrNice);
|
||||
}
|
||||
|
||||
if (rv) {
|
||||
LOG("Failed to set thread %d to priority level %s; error code %d",
|
||||
tid, ThreadPriorityToString(aPriority), rv);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FactoryReset()
|
||||
{
|
||||
|
@ -151,7 +151,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
|
||||
'fallback/FallbackProcessPriority.cpp',
|
||||
'fallback/FallbackScreenPower.cpp',
|
||||
'fallback/FallbackSwitch.cpp',
|
||||
'fallback/FallbackThreadPriority.cpp',
|
||||
'fallback/FallbackTime.cpp',
|
||||
'fallback/FallbackWakeLocks.cpp',
|
||||
]
|
||||
|
@ -362,12 +362,6 @@ SetProcessPriority(int aPid,
|
||||
NS_RUNTIMEABORT("Only the main process may set processes' priorities.");
|
||||
}
|
||||
|
||||
void
|
||||
SetCurrentThreadPriority(ThreadPriority aPriority)
|
||||
{
|
||||
NS_RUNTIMEABORT("Only the main process may set thread priorities.");
|
||||
}
|
||||
|
||||
void
|
||||
EnableFMRadio(const hal::FMRadioSettings& aSettings)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user