mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Backed out 2 changesets (bug 1225283) for Windows build bustage CLOSED TREE
Backed out changeset a2dc8e863533 (bug 1225283) Backed out changeset 5f456b78cccc (bug 1225283)
This commit is contained in:
parent
78829dd6ba
commit
f4535ab455
@ -1004,7 +1004,7 @@ PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow)
|
||||
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
const NPSetWindowCallbackStruct* ws_info =
|
||||
static_cast<NPSetWindowCallbackStruct*>(aWindow->ws_info);
|
||||
window.visualID = ws_info->visual ? ws_info->visual->visualid : 0;
|
||||
window.visualID = ws_info->visual ? ws_info->visual->visualid : None;
|
||||
window.colormap = ws_info->colormap;
|
||||
#endif
|
||||
|
||||
|
@ -1,77 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "D3DMessageUtils.h"
|
||||
#if defined(XP_WIN)
|
||||
# include "gfxWindowsPlatform.h"
|
||||
#endif
|
||||
|
||||
bool
|
||||
DxgiAdapterDesc::operator ==(const DxgiAdapterDesc& aOther) const
|
||||
{
|
||||
return memcmp(&aOther, this, sizeof(*this)) == 0;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN)
|
||||
static_assert(sizeof(DxgiAdapterDesc) == sizeof(DXGI_ADAPTER_DESC),
|
||||
"DXGI_ADAPTER_DESC doe snot match DxgiAdapterDesc");
|
||||
|
||||
const DxgiAdapterDesc&
|
||||
DxgiAdapterDesc::From(const DXGI_ADAPTER_DESC& aDesc)
|
||||
{
|
||||
return reinterpret_cast<const DxgiAdapterDesc&>(aDesc);
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace IPC {
|
||||
|
||||
void
|
||||
ParamTraits<DxgiAdapterDesc>::Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
#if defined(XP_WIN)
|
||||
aMsg->WriteBytes(aParam.Description, sizeof(aParam.Description));
|
||||
WriteParam(aMsg, aParam.VendorId);
|
||||
WriteParam(aMsg, aParam.DeviceId);
|
||||
WriteParam(aMsg, aParam.SubSysId);
|
||||
WriteParam(aMsg, aParam.Revision);
|
||||
WriteParam(aMsg, aParam.DedicatedVideoMemory);
|
||||
WriteParam(aMsg, aParam.DedicatedSystemMemory);
|
||||
WriteParam(aMsg, aParam.SharedSystemMemory);
|
||||
WriteParam(aMsg, aParam.AdapterLuid.LowPart);
|
||||
WriteParam(aMsg, aParam.AdapterLuid.HighPart);
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE("DxgiAdapterDesc is Windows-only");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
ParamTraits<DxgiAdapterDesc>::Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
#if defined(XP_WIN)
|
||||
const char* description = nullptr;
|
||||
if (!aMsg->ReadBytes(aIter, &description, sizeof(aResult->Description))) {
|
||||
return false;
|
||||
}
|
||||
memcpy(aResult->Description, description, sizeof(aResult->Description));
|
||||
|
||||
if (ReadParam(aMsg, aIter, &aResult->VendorId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->DeviceId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->SubSysId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->Revision) &&
|
||||
ReadParam(aMsg, aIter, &aResult->DedicatedVideoMemory) &&
|
||||
ReadParam(aMsg, aIter, &aResult->DedicatedSystemMemory) &&
|
||||
ReadParam(aMsg, aIter, &aResult->SharedSystemMemory) &&
|
||||
ReadParam(aMsg, aIter, &aResult->AdapterLuid.LowPart) &&
|
||||
ReadParam(aMsg, aIter, &aResult->AdapterLuid.HighPart))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE("DxgiAdapterDesc is Windows-only");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace IPC
|
@ -1,47 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef _include_gfx_ipc_D3DMessageUtils_h__
|
||||
#define _include_gfx_ipc_D3DMessageUtils_h__
|
||||
|
||||
#include "chrome/common/ipc_message_utils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
// Can't include dxgi.h, since it leaks random identifiers and #defines, and
|
||||
// IPDL causes this file to be #included all over.
|
||||
typedef struct DXGI_ADAPTER_DESC DXGI_ADAPTER_DESC;
|
||||
|
||||
struct DxgiAdapterDesc
|
||||
{
|
||||
#if defined(XP_WIN)
|
||||
WCHAR Description[128];
|
||||
UINT VendorId;
|
||||
UINT DeviceId;
|
||||
UINT SubSysId;
|
||||
UINT Revision;
|
||||
SIZE_T DedicatedVideoMemory;
|
||||
SIZE_T DedicatedSystemMemory;
|
||||
SIZE_T SharedSystemMemory;
|
||||
LUID AdapterLuid;
|
||||
|
||||
static const DxgiAdapterDesc& From(const DXGI_ADAPTER_DESC& aDesc);
|
||||
#endif
|
||||
|
||||
bool operator ==(const DxgiAdapterDesc& aOther) const;
|
||||
};
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template <>
|
||||
struct ParamTraits<DxgiAdapterDesc>
|
||||
{
|
||||
typedef DxgiAdapterDesc paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam);
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult);
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
#endif // _include_gfx_ipc_D3DMessageUtils_h__
|
@ -5,11 +5,23 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using struct DxgiAdapterDesc from "mozilla/D3DMessageUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
struct DxgiLUID
|
||||
{
|
||||
uint32_t LowPart;
|
||||
int32_t HighPart;
|
||||
};
|
||||
|
||||
struct DxgiDesc
|
||||
{
|
||||
uint32_t vendorID;
|
||||
uint32_t deviceID;
|
||||
uint32_t subSysID;
|
||||
DxgiLUID luid;
|
||||
};
|
||||
|
||||
struct DeviceInitData
|
||||
{
|
||||
bool useAcceleration;
|
||||
@ -21,7 +33,7 @@ struct DeviceInitData
|
||||
bool d3d11TextureSharingWorks;
|
||||
bool useD2D;
|
||||
bool useD2D1;
|
||||
DxgiAdapterDesc adapter;
|
||||
DxgiDesc dxgiDesc;
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
|
@ -5,7 +5,6 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXPORTS.mozilla += [
|
||||
'D3DMessageUtils.h',
|
||||
'GfxMessageUtils.h'
|
||||
]
|
||||
|
||||
@ -24,7 +23,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'D3DMessageUtils.cpp',
|
||||
'SharedDIB.cpp',
|
||||
]
|
||||
|
||||
|
@ -1626,54 +1626,30 @@ gfxWindowsPlatform::GetDXGIAdapter()
|
||||
decltype(CreateDXGIFactory1)* createDXGIFactory1 = (decltype(CreateDXGIFactory1)*)
|
||||
GetProcAddress(dxgiModule, "CreateDXGIFactory1");
|
||||
|
||||
if (!createDXGIFactory1) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Try to use a DXGI 1.1 adapter in order to share resources
|
||||
// across processes.
|
||||
RefPtr<IDXGIFactory1> factory1;
|
||||
HRESULT hr = createDXGIFactory1(__uuidof(IDXGIFactory1),
|
||||
getter_AddRefs(factory1));
|
||||
if (FAILED(hr) || !factory1) {
|
||||
// This seems to happen with some people running the iZ3D driver.
|
||||
// They won't get acceleration.
|
||||
return nullptr;
|
||||
}
|
||||
if (createDXGIFactory1) {
|
||||
RefPtr<IDXGIFactory1> factory1;
|
||||
HRESULT hr = createDXGIFactory1(__uuidof(IDXGIFactory1),
|
||||
getter_AddRefs(factory1));
|
||||
|
||||
if (!XRE_IsContentProcess()) {
|
||||
// In the parent process, we pick the first adapter.
|
||||
if (FAILED(factory1->EnumAdapters1(0, getter_AddRefs(mAdapter)))) {
|
||||
if (FAILED(hr) || !factory1) {
|
||||
// This seems to happen with some people running the iZ3D driver.
|
||||
// They won't get acceleration.
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
const DxgiAdapterDesc& parent = GetParentDevicePrefs().adapter();
|
||||
|
||||
// In the child process, we search for the adapter that matches the parent
|
||||
// process. The first adapter can be mismatched on dual-GPU systems.
|
||||
for (UINT index = 0; ; index++) {
|
||||
RefPtr<IDXGIAdapter1> adapter;
|
||||
if (FAILED(factory1->EnumAdapters1(index, getter_AddRefs(adapter)))) {
|
||||
break;
|
||||
}
|
||||
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
if (SUCCEEDED(adapter->GetDesc(&desc)) &&
|
||||
desc.AdapterLuid.HighPart == parent.AdapterLuid.HighPart &&
|
||||
desc.AdapterLuid.LowPart == parent.AdapterLuid.LowPart)
|
||||
{
|
||||
mAdapter = adapter.forget();
|
||||
break;
|
||||
}
|
||||
hr = factory1->EnumAdapters1(0, getter_AddRefs(mAdapter));
|
||||
if (FAILED(hr)) {
|
||||
// We should return and not accelerate if we can't obtain
|
||||
// an adapter.
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mAdapter) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// We leak this module everywhere, we might as well do so here as well.
|
||||
dxgiModule.disown();
|
||||
|
||||
return mAdapter;
|
||||
}
|
||||
|
||||
@ -2233,14 +2209,14 @@ gfxWindowsPlatform::ContentAdapterIsParentAdapter(ID3D11Device* device)
|
||||
return false;
|
||||
}
|
||||
|
||||
const DxgiAdapterDesc& parent = GetParentDevicePrefs().adapter();
|
||||
if (desc.VendorId != parent.VendorId ||
|
||||
desc.DeviceId != parent.DeviceId ||
|
||||
desc.SubSysId != parent.SubSysId ||
|
||||
desc.AdapterLuid.HighPart != parent.AdapterLuid.HighPart ||
|
||||
desc.AdapterLuid.LowPart != parent.AdapterLuid.LowPart)
|
||||
const DxgiDesc& parent = GetParentDevicePrefs().dxgiDesc();
|
||||
if (desc.VendorId != parent.vendorID() ||
|
||||
desc.DeviceId != parent.deviceID() ||
|
||||
desc.SubSysId != parent.subSysID() ||
|
||||
desc.AdapterLuid.HighPart != parent.luid().HighPart() ||
|
||||
desc.AdapterLuid.LowPart != parent.luid().LowPart())
|
||||
{
|
||||
gfxCriticalNote << "VendorIDMismatch " << hexa(parent.VendorId) << " " << hexa(desc.VendorId);
|
||||
gfxCriticalNote << "VendorIDMismatch " << hexa(parent.vendorID()) << " " << hexa(desc.VendorId);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2292,13 +2268,12 @@ gfxWindowsPlatform::AttemptD3D11ContentDeviceCreation()
|
||||
// we re-check texture sharing against the newly created D3D11 content device.
|
||||
// If it fails, we won't use Direct2D.
|
||||
if (XRE_IsContentProcess()) {
|
||||
if (!DoesD3D11TextureSharingWork(mD3D11ContentDevice)) {
|
||||
if (!DoesD3D11TextureSharingWork(mD3D11ContentDevice) ||
|
||||
!ContentAdapterIsParentAdapter(mD3D11ContentDevice))
|
||||
{
|
||||
mD3D11ContentDevice = nullptr;
|
||||
return FeatureStatus::Failed;
|
||||
}
|
||||
|
||||
DebugOnly<bool> ok = ContentAdapterIsParentAdapter(mD3D11ContentDevice);
|
||||
MOZ_ASSERT(ok);
|
||||
}
|
||||
|
||||
mD3D11ContentDevice->SetExceptionMode(0);
|
||||
@ -2330,13 +2305,12 @@ gfxWindowsPlatform::AttemptD3D11ImageBridgeDeviceCreation()
|
||||
}
|
||||
|
||||
mD3D11ImageBridgeDevice->SetExceptionMode(0);
|
||||
if (!DoesD3D11AlphaTextureSharingWork(mD3D11ImageBridgeDevice)) {
|
||||
if (!DoesD3D11AlphaTextureSharingWork(mD3D11ImageBridgeDevice) ||
|
||||
(XRE_IsContentProcess() && !ContentAdapterIsParentAdapter(mD3D11ImageBridgeDevice)))
|
||||
{
|
||||
mD3D11ImageBridgeDevice = nullptr;
|
||||
return FeatureStatus::Failed;
|
||||
}
|
||||
|
||||
DebugOnly<bool> ok = ContentAdapterIsParentAdapter(mD3D11ImageBridgeDevice);
|
||||
MOZ_ASSERT(ok);
|
||||
return FeatureStatus::Available;
|
||||
}
|
||||
|
||||
@ -3053,6 +3027,11 @@ gfxWindowsPlatform::GetDeviceInitData(DeviceInitData* aOut)
|
||||
if (!GetDxgiDesc(mD3D11Device, &desc)) {
|
||||
return;
|
||||
}
|
||||
aOut->adapter() = DxgiAdapterDesc::From(desc);
|
||||
|
||||
aOut->dxgiDesc().vendorID() = desc.VendorId;
|
||||
aOut->dxgiDesc().deviceID() = desc.DeviceId;
|
||||
aOut->dxgiDesc().subSysID() = desc.SubSysId;
|
||||
aOut->dxgiDesc().luid().LowPart() = desc.AdapterLuid.LowPart;
|
||||
aOut->dxgiDesc().luid().HighPart() = desc.AdapterLuid.HighPart;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user