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); 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() { void ContentParent::OnCompositorUnexpectedShutdown() {
GPUProcessManager* gpm = GPUProcessManager::Get(); GPUProcessManager* gpm = GPUProcessManager::Get();
@ -5914,6 +5927,19 @@ mozilla::ipc::IPCResult ContentParent::RecvShutdownPerfStats(
return IPC_OK(); 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( mozilla::ipc::IPCResult ContentParent::RecvGetFontListShmBlock(
const uint32_t& aGeneration, const uint32_t& aIndex, const uint32_t& aGeneration, const uint32_t& aIndex,
base::SharedMemoryHandle* aOut) { base::SharedMemoryHandle* aOut) {

View file

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

View file

@ -1139,6 +1139,9 @@ parent:
bool hasValidUserGestureActivation); bool hasValidUserGestureActivation);
async ExtProtocolChannelConnectParent(uint64_t registrarId); async ExtProtocolChannelConnectParent(uint64_t registrarId);
// PrefService message
sync GetGfxVars() returns (GfxVarUpdate[] vars);
sync SyncMessage(nsString aMessage, ClonedMessageData aData) sync SyncMessage(nsString aMessage, ClonedMessageData aData)
returns (StructuredCloneData[] retval); returns (StructuredCloneData[] retval);
@ -1330,6 +1333,21 @@ parent:
*/ */
async ShutdownPerfStats(nsCString aPerfStats); 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 * 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. * 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*>(); sVarList = new nsTArray<gfxVars::VarBase*>();
sInstance = new gfxVars; sInstance = new gfxVars;
// Content processes should have gotten a call to SetValuesForInitialize, // Note the GPU process is not handled here - it cannot send sync
// which will have set gGfxVarInitUpdates. // messages, so instead the initial data is pushed down.
MOZ_ASSERT_IF(XRE_IsContentProcess(), gGfxVarInitUpdates); if (XRE_IsContentProcess()) {
MOZ_ASSERT(gGfxVarInitUpdates,
if (gGfxVarInitUpdates) { "Initial updates should be provided in content process");
// Apply any updates from gGfxVarInitUpdates. 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) { for (const auto& varUpdate : *gGfxVarInitUpdates) {
ApplyUpdate(varUpdate); ApplyUpdate(varUpdate);
} }

View file

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

View file

@ -862,10 +862,10 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
void InitBackendPrefs(BackendPrefsData&& aPrefsData); void InitBackendPrefs(BackendPrefsData&& aPrefsData);
/** /**
* Content-process only. Updates device preferences from the parent process, * Content-process only. Requests device preferences from the parent process
* if we've received any. * and updates any cached settings.
*/ */
void ImportCachedContentDeviceData(); void FetchAndImportContentDeviceData();
virtual void ImportContentDeviceData( virtual void ImportContentDeviceData(
const mozilla::gfx::ContentDeviceData& aData); const mozilla::gfx::ContentDeviceData& aData);
@ -888,13 +888,6 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
*/ */
const mozilla::gfx::ContentDeviceData* GetInitContentDeviceData(); 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. * Increase the global device counter after a device has been removed/reset.
*/ */

View file

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

View file

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

View file

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

View file

@ -56,6 +56,8 @@ description = JS MessageManager implementation
description = legacy sync IPC - please add detailed description description = legacy sync IPC - please add detailed description
[PContent::PURLClassifier] [PContent::PURLClassifier]
description = legacy sync IPC - please add detailed description description = legacy sync IPC - please add detailed description
[PContent::GetGfxVars]
description = legacy sync IPC - please add detailed description
[PContent::GetClipboard] [PContent::GetClipboard]
description = Legacy synchronous clipboard API description = Legacy synchronous clipboard API
[PContent::ClipboardHasType] [PContent::ClipboardHasType]
@ -68,6 +70,10 @@ description = legacy sync IPC - please add detailed description
description = legacy sync IPC - please add detailed description description = legacy sync IPC - please add detailed description
[PContent::EndDriverCrashGuard] [PContent::EndDriverCrashGuard]
description = legacy sync IPC - please add detailed description 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] [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 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] [PContent::InitializeFamily]