mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Support about:checkerboard reporting in the GPU process. (bug 1301266 part 2, r=kats)
This commit is contained in:
parent
4c2e28b8b6
commit
14db343852
@ -7,6 +7,7 @@
|
||||
#include "gfxConfig.h"
|
||||
#include "gfxPrefs.h"
|
||||
#include "GPUProcessHost.h"
|
||||
#include "mozilla/dom/CheckerboardReportService.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#if defined(XP_WIN)
|
||||
# include "mozilla/gfx/DeviceManagerDx.h"
|
||||
@ -93,6 +94,13 @@ GPUChild::RecvInitComplete(const GPUDeviceData& aData)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
GPUChild::RecvReportCheckerboard(const uint32_t& aSeverity, const nsCString& aLog)
|
||||
{
|
||||
layers::CheckerboardEventStorage::Report(aSeverity, std::string(aLog.get()));
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
GPUChild::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
|
||||
// PGPUChild overrides.
|
||||
bool RecvInitComplete(const GPUDeviceData& aData) override;
|
||||
bool RecvReportCheckerboard(const uint32_t& aSeverity, const nsCString& aLog) override;
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
static void Destroy(UniquePtr<GPUChild>&& aChild);
|
||||
|
@ -41,12 +41,22 @@ namespace gfx {
|
||||
using namespace ipc;
|
||||
using namespace layers;
|
||||
|
||||
static GPUParent* sGPUParent;
|
||||
|
||||
GPUParent::GPUParent()
|
||||
{
|
||||
sGPUParent = this;
|
||||
}
|
||||
|
||||
GPUParent::~GPUParent()
|
||||
{
|
||||
sGPUParent = nullptr;
|
||||
}
|
||||
|
||||
/* static */ GPUParent*
|
||||
GPUParent::GetSingleton()
|
||||
{
|
||||
return sGPUParent;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -20,6 +20,8 @@ public:
|
||||
GPUParent();
|
||||
~GPUParent();
|
||||
|
||||
static GPUParent* GetSingleton();
|
||||
|
||||
bool Init(base::ProcessId aParentPid,
|
||||
MessageLoop* aIOLoop,
|
||||
IPC::Channel* aChannel);
|
||||
|
@ -72,6 +72,9 @@ child:
|
||||
// Sent when the GPU process has initialized devices. This occurs once, after
|
||||
// Init().
|
||||
async InitComplete(GPUDeviceData data);
|
||||
|
||||
// Sent when APZ detects checkerboarding and apz checkerboard reporting is enabled.
|
||||
async ReportCheckerboard(uint32_t severity, nsCString log);
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
|
@ -3200,10 +3200,7 @@ AsyncPanZoomController::ReportCheckerboard(const TimeStamp& aSampleTime)
|
||||
// checkerboard events.
|
||||
uint32_t severity = mCheckerboardEvent->GetSeverity();
|
||||
std::string log = mCheckerboardEvent->GetLog();
|
||||
NS_DispatchToMainThread(NS_NewRunnableFunction([severity, log]() {
|
||||
RefPtr<CheckerboardEventStorage> storage = CheckerboardEventStorage::GetInstance();
|
||||
storage->ReportCheckerboard(severity, log);
|
||||
}));
|
||||
CheckerboardEventStorage::Report(severity, log);
|
||||
}
|
||||
mCheckerboardEvent = nullptr;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT
|
||||
#include "mozilla/ClearOnShutdown.h" // for ClearOnShutdown
|
||||
#include "mozilla/dom/CheckerboardReportServiceBinding.h" // for dom::CheckerboardReports
|
||||
#include "mozilla/gfx/GPUParent.h"
|
||||
#include "nsContentUtils.h" // for nsContentUtils
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
@ -35,6 +36,29 @@ CheckerboardEventStorage::GetInstance()
|
||||
return instance.forget();
|
||||
}
|
||||
|
||||
void
|
||||
CheckerboardEventStorage::Report(uint32_t aSeverity, const std::string& aLog)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
RefPtr<Runnable> task = NS_NewRunnableFunction([aSeverity, aLog] () -> void {
|
||||
CheckerboardEventStorage::Report(aSeverity, aLog);
|
||||
});
|
||||
NS_DispatchToMainThread(task.forget());
|
||||
return;
|
||||
}
|
||||
|
||||
if (XRE_IsGPUProcess()) {
|
||||
if (gfx::GPUParent* gpu = gfx::GPUParent::GetSingleton()) {
|
||||
nsCString log(aLog.c_str());
|
||||
gpu->SendReportCheckerboard(aSeverity, log);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<CheckerboardEventStorage> storage = GetInstance();
|
||||
storage->ReportCheckerboard(aSeverity, aLog);
|
||||
}
|
||||
|
||||
void
|
||||
CheckerboardEventStorage::ReportCheckerboard(uint32_t aSeverity, const std::string& aLog)
|
||||
{
|
||||
|
@ -37,17 +37,17 @@ public:
|
||||
*/
|
||||
static already_AddRefed<CheckerboardEventStorage> GetInstance();
|
||||
|
||||
/**
|
||||
* Save a checkerboard event log, optionally dropping older ones that were
|
||||
* less severe or less recent. Zero-severity reports may be ignored entirely.
|
||||
*/
|
||||
void ReportCheckerboard(uint32_t aSeverity, const std::string& aLog);
|
||||
|
||||
/**
|
||||
* Get the stored checkerboard reports.
|
||||
*/
|
||||
void GetReports(nsTArray<dom::CheckerboardReport>& aOutReports);
|
||||
|
||||
/**
|
||||
* Save a checkerboard event log, optionally dropping older ones that were
|
||||
* less severe or less recent. Zero-severity reports may be ignored entirely.
|
||||
*/
|
||||
static void Report(uint32_t aSeverity, const std::string& aLog);
|
||||
|
||||
private:
|
||||
/* Stuff for refcounted singleton */
|
||||
CheckerboardEventStorage() {}
|
||||
@ -55,6 +55,8 @@ private:
|
||||
|
||||
static StaticRefPtr<CheckerboardEventStorage> sInstance;
|
||||
|
||||
void ReportCheckerboard(uint32_t aSeverity, const std::string& aLog);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Struct that this class uses internally to store a checkerboard report.
|
||||
|
Loading…
Reference in New Issue
Block a user