Skip to content

Commit

Permalink
Backed out changeset cf43cacdb262 (bug 1294232) for XPCShell failures
Browse files Browse the repository at this point in the history
CLOSED TREE
  • Loading branch information
IrisHsiao committed Sep 21, 2016
1 parent 887c9db commit 190f1b6
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 277 deletions.
65 changes: 5 additions & 60 deletions toolkit/xre/glxtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,6 @@ typedef uint32_t GLenum;
#define GL_RENDERER 0x1F01
#define GL_VERSION 0x1F02

// GLX_MESA_query_renderer
#define GLX_RENDERER_VENDOR_ID_MESA 0x8183
#define GLX_RENDERER_DEVICE_ID_MESA 0x8184
#define GLX_RENDERER_VERSION_MESA 0x8185
#define GLX_RENDERER_ACCELERATED_MESA 0x8186
#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187
#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188
#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189
#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A
#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B
#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C
#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D
#define GLX_RENDERER_ID_MESA 0x818E

namespace mozilla {
namespace widget {
// the read end of the pipe, which will be used by GfxInfo
Expand Down Expand Up @@ -266,14 +252,13 @@ void glxtest()
void* glXBindTexImageEXT = glXGetProcAddress("glXBindTexImageEXT");

///// Get GL vendor/renderer/versions strings /////
enum { bufsize = 2048 };
enum { bufsize = 1024 };
char buf[bufsize];
const GLubyte *vendorString = glGetString(GL_VENDOR);
const GLubyte *rendererString = glGetString(GL_RENDERER);
const GLubyte *versionString = glGetString(GL_VERSION);

const GLubyte* versionString = glGetString(GL_VERSION);
const GLubyte* vendorString = glGetString(GL_VENDOR);
const GLubyte* rendererString = glGetString(GL_RENDERER);

if (!versionString || !vendorString || !rendererString)
if (!vendorString || !rendererString || !versionString)
fatal_error("glGetString returned null");

int length = snprintf(buf, bufsize,
Expand All @@ -285,46 +270,6 @@ void glxtest()
if (length >= bufsize)
fatal_error("GL strings length too large for buffer size");

// If GLX_MESA_query_renderer is available, populate additional data.
typedef Bool (*PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int* value);
PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC glXQueryCurrentRendererIntegerMESAProc =
cast<PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC>(glXGetProcAddress("glXQueryCurrentRendererIntegerMESA"));
if (glXQueryCurrentRendererIntegerMESAProc) {
unsigned int vendorId, deviceId, accelerated, videoMemoryMB;
glXQueryCurrentRendererIntegerMESAProc(GLX_RENDERER_VENDOR_ID_MESA, &vendorId);
glXQueryCurrentRendererIntegerMESAProc(GLX_RENDERER_DEVICE_ID_MESA, &deviceId);
glXQueryCurrentRendererIntegerMESAProc(GLX_RENDERER_ACCELERATED_MESA, &accelerated);
glXQueryCurrentRendererIntegerMESAProc(GLX_RENDERER_VIDEO_MEMORY_MESA, &videoMemoryMB);

// Truncate IDs to 4 digits- that's all PCI IDs are.
vendorId &= 0xFFFF;
deviceId &= 0xFFFF;

length += snprintf(buf + length, bufsize,
"MESA_VENDOR_ID\n0x%04x\n"
"MESA_DEVICE_ID\n0x%04x\n"
"MESA_ACCELERATED\n%s\n"
"MESA_VRAM\n%dMB\n",
vendorId, deviceId, accelerated ? "TRUE" : "FALSE",
videoMemoryMB);

if (length >= bufsize)
fatal_error("GL strings length too large for buffer size");
}

// From Mesa's GL/internal/dri_interface.h, to be used by DRI clients.
typedef const char * (* PFNGLXGETSCREENDRIVERPROC) (Display *dpy, int scrNum);
PFNGLXGETSCREENDRIVERPROC glXGetScreenDriverProc =
cast<PFNGLXGETSCREENDRIVERPROC>(glXGetProcAddress("glXGetScreenDriver"));
if (glXGetScreenDriverProc) {
const char* driDriver = glXGetScreenDriverProc(dpy, DefaultScreen(dpy));
if (driDriver) {
length += snprintf(buf + length, bufsize, "DRI_DRIVER\n%s\n", driDriver);
if (length >= bufsize)
fatal_error("GL strings length too large for buffer size");
}
}

///// Clean up. Indeed, the parent process might fail to kill us (e.g. if it doesn't need to check GL info)
///// so we might be staying alive for longer than expected, so it's important to consume as little memory as
///// possible. Also we want to check that we're able to do that too without generating X errors.
Expand Down
5 changes: 0 additions & 5 deletions widget/GfxDriverInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,6 @@ const nsAString& GfxDriverInfo::GetDeviceVendor(DeviceVendor id)
DECLARE_VENDOR_ID(VendorAMD, "0x1022");
DECLARE_VENDOR_ID(VendorATI, "0x1002");
DECLARE_VENDOR_ID(VendorMicrosoft, "0x1414");
DECLARE_VENDOR_ID(VendorMesaAll, "mesa/all");
DECLARE_VENDOR_ID(VendorMesaLLVMPipe, "mesa/llvmpipe");
DECLARE_VENDOR_ID(VendorMesaSoftPipe, "mesa/softpipe");
DECLARE_VENDOR_ID(VendorMesaSWRast, "mesa/swrast");
DECLARE_VENDOR_ID(VendorMesaUnknown, "mesa/unknown");
// Suppress a warning.
DECLARE_VENDOR_ID(DeviceVendorMax, "");
}
Expand Down
14 changes: 1 addition & 13 deletions widget/GfxDriverInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,6 @@ enum DeviceVendor {
VendorAMD,
VendorATI,
VendorMicrosoft,

// Wildcard for all Mesa drivers.
VendorMesaAll,
// Note that the following list of Mesa drivers is not comprehensive; we pull
// the DRI driver at runtime. These drivers are provided for convenience when
// populating the local blocklist.
VendorMesaLLVMPipe,
VendorMesaSoftPipe,
VendorMesaSWRast,
// A generic ID to be provided when we can't determine the DRI driver on Mesa.
VendorMesaUnknown,

DeviceVendorMax
};

Expand Down Expand Up @@ -271,7 +259,7 @@ ParseDriverVersion(const nsAString& aVersion, uint64_t *aNumericVersion)
{
*aNumericVersion = 0;

#if defined(XP_WIN) || defined(MOZ_X11)
#if defined(XP_WIN)
int a, b, c, d;
char aStr[8], bStr[8], cStr[8], dStr[8];
/* honestly, why do I even bother */
Expand Down
15 changes: 4 additions & 11 deletions widget/GfxInfoBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,12 +694,13 @@ GfxInfoBase::FindBlocklistedDeviceInList(const nsTArray<GfxDriverInfo>& info,
}
}

#if defined(XP_WIN) || defined(ANDROID) || defined(MOZ_X11)
#if defined(XP_WIN) || defined(ANDROID)
uint64_t driverVersion;
ParseDriverVersion(adapterDriverVersionString, &driverVersion);
#endif

if (!DoesVendorMatch(info[i].mAdapterVendor, adapterVendorID)) {
if (!info[i].mAdapterVendor.Equals(GfxDriverInfo::GetDeviceVendor(VendorAll), nsCaseInsensitiveStringComparator()) &&
!info[i].mAdapterVendor.Equals(adapterVendorID, nsCaseInsensitiveStringComparator())) {
continue;
}

Expand Down Expand Up @@ -732,7 +733,7 @@ GfxInfoBase::FindBlocklistedDeviceInList(const nsTArray<GfxDriverInfo>& info,
continue;
}

#if defined(XP_WIN) || defined(ANDROID) || defined(MOZ_X11)
#if defined(XP_WIN) || defined(ANDROID)
switch (info[i].mComparisonOp) {
case DRIVER_LESS_THAN:
match = driverVersion < info[i].mDriverVersion;
Expand Down Expand Up @@ -839,14 +840,6 @@ GfxInfoBase::FindBlocklistedDeviceInList(const nsTArray<GfxDriverInfo>& info,
return status;
}

bool
GfxInfoBase::DoesVendorMatch(const nsAString& aBlocklistVendor,
const nsAString& aAdapterVendor)
{
return aBlocklistVendor.Equals(aAdapterVendor, nsCaseInsensitiveStringComparator()) ||
aBlocklistVendor.Equals(GfxDriverInfo::GetDeviceVendor(VendorAll), nsCaseInsensitiveStringComparator());
}

nsresult
GfxInfoBase::GetFeatureStatusImpl(int32_t aFeature,
int32_t* aStatus,
Expand Down
4 changes: 0 additions & 4 deletions widget/GfxInfoBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ class GfxInfoBase : public nsIGfxInfo,
virtual const nsTArray<GfxDriverInfo>& GetGfxDriverInfo() = 0;

virtual void DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> obj);

virtual bool DoesVendorMatch(const nsAString& aBlocklistVendor,
const nsAString& aAdapterVendor);

bool InitFeatureObject(
JSContext* aCx,
JS::Handle<JSObject*> aContainer,
Expand Down
Loading

0 comments on commit 190f1b6

Please sign in to comment.