Bug 681026 - always get data from glxtest process and waitpid() for it - r=joe

This patch makes GetShouldAccelerate directly call GetData, just before the place where we call GetFeatureStatus, which we know is reached.

Initially I considered instead calling GetData from GfxInfo::Init() but that turned out to be a bad idea: Init() is called by the factory constructor, which is called significantly earlier in the startup process. We want to call GetData as late as possible, just when we need it, to maximize chances that the glxtest process be already finished by the time we waitpid() it, so that we don't end up wasting time waiting for it.
This commit is contained in:
Benoit Jacob 2011-09-07 17:17:44 -04:00
Родитель dba8879427
Коммит 111896e345
4 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -143,5 +143,8 @@ interface nsIGfxInfo : nsISupports
* underlying GL impl that's used to implement WebGL.
*/
DOMString getWebGLParameter(in DOMString aParam);
// only useful on X11
[noscript, notxpcom] void GetData();
};

Просмотреть файл

@ -84,6 +84,9 @@ public:
// Ideally, Init() would be void-return, but the rules of
// NS_GENERIC_FACTORY_CONSTRUCTOR_INIT require it be nsresult return.
virtual nsresult Init();
// only useful on X11
NS_IMETHOD_(void) GetData() { }
protected:

Просмотреть файл

@ -76,6 +76,8 @@ public:
using GfxInfoBase::GetWebGLParameter;
virtual nsresult Init();
NS_IMETHOD_(void) GetData();
protected:
@ -91,7 +93,6 @@ private:
int mMajorVersion, mMinorVersion, mRevisionVersion;
void AddCrashReportAnnotations();
void GetData();
};
} // namespace widget

Просмотреть файл

@ -827,10 +827,14 @@ nsBaseWidget::GetShouldAccelerate()
bool whitelisted = false;
// bug 655578: on X11 at least, we must always call GetFeatureStatus (even if we don't need that information)
// as that's what causes GfxInfo initialization which kills the zombie 'glxtest' process.
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (gfxInfo) {
// bug 655578: on X11 at least, we must always call GetData (even if we don't need that information)
// as that's what causes GfxInfo initialization which kills the zombie 'glxtest' process.
// initially we relied on the fact that GetFeatureStatus calls GetData for us, but bug 681026 showed
// that assumption to be unsafe.
gfxInfo->GetData();
PRInt32 status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_OPENGL_LAYERS, &status))) {
if (status == nsIGfxInfo::FEATURE_NO_INFO) {