Bug 1743930 - Remove unused TextureAllocationFlags flag handling r=gfx-reviewers,jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D132648
This commit is contained in:
sotaro 2021-12-02 02:42:00 +00:00
Родитель deafabcff7
Коммит 639a9cd58e
5 изменённых файлов: 6 добавлений и 29 удалений

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

@ -385,8 +385,7 @@ static bool InitBuffer(uint8_t* buf, size_t bufSize, gfx::SurfaceFormat aFormat,
return false; return false;
} }
if ((aAllocFlags & ALLOC_CLEAR_BUFFER) || if (aAllocFlags & ALLOC_CLEAR_BUFFER) {
(aAllocFlags & ALLOC_CLEAR_BUFFER_BLACK)) {
if (aFormat == gfx::SurfaceFormat::B8G8R8X8) { if (aFormat == gfx::SurfaceFormat::B8G8R8X8) {
// Even though BGRX was requested, XRGB_UINT32 is what is meant, // Even though BGRX was requested, XRGB_UINT32 is what is meant,
// so use 0xFF000000 to put alpha in the right place. // so use 0xFF000000 to put alpha in the right place.
@ -397,10 +396,6 @@ static bool InitBuffer(uint8_t* buf, size_t bufSize, gfx::SurfaceFormat aFormat,
} }
} }
if (aAllocFlags & ALLOC_CLEAR_BUFFER_WHITE) {
memset(buf, 0xFF, bufSize);
}
return true; return true;
} }

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

