Bug 1949549 - Downgrade MacIOSurface recycling asserts from diagnostic to debug only. r=gfx-reviewers,lsalzman

They are expensive and they have served their purpose in confirming we
solved the issue.

Differential Revision: https://phabricator.services.mozilla.com/D238998
This commit is contained in:
Andrew Osmond
2025-02-20 19:22:47 +00:00
parent bcd2506cc6
commit 476c033b15
3 changed files with 16 additions and 12 deletions

View File

@@ -515,6 +515,7 @@ ColorDepth MacIOSurface::GetColorDepth() const {
}
}
#ifdef DEBUG
/* static */ Maybe<OSType> MacIOSurface::ChoosePixelFormat(
ChromaSubsampling aChromaSubsampling, ColorRange aColorRange,
ColorDepth aColorDepth) {
@@ -576,6 +577,7 @@ ColorDepth MacIOSurface::GetColorDepth() const {
}
return Nothing();
}
#endif
bool MacIOSurface::BindTexImage(mozilla::gl::GLContext* aGL, size_t aPlane,
mozilla::gfx::SurfaceFormat* aOutReadFormat) {

View File

@@ -150,10 +150,13 @@ class MacIOSurface final
static size_t GetMaxWidth();
static size_t GetMaxHeight();
# ifdef DEBUG
static mozilla::Maybe<OSType> ChoosePixelFormat(
mozilla::gfx::ChromaSubsampling aChromaSubsampling,
mozilla::gfx::ColorRange aColorRange,
mozilla::gfx::ColorDepth aColorDepth);
# endif
CFTypeRefPtr<IOSurfaceRef> GetIOSurfaceRef() { return mIOSurfaceRef; }

View File

@@ -290,22 +290,21 @@ already_AddRefed<MacIOSurface> MacIOSurfaceRecycleAllocator::Allocate(
continue;
}
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
#ifdef DEBUG
Maybe<OSType> pixelFormat = MacIOSurface::ChoosePixelFormat(
aChromaSubsampling, aColorRange, aColorDepth);
MOZ_DIAGNOSTIC_ASSERT(pixelFormat.isSome());
MOZ_DIAGNOSTIC_ASSERT(::IOSurfaceGetPixelFormat(surf.get()) ==
*pixelFormat);
MOZ_DIAGNOSTIC_ASSERT(::IOSurfaceGetWidthOfPlane(surf.get(), 0) ==
(size_t)aYSize.width);
MOZ_DIAGNOSTIC_ASSERT(::IOSurfaceGetHeightOfPlane(surf.get(), 0) ==
(size_t)aYSize.height);
MOZ_ASSERT(pixelFormat.isSome());
MOZ_ASSERT(::IOSurfaceGetPixelFormat(surf.get()) == *pixelFormat);
MOZ_ASSERT(::IOSurfaceGetWidthOfPlane(surf.get(), 0) ==
(size_t)aYSize.width);
MOZ_ASSERT(::IOSurfaceGetHeightOfPlane(surf.get(), 0) ==
(size_t)aYSize.height);
if (*pixelFormat != kCVPixelFormatType_422YpCbCr8_yuvs &&
*pixelFormat != kCVPixelFormatType_422YpCbCr8FullRange) {
MOZ_DIAGNOSTIC_ASSERT(::IOSurfaceGetWidthOfPlane(surf.get(), 1) ==
(size_t)aCbCrSize.width);
MOZ_DIAGNOSTIC_ASSERT(::IOSurfaceGetHeightOfPlane(surf.get(), 1) ==
(size_t)aCbCrSize.height);
MOZ_ASSERT(::IOSurfaceGetWidthOfPlane(surf.get(), 1) ==
(size_t)aCbCrSize.width);
MOZ_ASSERT(::IOSurfaceGetHeightOfPlane(surf.get(), 1) ==
(size_t)aCbCrSize.height);
}
#endif