зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset d889e102b481 (bug 1743930
) for causing mda failures in DeviceManagerDx.cpp
This commit is contained in:
Родитель
d380aeea76
Коммит
dcb0a66282
|
@ -385,7 +385,8 @@ static bool InitBuffer(uint8_t* buf, size_t bufSize, gfx::SurfaceFormat aFormat,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (aAllocFlags & ALLOC_CLEAR_BUFFER) {
|
||||
if ((aAllocFlags & ALLOC_CLEAR_BUFFER) ||
|
||||
(aAllocFlags & ALLOC_CLEAR_BUFFER_BLACK)) {
|
||||
if (aFormat == gfx::SurfaceFormat::B8G8R8X8) {
|
||||
// Even though BGRX was requested, XRGB_UINT32 is what is meant,
|
||||
// so use 0xFF000000 to put alpha in the right place.
|
||||
|
@ -396,6 +397,10 @@ static bool InitBuffer(uint8_t* buf, size_t bufSize, gfx::SurfaceFormat aFormat,
|
|||
}
|
||||
}
|
||||
|
||||
if (aAllocFlags & ALLOC_CLEAR_BUFFER_WHITE) {
|
||||
memset(buf, 0xFF, bufSize);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -266,7 +266,8 @@ static TextureType GetTextureType(gfx::SurfaceFormat aFormat,
|
|||
if ((layersBackend == LayersBackend::LAYERS_WR &&
|
||||
!aKnowsCompositor->UsingSoftwareWebRender()) &&
|
||||
(moz2DBackend == gfx::BackendType::DIRECT2D ||
|
||||
moz2DBackend == gfx::BackendType::DIRECT2D1_1) &&
|
||||
moz2DBackend == gfx::BackendType::DIRECT2D1_1 ||
|
||||
(!!(aAllocFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT))) &&
|
||||
aSize.width <= maxTextureSize && aSize.height <= maxTextureSize &&
|
||||
!(aAllocFlags & ALLOC_UPDATE_FROM_SURFACE)) {
|
||||
return TextureType::D3D11;
|
||||
|
@ -1194,7 +1195,8 @@ already_AddRefed<TextureClient> TextureClient::CreateFromSurface(
|
|||
if (layersBackend == LayersBackend::LAYERS_WR &&
|
||||
(moz2DBackend == gfx::BackendType::DIRECT2D ||
|
||||
moz2DBackend == gfx::BackendType::DIRECT2D1_1 ||
|
||||
DeviceManagerDx::Get()->GetContentDevice()) &&
|
||||
(!!(aAllocFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT) &&
|
||||
DeviceManagerDx::Get()->GetContentDevice())) &&
|
||||
size.width <= maxTextureSize && size.height <= maxTextureSize) {
|
||||
data = D3D11TextureData::Create(aSurface, aAllocFlags);
|
||||
}
|
||||
|
@ -1246,6 +1248,10 @@ already_AddRefed<TextureClient> TextureClient::CreateForRawBufferAccess(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (aAllocFlags & ALLOC_DISALLOW_BUFFERTEXTURECLIENT) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!gfx::Factory::AllowedSurfaceSize(aSize)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,8 @@ class PTextureChild;
|
|||
class TextureChild;
|
||||
class TextureData;
|
||||
class GPUVideoTextureData;
|
||||
struct RawTextureBuffer;
|
||||
class RawYCbCrTextureBuffer;
|
||||
class TextureClient;
|
||||
class ITextureClientRecycleAllocator;
|
||||
#ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL
|
||||
|
|
|
@ -288,7 +288,9 @@ D3D11TextureData::D3D11TextureData(ID3D11Texture2D* aTexture,
|
|||
: mSize(aSize),
|
||||
mFormat(aFormat),
|
||||
mNeedsClear(aFlags & ALLOC_CLEAR_BUFFER),
|
||||
mNeedsClearWhite(aFlags & ALLOC_CLEAR_BUFFER_WHITE),
|
||||
mHasSynchronization(HasKeyedMutex(aTexture)),
|
||||
mIsForOutOfBandContent(aFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT),
|
||||
mTexture(aTexture),
|
||||
mAllocationFlags(aFlags) {
|
||||
MOZ_ASSERT(aTexture);
|
||||
|
@ -319,7 +321,7 @@ bool D3D11TextureData::Lock(OpenMode aMode) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
if (NS_IsMainThread() && !mIsForOutOfBandContent) {
|
||||
if (!PrepareDrawTargetInLock(aMode)) {
|
||||
Unlock();
|
||||
return false;
|
||||
|
@ -332,7 +334,8 @@ bool D3D11TextureData::Lock(OpenMode aMode) {
|
|||
bool D3D11TextureData::PrepareDrawTargetInLock(OpenMode aMode) {
|
||||
// Make sure that successful write-lock means we will have a DrawTarget to
|
||||
// write into.
|
||||
if (!mDrawTarget && (aMode & OpenMode::OPEN_WRITE || mNeedsClear)) {
|
||||
if (!mDrawTarget &&
|
||||
(aMode & OpenMode::OPEN_WRITE || mNeedsClear || mNeedsClearWhite)) {
|
||||
mDrawTarget = BorrowDrawTarget();
|
||||
if (!mDrawTarget) {
|
||||
return false;
|
||||
|
@ -346,6 +349,11 @@ bool D3D11TextureData::PrepareDrawTargetInLock(OpenMode aMode) {
|
|||
mDrawTarget->ClearRect(Rect(0, 0, mSize.width, mSize.height));
|
||||
mNeedsClear = false;
|
||||
}
|
||||
if (mNeedsClearWhite) {
|
||||
mDrawTarget->FillRect(Rect(0, 0, mSize.width, mSize.height),
|
||||
ColorPattern(DeviceColor(1.0, 1.0, 1.0, 1.0)));
|
||||
mNeedsClearWhite = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -453,7 +461,7 @@ D3D11TextureData* D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat,
|
|||
}
|
||||
|
||||
newDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
|
||||
if (!NS_IsMainThread()) {
|
||||
if (!NS_IsMainThread() || !!(aFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT)) {
|
||||
// On the main thread we use the syncobject to handle synchronization.
|
||||
if (!(aFlags & ALLOC_MANUAL_SYNCHRONIZATION)) {
|
||||
newDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
|
||||
|
|
|
@ -124,7 +124,9 @@ class D3D11TextureData final : public TextureData {
|
|||
gfx::YUVColorSpace mYUVColorSpace = gfx::YUVColorSpace::Identity;
|
||||
gfx::ColorRange mColorRange = gfx::ColorRange::LIMITED;
|
||||
bool mNeedsClear = false;
|
||||
bool mNeedsClearWhite = false;
|
||||
const bool mHasSynchronization;
|
||||
const bool mIsForOutOfBandContent;
|
||||
|
||||
RefPtr<ID3D11Texture2D> mTexture;
|
||||
const TextureAllocationFlags mAllocationFlags;
|
||||
|
|
Загрузка…
Ссылка в новой задаче