mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1232042: Workaround Windows presentation bug by executing a present call on the main thread during a WM_PAINT event. r=jrmuizel
MozReview-Commit-ID: JbPdhIi9zCd
This commit is contained in:
parent
b661b75414
commit
ce40761651
@ -788,17 +788,28 @@ struct ParamTraits<mozilla::layers::TextureFactoryIdentifier>
|
||||
WriteParam(aMsg, aParam.mSupportsTextureBlitting);
|
||||
WriteParam(aMsg, aParam.mSupportsPartialUploads);
|
||||
WriteParam(aMsg, aParam.mSyncHandle);
|
||||
#ifdef XP_WIN
|
||||
WriteParam(aMsg, (void*)aParam.mSwapChain);
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
uint32_t supportedBlendModes = 0;
|
||||
IDXGISwapChain* swapChain = nullptr;
|
||||
bool result = ReadParam(aMsg, aIter, &aResult->mParentBackend) &&
|
||||
ReadParam(aMsg, aIter, &supportedBlendModes) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMaxTextureSize) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSupportsTextureBlitting) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSupportsPartialUploads) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSyncHandle);
|
||||
ReadParam(aMsg, aIter, &aResult->mSyncHandle)
|
||||
#ifdef XP_WIN
|
||||
&& ReadParam(aMsg, aIter, (void**)&swapChain)
|
||||
#endif
|
||||
;
|
||||
if (XRE_IsParentProcess()) {
|
||||
aResult->SetSwapChain(swapChain);
|
||||
}
|
||||
aResult->mSupportedBlendModes.deserialize(supportedBlendModes);
|
||||
return result;
|
||||
}
|
||||
|
@ -18,10 +18,48 @@
|
||||
#include "nsScreenManagerGonk.h"
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "dxgi.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace layers {
|
||||
|
||||
TextureFactoryIdentifier&
|
||||
TextureFactoryIdentifier::operator=(const TextureFactoryIdentifier& aOther) = default;
|
||||
|
||||
TextureFactoryIdentifier::TextureFactoryIdentifier(const TextureFactoryIdentifier& aOther)
|
||||
{
|
||||
*this = aOther;
|
||||
}
|
||||
|
||||
TextureFactoryIdentifier::TextureFactoryIdentifier(LayersBackend aLayersBackend,
|
||||
GeckoProcessType aParentProcessId,
|
||||
int32_t aMaxTextureSize,
|
||||
bool aSupportsTextureBlitting,
|
||||
bool aSupportsPartialUploads,
|
||||
SyncHandle aSyncHandle,
|
||||
IDXGISwapChain* aSwapChain)
|
||||
: mParentBackend(aLayersBackend)
|
||||
, mParentProcessId(aParentProcessId)
|
||||
, mSupportedBlendModes(gfx::CompositionOp::OP_OVER)
|
||||
, mMaxTextureSize(aMaxTextureSize)
|
||||
, mSupportsTextureBlitting(aSupportsTextureBlitting)
|
||||
, mSupportsPartialUploads(aSupportsPartialUploads)
|
||||
, mSyncHandle(aSyncHandle)
|
||||
, mSwapChain(aSwapChain)
|
||||
{}
|
||||
|
||||
TextureFactoryIdentifier::~TextureFactoryIdentifier()
|
||||
{}
|
||||
|
||||
void
|
||||
TextureFactoryIdentifier::SetSwapChain(IDXGISwapChain* aSwapChain)
|
||||
{
|
||||
mSwapChain = aSwapChain;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
Compositor::AssertOnCompositorThread()
|
||||
{
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
|
||||
struct IDXGISwapChain;
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
@ -166,21 +168,31 @@ struct TextureFactoryIdentifier
|
||||
bool mSupportsTextureBlitting;
|
||||
bool mSupportsPartialUploads;
|
||||
SyncHandle mSyncHandle;
|
||||
// This member is required to send the SwapChain to the main thread in order
|
||||
// to workaround bug 1232042.
|
||||
#ifdef XP_WIN
|
||||
RefPtr<IDXGISwapChain> mSwapChain;
|
||||
#else
|
||||
void* mSwapChain;
|
||||
#endif
|
||||
|
||||
// We can't include dxgi.h here because WinUser.h conflicts with some parts
|
||||
// of the tree. Therefor we compile all constructors & operators in a single
|
||||
// compile unit.
|
||||
TextureFactoryIdentifier& operator=(const TextureFactoryIdentifier& aOther);
|
||||
|
||||
TextureFactoryIdentifier(const TextureFactoryIdentifier& aOther);
|
||||
|
||||
explicit TextureFactoryIdentifier(LayersBackend aLayersBackend = LayersBackend::LAYERS_NONE,
|
||||
GeckoProcessType aParentProcessId = GeckoProcessType_Default,
|
||||
int32_t aMaxTextureSize = 4096,
|
||||
bool aSupportsTextureBlitting = false,
|
||||
bool aSupportsPartialUploads = false,
|
||||
SyncHandle aSyncHandle = 0)
|
||||
: mParentBackend(aLayersBackend)
|
||||
, mParentProcessId(aParentProcessId)
|
||||
, mSupportedBlendModes(gfx::CompositionOp::OP_OVER)
|
||||
, mMaxTextureSize(aMaxTextureSize)
|
||||
, mSupportsTextureBlitting(aSupportsTextureBlitting)
|
||||
, mSupportsPartialUploads(aSupportsPartialUploads)
|
||||
, mSyncHandle(aSyncHandle)
|
||||
{}
|
||||
SyncHandle aSyncHandle = 0,
|
||||
IDXGISwapChain* aSwapChain = nullptr);
|
||||
~TextureFactoryIdentifier();
|
||||
|
||||
void SetSwapChain(IDXGISwapChain* aSwapChain);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -460,6 +460,7 @@ CompositorD3D11::GetTextureFactoryIdentifier()
|
||||
ident.mParentProcessId = XRE_GetProcessType();
|
||||
ident.mParentBackend = LayersBackend::LAYERS_D3D11;
|
||||
ident.mSyncHandle = mAttachments->mSyncHandle;
|
||||
ident.mSwapChain = mSwapChain;
|
||||
for (uint8_t op = 0; op < uint8_t(gfx::CompositionOp::OP_COUNT); op++) {
|
||||
if (BlendOpIsMixBlendMode(gfx::CompositionOp(op))) {
|
||||
ident.mSupportedBlendModes += gfx::CompositionOp(op);
|
||||
|
@ -2513,6 +2513,12 @@ gfxWindowsPlatform::InitializeD3D11()
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<ID3D10Multithread> multi;
|
||||
HRESULT hr = mD3D11Device->QueryInterface(__uuidof(ID3D10Multithread), getter_AddRefs(multi));
|
||||
if (SUCCEEDED(hr) && multi) {
|
||||
multi->SetMultithreadProtected(TRUE);
|
||||
}
|
||||
|
||||
// Either device creation function should have returned Available.
|
||||
MOZ_ASSERT(mD3D11Status == FeatureStatus::Available);
|
||||
} else {
|
||||
|
@ -516,8 +516,18 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
|
||||
}
|
||||
break;
|
||||
case LayersBackend::LAYERS_CLIENT:
|
||||
result = listener->PaintWindow(
|
||||
this, LayoutDeviceIntRegion::FromUnknownRegion(region));
|
||||
{
|
||||
result = listener->PaintWindow(
|
||||
this, LayoutDeviceIntRegion::FromUnknownRegion(region));
|
||||
ClientLayerManager* clientLM =
|
||||
static_cast<ClientLayerManager*>(GetLayerManager());
|
||||
IDXGISwapChain* swapChain = clientLM->GetTextureFactoryIdentifier().mSwapChain.get();
|
||||
if (swapChain) {
|
||||
// Workaround for bug 1232042. On some devices artifacts will occur
|
||||
// is we don't do a main thread present call from the WM_PAINT event.
|
||||
swapChain->Present(0, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("Unknown layers backend used!");
|
||||
|
Loading…
Reference in New Issue
Block a user