Backed out 3 changesets (bug 1859625) for causing reftest assertion failures on gfxFeature.cpp. CLOSED TREE

Backed out changeset ea804fe0a160 (bug 1859625)
Backed out changeset 7ba7a8156187 (bug 1859625)
Backed out changeset ab1801c9add6 (bug 1859625)
This commit is contained in:
Cosmin Sabou 2023-11-21 19:38:28 +02:00
parent e4b4f23ffb
commit 36dc5703c6
10 changed files with 117 additions and 67 deletions

View file

@ -3380,6 +3380,19 @@ int32_t ContentParent::Pid() const {
return ReleaseAssertedCast<int32_t>(pid);
}
mozilla::ipc::IPCResult ContentParent::RecvGetGfxVars(
nsTArray<GfxVarUpdate>* aVars) {
// Ensure gfxVars is initialized (for xpcshell tests).
gfxVars::Initialize();
*aVars = gfxVars::FetchNonDefaultVars();
// Now that content has initialized gfxVars, we can start listening for
// updates.
gfxVars::AddReceiver(this);
return IPC_OK();
}
void ContentParent::OnCompositorUnexpectedShutdown() {
GPUProcessManager* gpm = GPUProcessManager::Get();
@ -5914,6 +5927,19 @@ mozilla::ipc::IPCResult ContentParent::RecvShutdownPerfStats(
return IPC_OK();
}
mozilla::ipc::IPCResult ContentParent::RecvGetGraphicsDeviceInitData(
ContentDeviceData* aOut) {
gfxPlatform::GetPlatform()->BuildContentDeviceData(aOut);
return IPC_OK();
}
mozilla::ipc::IPCResult ContentParent::RecvGetOutputColorProfileData(
nsTArray<uint8_t>* aOutputColorProfileData) {
(*aOutputColorProfileData) =
gfxPlatform::GetPlatform()->GetPlatformCMSOutputProfileData();
return IPC_OK();
}
mozilla::ipc::IPCResult ContentParent::RecvGetFontListShmBlock(
const uint32_t& aGeneration, const uint32_t& aIndex,
base::SharedMemoryHandle* aOut) {

View file

@ -972,6 +972,8 @@ class ContentParent final : public PContentParent,
bool DeallocPWebBrowserPersistDocumentParent(
PWebBrowserPersistDocumentParent* aActor);
mozilla::ipc::IPCResult RecvGetGfxVars(nsTArray<GfxVarUpdate>* aVars);
mozilla::ipc::IPCResult RecvSetClipboard(const IPCTransferable& aTransferable,
const int32_t& aWhichClipboard);
@ -1133,6 +1135,12 @@ class ContentParent final : public PContentParent,
mozilla::ipc::IPCResult RecvShutdownPerfStats(const nsACString& aPerfStats);
mozilla::ipc::IPCResult RecvGetGraphicsDeviceInitData(
ContentDeviceData* aOut);
mozilla::ipc::IPCResult RecvGetOutputColorProfileData(
nsTArray<uint8_t>* aOutputColorProfileData);
mozilla::ipc::IPCResult RecvGetFontListShmBlock(
const uint32_t& aGeneration, const uint32_t& aIndex,
base::SharedMemoryHandle* aOut);

View file

@ -1139,6 +1139,9 @@ parent:
bool hasValidUserGestureActivation);
async ExtProtocolChannelConnectParent(uint64_t registrarId);
// PrefService message
sync GetGfxVars() returns (GfxVarUpdate[] vars);
sync SyncMessage(nsString aMessage, ClonedMessageData aData)
returns (StructuredCloneData[] retval);
@ -1330,6 +1333,21 @@ parent:
*/
async ShutdownPerfStats(nsCString aPerfStats);
/**
* Request graphics initialization information from the parent.
*/
sync GetGraphicsDeviceInitData()
returns (ContentDeviceData aData);
/**
* Request a buffer containing the contents of the output color profile.
* If set, this is the file pointed to by
* gfx.color_management.display_profile, otherwise it contains a
* platform-specific default
*/
sync GetOutputColorProfileData()
returns (uint8_t[] aOutputColorProfileData);
/**
* A shared font list (see gfx/thebes/SharedFontList.*) contains a list
* of shared-memory blocks that are used to store all the font list data.

View file

@ -47,12 +47,17 @@ void gfxVars::Initialize() {
sVarList = new nsTArray<gfxVars::VarBase*>();
sInstance = new gfxVars;
// Content processes should have gotten a call to SetValuesForInitialize,
// which will have set gGfxVarInitUpdates.
MOZ_ASSERT_IF(XRE_IsContentProcess(), gGfxVarInitUpdates);
if (gGfxVarInitUpdates) {
// Apply any updates from gGfxVarInitUpdates.
// Note the GPU process is not handled here - it cannot send sync
// messages, so instead the initial data is pushed down.
if (XRE_IsContentProcess()) {
MOZ_ASSERT(gGfxVarInitUpdates,
"Initial updates should be provided in content process");
if (!gGfxVarInitUpdates) {
// No provided initial updates, sync-request them from parent.
nsTArray<GfxVarUpdate> initUpdates;
dom::ContentChild::GetSingleton()->SendGetGfxVars(&initUpdates);
gGfxVarInitUpdates = new nsTArray<GfxVarUpdate>(std::move(initUpdates));
}
for (const auto& varUpdate : *gGfxVarInitUpdates) {
ApplyUpdate(varUpdate);
}

View file

@ -174,7 +174,6 @@ gfxPlatform* gPlatform = nullptr;
static bool gEverInitialized = false;
const ContentDeviceData* gContentDeviceInitData = nullptr;
Maybe<nsTArray<uint8_t>> gCMSOutputProfileData;
Atomic<bool, MemoryOrdering::ReleaseAcquire> gfxPlatform::gCMSInitialized;
CMSMode gfxPlatform::gCMSMode = CMSMode::Off;
@ -468,10 +467,10 @@ bool gfxPlatform::Initialized() { return !!gPlatform; }
/* static */
void gfxPlatform::InitChild(const ContentDeviceData& aData) {
MOZ_ASSERT(XRE_IsContentProcess());
MOZ_ASSERT(!gPlatform,
MOZ_RELEASE_ASSERT(!gPlatform,
"InitChild() should be called before first GetPlatform()");
// Make the provided initial ContentDeviceData available to the init
// routines.
// routines, so they don't have to do a sync request from the parent.
gContentDeviceInitData = &aData;
Init();
gContentDeviceInitData = nullptr;
@ -2061,10 +2060,6 @@ const mozilla::gfx::ContentDeviceData* gfxPlatform::GetInitContentDeviceData() {
return gContentDeviceInitData;
}
Maybe<nsTArray<uint8_t>>& gfxPlatform::GetCMSOutputProfileData() {
return gCMSOutputProfileData;
}
CMSMode GfxColorManagementMode() {
const auto mode = StaticPrefs::gfx_color_management_mode();
if (mode >= 0 && mode < UnderlyingValue(CMSMode::AllCount)) {
@ -3874,16 +3869,20 @@ void gfxPlatform::DisableGPUProcess() {
gfxVars::SetRemoteCanvasEnabled(false);
}
void gfxPlatform::ImportCachedContentDeviceData() {
void gfxPlatform::FetchAndImportContentDeviceData() {
MOZ_ASSERT(XRE_IsContentProcess());
// Import the content device data if we've got some waiting.
if (!gContentDeviceInitData) {
if (gContentDeviceInitData) {
ImportContentDeviceData(*gContentDeviceInitData);
return;
}
ImportContentDeviceData(*gContentDeviceInitData);
gContentDeviceInitData = nullptr;
mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton();
mozilla::gfx::ContentDeviceData data;
cc->SendGetGraphicsDeviceInitData(&data);
ImportContentDeviceData(data);
}
void gfxPlatform::ImportContentDeviceData(
@ -3893,8 +3892,6 @@ void gfxPlatform::ImportContentDeviceData(
const DevicePrefs& prefs = aData.prefs();
gfxConfig::Inherit(Feature::HW_COMPOSITING, prefs.hwCompositing());
gfxConfig::Inherit(Feature::OPENGL_COMPOSITING, prefs.oglCompositing());
gCMSOutputProfileData = Some(aData.cmsOutputProfileData().Clone());
}
void gfxPlatform::BuildContentDeviceData(

View file

@ -862,10 +862,10 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
void InitBackendPrefs(BackendPrefsData&& aPrefsData);
/**
* Content-process only. Updates device preferences from the parent process,
* if we've received any.
* Content-process only. Requests device preferences from the parent process
* and updates any cached settings.
*/
void ImportCachedContentDeviceData();
void FetchAndImportContentDeviceData();
virtual void ImportContentDeviceData(
const mozilla::gfx::ContentDeviceData& aData);
@ -888,13 +888,6 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
*/
const mozilla::gfx::ContentDeviceData* GetInitContentDeviceData();
/**
* If inside a child process and have ever received a
* SetXPCOMProcessAttributes message, this contains the cmsOutputProfileData
* from that message.
*/
mozilla::Maybe<nsTArray<uint8_t>>& GetCMSOutputProfileData();
/**
* Increase the global device counter after a device has been removed/reset.
*/

View file

@ -144,14 +144,6 @@ gfxPlatformGtk::~gfxPlatformGtk() {
gPlatformFTLibrary = nullptr;
}
void gfxPlatformGtk::InitAcceleration() {
gfxPlatform::InitAcceleration();
if (XRE_IsContentProcess()) {
ImportCachedContentDeviceData();
}
}
void gfxPlatformGtk::InitX11EGLConfig() {
FeatureState& feature = gfxConfig::GetFeature(Feature::X11_EGL);
#ifdef MOZ_X11
@ -559,16 +551,23 @@ nsTArray<uint8_t> gfxPlatformGtk::GetPlatformCMSOutputProfileData() {
}
if (XRE_IsContentProcess()) {
auto& cmsOutputProfileData = GetCMSOutputProfileData();
// We should have set our profile data when we received our initial
// ContentDeviceData.
MOZ_ASSERT(cmsOutputProfileData.isSome(),
"Should have created output profile data when we received "
"initial content device data.");
if (cmsOutputProfileData.isSome()) {
return cmsOutputProfileData.ref().Clone();
MOZ_ASSERT(NS_IsMainThread());
// This will be passed in during InitChild so we can avoid sending a
// sync message back to the parent during init.
const mozilla::gfx::ContentDeviceData* contentDeviceData =
GetInitContentDeviceData();
if (contentDeviceData) {
// On Windows, we assert that the profile isn't empty, but on
// Linux it can legitimately be empty if the display isn't
// calibrated. Thus, no assertion here.
return contentDeviceData->cmsOutputProfileData().Clone();
}
return nsTArray<uint8_t>();
// Otherwise we need to ask the parent for the updated color profile
mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton();
nsTArray<uint8_t> result;
Unused << cc->SendGetOutputColorProfileData(&result);
return result;
}
if (!mIsX11Display) {

View file

@ -65,7 +65,6 @@ class gfxPlatformGtk final : public gfxPlatform {
static bool CheckVariationFontSupport();
protected:
void InitAcceleration() override;
void InitX11EGLConfig();
void InitDmabufConfig();
bool InitVAAPIConfig(bool aForceEnabledByUser);

View file

@ -373,9 +373,6 @@ void gfxWindowsPlatform::InitAcceleration() {
DeviceManagerDx::Init();
// Content processes should have received content device data from parent.
MOZ_ASSERT_IF(XRE_IsContentProcess(), GetInitContentDeviceData());
InitializeConfig();
InitGPUProcessSupport();
// Ensure devices initialization. SharedSurfaceANGLE and
@ -986,21 +983,20 @@ void gfxWindowsPlatform::CheckForContentOnlyDeviceReset() {
nsTArray<uint8_t> gfxWindowsPlatform::GetPlatformCMSOutputProfileData() {
if (XRE_IsContentProcess()) {
auto& cmsOutputProfileData = GetCMSOutputProfileData();
// We should have set our profile data when we received our initial
// ContentDeviceData.
MOZ_ASSERT(cmsOutputProfileData.isSome(),
"Should have created output profile data when we received "
"initial content device data.");
// If we have data, it should not be empty.
MOZ_ASSERT_IF(cmsOutputProfileData.isSome(),
!cmsOutputProfileData->IsEmpty());
if (cmsOutputProfileData.isSome()) {
return cmsOutputProfileData.ref().Clone();
// This will be passed in during InitChild so we can avoid sending a
// sync message back to the parent during init.
const mozilla::gfx::ContentDeviceData* contentDeviceData =
GetInitContentDeviceData();
if (contentDeviceData) {
MOZ_ASSERT(!contentDeviceData->cmsOutputProfileData().IsEmpty());
return contentDeviceData->cmsOutputProfileData().Clone();
}
return nsTArray<uint8_t>();
// Otherwise we need to ask the parent for the updated color profile
mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton();
nsTArray<uint8_t> result;
Unused << cc->SendGetOutputColorProfileData(&result);
return result;
}
return GetPlatformCMSOutputProfileData_Impl();
@ -1202,7 +1198,7 @@ void gfxWindowsPlatform::InitializeConfig() {
InitializeANGLEConfig();
InitializeD2DConfig();
} else {
ImportCachedContentDeviceData();
FetchAndImportContentDeviceData();
InitializeANGLEConfig();
}
}
@ -1785,6 +1781,9 @@ void gfxWindowsPlatform::ImportContentDeviceData(
DeviceManagerDx* dm = DeviceManagerDx::Get();
dm->ImportDeviceInfo(aData.d3d11());
}
// aData->cmsOutputProfileData() will be read during color profile init,
// not as part of this import function
}
void gfxWindowsPlatform::BuildContentDeviceData(ContentDeviceData* aOut) {

View file

@ -56,6 +56,8 @@ description = JS MessageManager implementation
description = legacy sync IPC - please add detailed description
[PContent::PURLClassifier]
description = legacy sync IPC - please add detailed description
[PContent::GetGfxVars]
description = legacy sync IPC - please add detailed description
[PContent::GetClipboard]
description = Legacy synchronous clipboard API
[PContent::ClipboardHasType]
@ -68,6 +70,10 @@ description = legacy sync IPC - please add detailed description
description = legacy sync IPC - please add detailed description
[PContent::EndDriverCrashGuard]
description = legacy sync IPC - please add detailed description
[PContent::GetGraphicsDeviceInitData]
description = Retrieve information needed to initialize the graphics device in the content process
[PContent::GetOutputColorProfileData]
description = Retrieve the contents of the output color profile file
[PContent::GetFontListShmBlock]
description = for bug 1514869 - layout code needs synchronous access to font list, but this is used only once per block, after which content directly reads the shared memory
[PContent::InitializeFamily]