@ -266,8 +266,7 @@ static TextureType GetTextureType(gfx::SurfaceFormat aFormat,
if ((layersBackend == LayersBackend::LAYERS_WR && if ((layersBackend == LayersBackend::LAYERS_WR &&
!aKnowsCompositor->UsingSoftwareWebRender()) && !aKnowsCompositor->UsingSoftwareWebRender()) &&
(moz2DBackend == gfx::BackendType::DIRECT2D || (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 && aSize.width <= maxTextureSize && aSize.height <= maxTextureSize &&
!(aAllocFlags & ALLOC_UPDATE_FROM_SURFACE)) { !(aAllocFlags & ALLOC_UPDATE_FROM_SURFACE)) {
return TextureType::D3D11; return TextureType::D3D11;
@ -1195,8 +1194,7 @@ already_AddRefed<TextureClient> TextureClient::CreateFromSurface(
if (layersBackend == LayersBackend::LAYERS_WR && if (layersBackend == LayersBackend::LAYERS_WR &&
(moz2DBackend == gfx::BackendType::DIRECT2D || (moz2DBackend == gfx::BackendType::DIRECT2D ||
moz2DBackend == gfx::BackendType::DIRECT2D1_1 || moz2DBackend == gfx::BackendType::DIRECT2D1_1 ||
(!!(aAllocFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT) && DeviceManagerDx::Get()->GetContentDevice()) &&
DeviceManagerDx::Get()->GetContentDevice())) &&
size.width <= maxTextureSize && size.height <= maxTextureSize) { size.width <= maxTextureSize && size.height <= maxTextureSize) {
data = D3D11TextureData::Create(aSurface, aAllocFlags); data = D3D11TextureData::Create(aSurface, aAllocFlags);
} }
@ -1248,10 +1246,6 @@ already_AddRefed<TextureClient> TextureClient::CreateForRawBufferAccess(
return nullptr; return nullptr;
} }
if (aAllocFlags & ALLOC_DISALLOW_BUFFERTEXTURECLIENT) {
return nullptr;
}
if (!gfx::Factory::AllowedSurfaceSize(aSize)) { if (!gfx::Factory::AllowedSurfaceSize(aSize)) {
return nullptr; return nullptr;
} }

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

@ -62,8 +62,6 @@ class PTextureChild;
class TextureChild; class TextureChild;
class TextureData; class TextureData;
class GPUVideoTextureData; class GPUVideoTextureData;
struct RawTextureBuffer;
class RawYCbCrTextureBuffer;
class TextureClient; class TextureClient;
class ITextureClientRecycleAllocator; class ITextureClientRecycleAllocator;
#ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL #ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL

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

@ -288,9 +288,7 @@ D3D11TextureData::D3D11TextureData(ID3D11Texture2D* aTexture,
: mSize(aSize), : mSize(aSize),
mFormat(aFormat), mFormat(aFormat),
mNeedsClear(aFlags & ALLOC_CLEAR_BUFFER), mNeedsClear(aFlags & ALLOC_CLEAR_BUFFER),
mNeedsClearWhite(aFlags & ALLOC_CLEAR_BUFFER_WHITE),
mHasSynchronization(HasKeyedMutex(aTexture)), mHasSynchronization(HasKeyedMutex(aTexture)),
mIsForOutOfBandContent(aFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT),
mTexture(aTexture), mTexture(aTexture),
mAllocationFlags(aFlags) { mAllocationFlags(aFlags) {
MOZ_ASSERT(aTexture); MOZ_ASSERT(aTexture);
@ -321,7 +319,7 @@ bool D3D11TextureData::Lock(OpenMode aMode) {
return false; return false;
} }
if (NS_IsMainThread() && !mIsForOutOfBandContent) { if (NS_IsMainThread()) {
if (!PrepareDrawTargetInLock(aMode)) { if (!PrepareDrawTargetInLock(aMode)) {
Unlock(); Unlock();
return false; return false;
@ -334,8 +332,7 @@ bool D3D11TextureData::Lock(OpenMode aMode) {
bool D3D11TextureData::PrepareDrawTargetInLock(OpenMode aMode) { bool D3D11TextureData::PrepareDrawTargetInLock(OpenMode aMode) {
// Make sure that successful write-lock means we will have a DrawTarget to // Make sure that successful write-lock means we will have a DrawTarget to
// write into. // write into.
if (!mDrawTarget && if (!mDrawTarget && (aMode & OpenMode::OPEN_WRITE || mNeedsClear)) {
(aMode & OpenMode::OPEN_WRITE || mNeedsClear || mNeedsClearWhite)) {
mDrawTarget = BorrowDrawTarget(); mDrawTarget = BorrowDrawTarget();
if (!mDrawTarget) { if (!mDrawTarget) {
return false; return false;
@ -349,11 +346,6 @@ bool D3D11TextureData::PrepareDrawTargetInLock(OpenMode aMode) {
mDrawTarget->ClearRect(Rect(0, 0, mSize.width, mSize.height)); mDrawTarget->ClearRect(Rect(0, 0, mSize.width, mSize.height));
mNeedsClear = false; 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; return true;
} }
@ -461,7 +453,7 @@ D3D11TextureData* D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat,
} }
newDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; newDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
if (!NS_IsMainThread() || !!(aFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT)) { if (!NS_IsMainThread()) {
// On the main thread we use the syncobject to handle synchronization. // On the main thread we use the syncobject to handle synchronization.
if (!(aFlags & ALLOC_MANUAL_SYNCHRONIZATION)) { if (!(aFlags & ALLOC_MANUAL_SYNCHRONIZATION)) {
newDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX; newDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;

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

@ -124,9 +124,7 @@ class D3D11TextureData final : public TextureData {
gfx::YUVColorSpace mYUVColorSpace = gfx::YUVColorSpace::Identity; gfx::YUVColorSpace mYUVColorSpace = gfx::YUVColorSpace::Identity;
gfx::ColorRange mColorRange = gfx::ColorRange::LIMITED; gfx::ColorRange mColorRange = gfx::ColorRange::LIMITED;
bool mNeedsClear = false; bool mNeedsClear = false;
bool mNeedsClearWhite = false;
const bool mHasSynchronization; const bool mHasSynchronization;
const bool mIsForOutOfBandContent;
RefPtr<ID3D11Texture2D> mTexture; RefPtr<ID3D11Texture2D> mTexture;
const TextureAllocationFlags mAllocationFlags; const TextureAllocationFlags mAllocationFlags;