diff options
-rw-r--r-- | gfx/2d/MacIOSurface.cpp | 615 | ||||
-rw-r--r-- | gfx/2d/MacIOSurface.h | 216 | ||||
-rw-r--r-- | gfx/2d/NativeFontResourceMac.cpp | 67 | ||||
-rw-r--r-- | gfx/2d/NativeFontResourceMac.h | 42 | ||||
-rw-r--r-- | gfx/2d/PathCG.cpp | 435 | ||||
-rw-r--r-- | gfx/2d/PathCG.h | 114 | ||||
-rw-r--r-- | gfx/2d/QuartzSupport.h | 98 | ||||
-rw-r--r-- | gfx/2d/QuartzSupport.mm | 625 | ||||
-rw-r--r-- | gfx/2d/ScaledFontMac.cpp | 247 | ||||
-rw-r--r-- | gfx/2d/ScaledFontMac.h | 79 | ||||
-rw-r--r-- | gfx/2d/moz.build | 20 | ||||
-rw-r--r-- | ipc/glue/SharedMemoryBasic_mach.h | 83 | ||||
-rw-r--r-- | ipc/glue/SharedMemoryBasic_mach.mm | 664 | ||||
-rw-r--r-- | ipc/glue/moz.build | 8 | ||||
-rw-r--r-- | media/ffvpx/config_darwin64.asm | 642 | ||||
-rw-r--r-- | media/ffvpx/config_darwin64.h | 658 | ||||
-rw-r--r-- | media/libav/config_darwin.asm | 249 | ||||
-rw-r--r-- | media/libav/config_darwin.h | 259 |
18 files changed, 2 insertions, 5119 deletions
diff --git a/gfx/2d/MacIOSurface.cpp b/gfx/2d/MacIOSurface.cpp deleted file mode 100644 index 759de8575b..0000000000 --- a/gfx/2d/MacIOSurface.cpp +++ /dev/null @@ -1,615 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:set ts=2 sts=2 sw=2 et cin: -/* 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 "MacIOSurface.h" -#include <OpenGL/gl.h> -#include <QuartzCore/QuartzCore.h> -#include <dlfcn.h> -#include "mozilla/RefPtr.h" -#include "mozilla/Assertions.h" -#include "GLConsts.h" - -using namespace mozilla; -// IOSurface signatures -#define IOSURFACE_FRAMEWORK_PATH \ - "/System/Library/Frameworks/IOSurface.framework/IOSurface" -#define OPENGL_FRAMEWORK_PATH \ - "/System/Library/Frameworks/OpenGL.framework/OpenGL" -#define COREGRAPHICS_FRAMEWORK_PATH \ - "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/" \ - "CoreGraphics.framework/CoreGraphics" -#define COREVIDEO_FRAMEWORK_PATH \ - "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/" \ - "CoreVideo.framework/CoreVideo" - -#define GET_CONST(const_name) \ - ((CFStringRef*) dlsym(sIOSurfaceFramework, const_name)) -#define GET_IOSYM(dest,sym_name) \ - (typeof(dest)) dlsym(sIOSurfaceFramework, sym_name) -#define GET_CGLSYM(dest,sym_name) \ - (typeof(dest)) dlsym(sOpenGLFramework, sym_name) -#define GET_CGSYM(dest,sym_name) \ - (typeof(dest)) dlsym(sCoreGraphicsFramework, sym_name) -#define GET_CVSYM(dest, sym_name) \ - (typeof(dest)) dlsym(sCoreVideoFramework, sym_name) - -MacIOSurfaceLib::LibraryUnloader MacIOSurfaceLib::sLibraryUnloader; -bool MacIOSurfaceLib::isLoaded = false; -void* MacIOSurfaceLib::sIOSurfaceFramework; -void* MacIOSurfaceLib::sOpenGLFramework; -void* MacIOSurfaceLib::sCoreGraphicsFramework; -void* MacIOSurfaceLib::sCoreVideoFramework; -IOSurfaceCreateFunc MacIOSurfaceLib::sCreate; -IOSurfaceGetIDFunc MacIOSurfaceLib::sGetID; -IOSurfaceLookupFunc MacIOSurfaceLib::sLookup; -IOSurfaceGetBaseAddressFunc MacIOSurfaceLib::sGetBaseAddress; -IOSurfaceGetBaseAddressOfPlaneFunc MacIOSurfaceLib::sGetBaseAddressOfPlane; -IOSurfaceSizePlaneTFunc MacIOSurfaceLib::sWidth; -IOSurfaceSizePlaneTFunc MacIOSurfaceLib::sHeight; -IOSurfaceSizeTFunc MacIOSurfaceLib::sPlaneCount; -IOSurfaceSizePlaneTFunc MacIOSurfaceLib::sBytesPerRow; -IOSurfaceGetPropertyMaximumFunc MacIOSurfaceLib::sGetPropertyMaximum; -IOSurfaceVoidFunc MacIOSurfaceLib::sIncrementUseCount; -IOSurfaceVoidFunc MacIOSurfaceLib::sDecrementUseCount; -IOSurfaceLockFunc MacIOSurfaceLib::sLock; -IOSurfaceUnlockFunc MacIOSurfaceLib::sUnlock; -CGLTexImageIOSurface2DFunc MacIOSurfaceLib::sTexImage; -IOSurfaceContextCreateFunc MacIOSurfaceLib::sIOSurfaceContextCreate; -IOSurfaceContextCreateImageFunc MacIOSurfaceLib::sIOSurfaceContextCreateImage; -IOSurfaceContextGetSurfaceFunc MacIOSurfaceLib::sIOSurfaceContextGetSurface; -CVPixelBufferGetIOSurfaceFunc MacIOSurfaceLib::sCVPixelBufferGetIOSurface; -unsigned int (*MacIOSurfaceLib::sCGContextGetTypePtr) (CGContextRef) = nullptr; -IOSurfacePixelFormatFunc MacIOSurfaceLib::sPixelFormat; - -CFStringRef MacIOSurfaceLib::kPropWidth; -CFStringRef MacIOSurfaceLib::kPropHeight; -CFStringRef MacIOSurfaceLib::kPropBytesPerElem; -CFStringRef MacIOSurfaceLib::kPropBytesPerRow; -CFStringRef MacIOSurfaceLib::kPropIsGlobal; - -bool MacIOSurfaceLib::isInit() { - // Guard against trying to reload the library - // if it is not available. - if (!isLoaded) - LoadLibrary(); - MOZ_ASSERT(sIOSurfaceFramework); - return sIOSurfaceFramework; -} - -IOSurfacePtr MacIOSurfaceLib::IOSurfaceCreate(CFDictionaryRef properties) { - return sCreate(properties); -} - -IOSurfacePtr MacIOSurfaceLib::IOSurfaceLookup(IOSurfaceID aIOSurfaceID) { - return sLookup(aIOSurfaceID); -} - -IOSurfaceID MacIOSurfaceLib::IOSurfaceGetID(IOSurfacePtr aIOSurfacePtr) { - return sGetID(aIOSurfacePtr); -} - -void* MacIOSurfaceLib::IOSurfaceGetBaseAddress(IOSurfacePtr aIOSurfacePtr) { - return sGetBaseAddress(aIOSurfacePtr); -} - -void* MacIOSurfaceLib::IOSurfaceGetBaseAddressOfPlane(IOSurfacePtr aIOSurfacePtr, - size_t planeIndex) { - return sGetBaseAddressOfPlane(aIOSurfacePtr, planeIndex); -} - -size_t MacIOSurfaceLib::IOSurfaceGetPlaneCount(IOSurfacePtr aIOSurfacePtr) { - return sPlaneCount(aIOSurfacePtr); -} - -size_t MacIOSurfaceLib::IOSurfaceGetWidth(IOSurfacePtr aIOSurfacePtr, size_t plane) { - return sWidth(aIOSurfacePtr, plane); -} - -size_t MacIOSurfaceLib::IOSurfaceGetHeight(IOSurfacePtr aIOSurfacePtr, size_t plane) { - return sHeight(aIOSurfacePtr, plane); -} - -size_t MacIOSurfaceLib::IOSurfaceGetBytesPerRow(IOSurfacePtr aIOSurfacePtr, size_t plane) { - return sBytesPerRow(aIOSurfacePtr, plane); -} - -size_t MacIOSurfaceLib::IOSurfaceGetPropertyMaximum(CFStringRef property) { - return sGetPropertyMaximum(property); -} - -OSType MacIOSurfaceLib::IOSurfaceGetPixelFormat(IOSurfacePtr aIOSurfacePtr) { - return sPixelFormat(aIOSurfacePtr); -} - -IOReturn MacIOSurfaceLib::IOSurfaceLock(IOSurfacePtr aIOSurfacePtr, - uint32_t options, uint32_t* seed) { - return sLock(aIOSurfacePtr, options, seed); -} - -IOReturn MacIOSurfaceLib::IOSurfaceUnlock(IOSurfacePtr aIOSurfacePtr, - uint32_t options, uint32_t *seed) { - return sUnlock(aIOSurfacePtr, options, seed); -} - -void MacIOSurfaceLib::IOSurfaceIncrementUseCount(IOSurfacePtr aIOSurfacePtr) { - sIncrementUseCount(aIOSurfacePtr); -} - -void MacIOSurfaceLib::IOSurfaceDecrementUseCount(IOSurfacePtr aIOSurfacePtr) { - sDecrementUseCount(aIOSurfacePtr); -} - -CGLError MacIOSurfaceLib::CGLTexImageIOSurface2D(CGLContextObj ctxt, - GLenum target, GLenum internalFormat, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - IOSurfacePtr ioSurface, GLuint plane) { - return sTexImage(ctxt, target, internalFormat, width, height, - format, type, ioSurface, plane); -} - -IOSurfacePtr MacIOSurfaceLib::CVPixelBufferGetIOSurface(CVPixelBufferRef aPixelBuffer) { - return sCVPixelBufferGetIOSurface(aPixelBuffer); -} - -CGContextRef MacIOSurfaceLib::IOSurfaceContextCreate(IOSurfacePtr aIOSurfacePtr, - unsigned aWidth, unsigned aHeight, - unsigned aBitsPerComponent, unsigned aBytes, - CGColorSpaceRef aColorSpace, CGBitmapInfo bitmapInfo) { - if (!sIOSurfaceContextCreate) - return nullptr; - return sIOSurfaceContextCreate(aIOSurfacePtr, aWidth, aHeight, aBitsPerComponent, aBytes, aColorSpace, bitmapInfo); -} - -CGImageRef MacIOSurfaceLib::IOSurfaceContextCreateImage(CGContextRef aContext) { - if (!sIOSurfaceContextCreateImage) - return nullptr; - return sIOSurfaceContextCreateImage(aContext); -} - -IOSurfacePtr MacIOSurfaceLib::IOSurfaceContextGetSurface(CGContextRef aContext) { - if (!sIOSurfaceContextGetSurface) - return nullptr; - return sIOSurfaceContextGetSurface(aContext); -} - -CFStringRef MacIOSurfaceLib::GetIOConst(const char* symbole) { - CFStringRef *address = (CFStringRef*)dlsym(sIOSurfaceFramework, symbole); - if (!address) - return nullptr; - - return *address; -} - -void MacIOSurfaceLib::LoadLibrary() { - if (isLoaded) { - return; - } - isLoaded = true; - sIOSurfaceFramework = dlopen(IOSURFACE_FRAMEWORK_PATH, - RTLD_LAZY | RTLD_LOCAL); - sOpenGLFramework = dlopen(OPENGL_FRAMEWORK_PATH, - RTLD_LAZY | RTLD_LOCAL); - - sCoreGraphicsFramework = dlopen(COREGRAPHICS_FRAMEWORK_PATH, - RTLD_LAZY | RTLD_LOCAL); - - sCoreVideoFramework = dlopen(COREVIDEO_FRAMEWORK_PATH, - RTLD_LAZY | RTLD_LOCAL); - - if (!sIOSurfaceFramework || !sOpenGLFramework || !sCoreGraphicsFramework || - !sCoreVideoFramework) { - if (sIOSurfaceFramework) - dlclose(sIOSurfaceFramework); - if (sOpenGLFramework) - dlclose(sOpenGLFramework); - if (sCoreGraphicsFramework) - dlclose(sCoreGraphicsFramework); - if (sCoreVideoFramework) - dlclose(sCoreVideoFramework); - sIOSurfaceFramework = nullptr; - sOpenGLFramework = nullptr; - sCoreGraphicsFramework = nullptr; - sCoreVideoFramework = nullptr; - return; - } - - kPropWidth = GetIOConst("kIOSurfaceWidth"); - kPropHeight = GetIOConst("kIOSurfaceHeight"); - kPropBytesPerElem = GetIOConst("kIOSurfaceBytesPerElement"); - kPropBytesPerRow = GetIOConst("kIOSurfaceBytesPerRow"); - kPropIsGlobal = GetIOConst("kIOSurfaceIsGlobal"); - sCreate = GET_IOSYM(sCreate, "IOSurfaceCreate"); - sGetID = GET_IOSYM(sGetID, "IOSurfaceGetID"); - sWidth = GET_IOSYM(sWidth, "IOSurfaceGetWidthOfPlane"); - sHeight = GET_IOSYM(sHeight, "IOSurfaceGetHeightOfPlane"); - sBytesPerRow = GET_IOSYM(sBytesPerRow, "IOSurfaceGetBytesPerRowOfPlane"); - sGetPropertyMaximum = GET_IOSYM(sGetPropertyMaximum, "IOSurfaceGetPropertyMaximum"); - sLookup = GET_IOSYM(sLookup, "IOSurfaceLookup"); - sLock = GET_IOSYM(sLock, "IOSurfaceLock"); - sUnlock = GET_IOSYM(sUnlock, "IOSurfaceUnlock"); - sIncrementUseCount = - GET_IOSYM(sIncrementUseCount, "IOSurfaceIncrementUseCount"); - sDecrementUseCount = - GET_IOSYM(sDecrementUseCount, "IOSurfaceDecrementUseCount"); - sGetBaseAddress = GET_IOSYM(sGetBaseAddress, "IOSurfaceGetBaseAddress"); - sGetBaseAddressOfPlane = - GET_IOSYM(sGetBaseAddressOfPlane, "IOSurfaceGetBaseAddressOfPlane"); - sPlaneCount = GET_IOSYM(sPlaneCount, "IOSurfaceGetPlaneCount"); - sPixelFormat = GET_IOSYM(sPixelFormat, "IOSurfaceGetPixelFormat"); - - sTexImage = GET_CGLSYM(sTexImage, "CGLTexImageIOSurface2D"); - sCGContextGetTypePtr = (unsigned int (*)(CGContext*))dlsym(RTLD_DEFAULT, "CGContextGetType"); - - sCVPixelBufferGetIOSurface = - GET_CVSYM(sCVPixelBufferGetIOSurface, "CVPixelBufferGetIOSurface"); - - // Optional symbols - sIOSurfaceContextCreate = GET_CGSYM(sIOSurfaceContextCreate, "CGIOSurfaceContextCreate"); - sIOSurfaceContextCreateImage = GET_CGSYM(sIOSurfaceContextCreateImage, "CGIOSurfaceContextCreateImage"); - sIOSurfaceContextGetSurface = GET_CGSYM(sIOSurfaceContextGetSurface, "CGIOSurfaceContextGetSurface"); - - if (!sCreate || !sGetID || !sLookup || !sTexImage || !sGetBaseAddress || - !sGetBaseAddressOfPlane || !sPlaneCount || - !kPropWidth || !kPropHeight || !kPropBytesPerElem || !kPropIsGlobal || - !sLock || !sUnlock || !sIncrementUseCount || !sDecrementUseCount || - !sWidth || !sHeight || !kPropBytesPerRow || - !sBytesPerRow || !sGetPropertyMaximum || !sCVPixelBufferGetIOSurface) { - CloseLibrary(); - } -} - -void MacIOSurfaceLib::CloseLibrary() { - if (sIOSurfaceFramework) { - dlclose(sIOSurfaceFramework); - } - if (sOpenGLFramework) { - dlclose(sOpenGLFramework); - } - if (sCoreVideoFramework) { - dlclose(sCoreVideoFramework); - } - sIOSurfaceFramework = nullptr; - sOpenGLFramework = nullptr; - sCoreVideoFramework = nullptr; -} - -MacIOSurface::MacIOSurface(const void* aIOSurfacePtr, - double aContentsScaleFactor, bool aHasAlpha) - : mIOSurfacePtr(aIOSurfacePtr) - , mContentsScaleFactor(aContentsScaleFactor) - , mHasAlpha(aHasAlpha) -{ - CFRetain(mIOSurfacePtr); - IncrementUseCount(); -} - -MacIOSurface::~MacIOSurface() { - DecrementUseCount(); - CFRelease(mIOSurfacePtr); -} - -already_AddRefed<MacIOSurface> MacIOSurface::CreateIOSurface(int aWidth, int aHeight, - double aContentsScaleFactor, - bool aHasAlpha) { - if (!MacIOSurfaceLib::isInit() || aContentsScaleFactor <= 0) - return nullptr; - - CFMutableDictionaryRef props = ::CFDictionaryCreateMutable( - kCFAllocatorDefault, 4, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - if (!props) - return nullptr; - - MOZ_ASSERT((size_t)aWidth <= GetMaxWidth()); - MOZ_ASSERT((size_t)aHeight <= GetMaxHeight()); - - int32_t bytesPerElem = 4; - size_t intScaleFactor = ceil(aContentsScaleFactor); - aWidth *= intScaleFactor; - aHeight *= intScaleFactor; - CFNumberRef cfWidth = ::CFNumberCreate(nullptr, kCFNumberSInt32Type, &aWidth); - CFNumberRef cfHeight = ::CFNumberCreate(nullptr, kCFNumberSInt32Type, &aHeight); - CFNumberRef cfBytesPerElem = ::CFNumberCreate(nullptr, kCFNumberSInt32Type, &bytesPerElem); - ::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropWidth, - cfWidth); - ::CFRelease(cfWidth); - ::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropHeight, - cfHeight); - ::CFRelease(cfHeight); - ::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropBytesPerElem, - cfBytesPerElem); - ::CFRelease(cfBytesPerElem); - ::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropIsGlobal, - kCFBooleanTrue); - - IOSurfacePtr surfaceRef = MacIOSurfaceLib::IOSurfaceCreate(props); - ::CFRelease(props); - - if (!surfaceRef) - return nullptr; - - RefPtr<MacIOSurface> ioSurface = new MacIOSurface(surfaceRef, aContentsScaleFactor, aHasAlpha); - if (!ioSurface) { - ::CFRelease(surfaceRef); - return nullptr; - } - - // Release the IOSurface because MacIOSurface retained it - CFRelease(surfaceRef); - - return ioSurface.forget(); -} - -already_AddRefed<MacIOSurface> MacIOSurface::LookupSurface(IOSurfaceID aIOSurfaceID, - double aContentsScaleFactor, - bool aHasAlpha) { - if (!MacIOSurfaceLib::isInit() || aContentsScaleFactor <= 0) - return nullptr; - - IOSurfacePtr surfaceRef = MacIOSurfaceLib::IOSurfaceLookup(aIOSurfaceID); - if (!surfaceRef) - return nullptr; - - RefPtr<MacIOSurface> ioSurface = new MacIOSurface(surfaceRef, aContentsScaleFactor, aHasAlpha); - if (!ioSurface) { - ::CFRelease(surfaceRef); - return nullptr; - } - - // Release the IOSurface because MacIOSurface retained it - CFRelease(surfaceRef); - - return ioSurface.forget(); -} - -IOSurfaceID MacIOSurface::GetIOSurfaceID() { - return MacIOSurfaceLib::IOSurfaceGetID(mIOSurfacePtr); -} - -void* MacIOSurface::GetBaseAddress() { - return MacIOSurfaceLib::IOSurfaceGetBaseAddress(mIOSurfacePtr); -} - -void* MacIOSurface::GetBaseAddressOfPlane(size_t aPlaneIndex) -{ - return MacIOSurfaceLib::IOSurfaceGetBaseAddressOfPlane(mIOSurfacePtr, - aPlaneIndex); -} - -size_t MacIOSurface::GetWidth(size_t plane) { - size_t intScaleFactor = ceil(mContentsScaleFactor); - return GetDevicePixelWidth(plane) / intScaleFactor; -} - -size_t MacIOSurface::GetHeight(size_t plane) { - size_t intScaleFactor = ceil(mContentsScaleFactor); - return GetDevicePixelHeight(plane) / intScaleFactor; -} - -size_t MacIOSurface::GetPlaneCount() { - return MacIOSurfaceLib::IOSurfaceGetPlaneCount(mIOSurfacePtr); -} - -/*static*/ size_t MacIOSurface::GetMaxWidth() { - if (!MacIOSurfaceLib::isInit()) - return -1; - return MacIOSurfaceLib::IOSurfaceGetPropertyMaximum(MacIOSurfaceLib::kPropWidth); -} - -/*static*/ size_t MacIOSurface::GetMaxHeight() { - if (!MacIOSurfaceLib::isInit()) - return -1; - return MacIOSurfaceLib::IOSurfaceGetPropertyMaximum(MacIOSurfaceLib::kPropHeight); -} - -size_t MacIOSurface::GetDevicePixelWidth(size_t plane) { - return MacIOSurfaceLib::IOSurfaceGetWidth(mIOSurfacePtr, plane); -} - -size_t MacIOSurface::GetDevicePixelHeight(size_t plane) { - return MacIOSurfaceLib::IOSurfaceGetHeight(mIOSurfacePtr, plane); -} - -size_t MacIOSurface::GetBytesPerRow(size_t plane) { - return MacIOSurfaceLib::IOSurfaceGetBytesPerRow(mIOSurfacePtr, plane); -} - -OSType MacIOSurface::GetPixelFormat() { - return MacIOSurfaceLib::IOSurfaceGetPixelFormat(mIOSurfacePtr); -} - -void MacIOSurface::IncrementUseCount() { - MacIOSurfaceLib::IOSurfaceIncrementUseCount(mIOSurfacePtr); -} - -void MacIOSurface::DecrementUseCount() { - MacIOSurfaceLib::IOSurfaceDecrementUseCount(mIOSurfacePtr); -} - -#define READ_ONLY 0x1 -void MacIOSurface::Lock(bool aReadOnly) { - MacIOSurfaceLib::IOSurfaceLock(mIOSurfacePtr, aReadOnly ? READ_ONLY : 0, nullptr); -} - -void MacIOSurface::Unlock(bool aReadOnly) { - MacIOSurfaceLib::IOSurfaceUnlock(mIOSurfacePtr, aReadOnly ? READ_ONLY : 0, nullptr); -} - -using mozilla::gfx::SourceSurface; -using mozilla::gfx::IntSize; -using mozilla::gfx::SurfaceFormat; - -void -MacIOSurfaceBufferDeallocator(void* aClosure) -{ - MOZ_ASSERT(aClosure); - - delete [] static_cast<unsigned char*>(aClosure); -} - -already_AddRefed<SourceSurface> -MacIOSurface::GetAsSurface() { - Lock(); - size_t bytesPerRow = GetBytesPerRow(); - size_t ioWidth = GetDevicePixelWidth(); - size_t ioHeight = GetDevicePixelHeight(); - - unsigned char* ioData = (unsigned char*)GetBaseAddress(); - unsigned char* dataCpy = - new unsigned char[bytesPerRow * ioHeight / sizeof(unsigned char)]; - for (size_t i = 0; i < ioHeight; i++) { - memcpy(dataCpy + i * bytesPerRow, - ioData + i * bytesPerRow, ioWidth * 4); - } - - Unlock(); - - SurfaceFormat format = HasAlpha() ? mozilla::gfx::SurfaceFormat::B8G8R8A8 : - mozilla::gfx::SurfaceFormat::B8G8R8X8; - - RefPtr<mozilla::gfx::DataSourceSurface> surf = - mozilla::gfx::Factory::CreateWrappingDataSourceSurface(dataCpy, - bytesPerRow, - IntSize(ioWidth, ioHeight), - format, - &MacIOSurfaceBufferDeallocator, - static_cast<void*>(dataCpy)); - - return surf.forget(); -} - -SurfaceFormat -MacIOSurface::GetFormat() -{ - OSType pixelFormat = GetPixelFormat(); - if (pixelFormat == '420v') { - return SurfaceFormat::NV12; - } else if (pixelFormat == '2vuy') { - return SurfaceFormat::YUV422; - } else { - return HasAlpha() ? SurfaceFormat::R8G8B8A8 : SurfaceFormat::R8G8B8X8; - } -} - -SurfaceFormat -MacIOSurface::GetReadFormat() -{ - OSType pixelFormat = GetPixelFormat(); - if (pixelFormat == '420v') { - return SurfaceFormat::NV12; - } else if (pixelFormat == '2vuy') { - return SurfaceFormat::R8G8B8X8; - } else { - return HasAlpha() ? SurfaceFormat::R8G8B8A8 : SurfaceFormat::R8G8B8X8; - } -} - -CGLError -MacIOSurface::CGLTexImageIOSurface2D(CGLContextObj ctx, size_t plane) -{ - MOZ_ASSERT(plane >= 0); - OSType pixelFormat = GetPixelFormat(); - - GLenum internalFormat; - GLenum format; - GLenum type; - if (pixelFormat == '420v') { - MOZ_ASSERT(GetPlaneCount() == 2); - MOZ_ASSERT(plane < 2); - - if (plane == 0) { - internalFormat = format = GL_LUMINANCE; - } else { - internalFormat = format = GL_LUMINANCE_ALPHA; - } - type = GL_UNSIGNED_BYTE; - } else if (pixelFormat == '2vuy') { - MOZ_ASSERT(plane == 0); - - internalFormat = GL_RGB; - format = LOCAL_GL_YCBCR_422_APPLE; - type = GL_UNSIGNED_SHORT_8_8_APPLE; - } else { - MOZ_ASSERT(plane == 0); - - internalFormat = HasAlpha() ? GL_RGBA : GL_RGB; - format = GL_BGRA; - type = GL_UNSIGNED_INT_8_8_8_8_REV; - } - CGLError temp = MacIOSurfaceLib::CGLTexImageIOSurface2D(ctx, - GL_TEXTURE_RECTANGLE_ARB, - internalFormat, - GetDevicePixelWidth(plane), - GetDevicePixelHeight(plane), - format, - type, - mIOSurfacePtr, plane); - return temp; -} - -static -CGColorSpaceRef CreateSystemColorSpace() { - CGColorSpaceRef cspace = ::CGDisplayCopyColorSpace(::CGMainDisplayID()); - if (!cspace) { - cspace = ::CGColorSpaceCreateDeviceRGB(); - } - return cspace; -} - -CGContextRef MacIOSurface::CreateIOSurfaceContext() { - CGColorSpaceRef cspace = CreateSystemColorSpace(); - CGContextRef ref = MacIOSurfaceLib::IOSurfaceContextCreate(mIOSurfacePtr, - GetDevicePixelWidth(), - GetDevicePixelHeight(), - 8, 32, cspace, 0x2002); - ::CGColorSpaceRelease(cspace); - return ref; -} - -CGImageRef MacIOSurface::CreateImageFromIOSurfaceContext(CGContextRef aContext) { - if (!MacIOSurfaceLib::isInit()) - return nullptr; - - return MacIOSurfaceLib::IOSurfaceContextCreateImage(aContext); -} - -already_AddRefed<MacIOSurface> MacIOSurface::IOSurfaceContextGetSurface(CGContextRef aContext, - double aContentsScaleFactor, - bool aHasAlpha) { - if (!MacIOSurfaceLib::isInit() || aContentsScaleFactor <= 0) - return nullptr; - - IOSurfacePtr surfaceRef = MacIOSurfaceLib::IOSurfaceContextGetSurface(aContext); - if (!surfaceRef) - return nullptr; - - RefPtr<MacIOSurface> ioSurface = new MacIOSurface(surfaceRef, aContentsScaleFactor, aHasAlpha); - if (!ioSurface) { - ::CFRelease(surfaceRef); - return nullptr; - } - return ioSurface.forget(); -} - - -CGContextType GetContextType(CGContextRef ref) -{ - if (!MacIOSurfaceLib::isInit() || !MacIOSurfaceLib::sCGContextGetTypePtr) - return CG_CONTEXT_TYPE_UNKNOWN; - - unsigned int type = MacIOSurfaceLib::sCGContextGetTypePtr(ref); - if (type == CG_CONTEXT_TYPE_BITMAP) { - return CG_CONTEXT_TYPE_BITMAP; - } else if (type == CG_CONTEXT_TYPE_IOSURFACE) { - return CG_CONTEXT_TYPE_IOSURFACE; - } else { - return CG_CONTEXT_TYPE_UNKNOWN; - } -} - - diff --git a/gfx/2d/MacIOSurface.h b/gfx/2d/MacIOSurface.h deleted file mode 100644 index e9c76e5dd8..0000000000 --- a/gfx/2d/MacIOSurface.h +++ /dev/null @@ -1,216 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 MacIOSurface_h__ -#define MacIOSurface_h__ -#ifdef XP_DARWIN -#include <QuartzCore/QuartzCore.h> -#include <CoreVideo/CoreVideo.h> -#include <dlfcn.h> - -struct _CGLContextObject; - -typedef _CGLContextObject* CGLContextObj; -typedef struct CGContext* CGContextRef; -typedef struct CGImage* CGImageRef; -typedef uint32_t IOSurfaceID; - -typedef CFTypeRef IOSurfacePtr; -typedef IOSurfacePtr (*IOSurfaceCreateFunc) (CFDictionaryRef properties); -typedef IOSurfacePtr (*IOSurfaceLookupFunc) (uint32_t io_surface_id); -typedef IOSurfaceID (*IOSurfaceGetIDFunc)(IOSurfacePtr io_surface); -typedef void (*IOSurfaceVoidFunc)(IOSurfacePtr io_surface); -typedef IOReturn (*IOSurfaceLockFunc)(IOSurfacePtr io_surface, uint32_t options, - uint32_t *seed); -typedef IOReturn (*IOSurfaceUnlockFunc)(IOSurfacePtr io_surface, - uint32_t options, uint32_t *seed); -typedef void* (*IOSurfaceGetBaseAddressFunc)(IOSurfacePtr io_surface); -typedef void* (*IOSurfaceGetBaseAddressOfPlaneFunc)(IOSurfacePtr io_surface, - size_t planeIndex); -typedef size_t (*IOSurfaceSizeTFunc)(IOSurfacePtr io_surface); -typedef size_t (*IOSurfaceSizePlaneTFunc)(IOSurfacePtr io_surface, size_t plane); -typedef size_t (*IOSurfaceGetPropertyMaximumFunc) (CFStringRef property); -typedef CGLError (*CGLTexImageIOSurface2DFunc) (CGLContextObj ctxt, - GLenum target, GLenum internalFormat, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - IOSurfacePtr ioSurface, GLuint plane); -typedef CGContextRef (*IOSurfaceContextCreateFunc)(CFTypeRef io_surface, - unsigned width, unsigned height, - unsigned bitsPerComponent, unsigned bytes, - CGColorSpaceRef colorSpace, CGBitmapInfo bitmapInfo); -typedef CGImageRef (*IOSurfaceContextCreateImageFunc)(CGContextRef ref); -typedef IOSurfacePtr (*IOSurfaceContextGetSurfaceFunc)(CGContextRef ref); - -typedef IOSurfacePtr (*CVPixelBufferGetIOSurfaceFunc)( - CVPixelBufferRef pixelBuffer); - -typedef OSType (*IOSurfacePixelFormatFunc)(IOSurfacePtr io_surface); - -#ifdef XP_MACOSX -#import <OpenGL/OpenGL.h> -#else -#import <OpenGLES/ES2/gl.h> -#endif - -#include "2D.h" -#include "mozilla/RefPtr.h" -#include "mozilla/RefCounted.h" - -enum CGContextType { - CG_CONTEXT_TYPE_UNKNOWN = 0, - // These are found by inspection, it's possible they could be changed - CG_CONTEXT_TYPE_BITMAP = 4, - CG_CONTEXT_TYPE_IOSURFACE = 8 -}; - -CGContextType GetContextType(CGContextRef ref); - -class MacIOSurface final : public mozilla::external::AtomicRefCounted<MacIOSurface> { -public: - MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(MacIOSurface) - typedef mozilla::gfx::SourceSurface SourceSurface; - - // The usage count of the IOSurface is increased by 1 during the lifetime - // of the MacIOSurface instance. - // MacIOSurface holds a reference to the corresponding IOSurface. - - static already_AddRefed<MacIOSurface> CreateIOSurface(int aWidth, int aHeight, - double aContentsScaleFactor = 1.0, - bool aHasAlpha = true); - static void ReleaseIOSurface(MacIOSurface *aIOSurface); - static already_AddRefed<MacIOSurface> LookupSurface(IOSurfaceID aSurfaceID, - double aContentsScaleFactor = 1.0, - bool aHasAlpha = true); - - explicit MacIOSurface(const void *aIOSurfacePtr, - double aContentsScaleFactor = 1.0, - bool aHasAlpha = true); - ~MacIOSurface(); - IOSurfaceID GetIOSurfaceID(); - void *GetBaseAddress(); - void *GetBaseAddressOfPlane(size_t planeIndex); - size_t GetPlaneCount(); - OSType GetPixelFormat(); - // GetWidth() and GetHeight() return values in "display pixels". A - // "display pixel" is the smallest fully addressable part of a display. - // But in HiDPI modes each "display pixel" corresponds to more than one - // device pixel. Use GetDevicePixel**() to get device pixels. - size_t GetWidth(size_t plane = 0); - size_t GetHeight(size_t plane = 0); - double GetContentsScaleFactor() { return mContentsScaleFactor; } - size_t GetDevicePixelWidth(size_t plane = 0); - size_t GetDevicePixelHeight(size_t plane = 0); - size_t GetBytesPerRow(size_t plane = 0); - void Lock(bool aReadOnly = true); - void Unlock(bool aReadOnly = true); - void IncrementUseCount(); - void DecrementUseCount(); - bool HasAlpha() { return mHasAlpha; } - mozilla::gfx::SurfaceFormat GetFormat(); - mozilla::gfx::SurfaceFormat GetReadFormat(); - - // We would like to forward declare NSOpenGLContext, but it is an @interface - // and this file is also used from c++, so we use a void *. - CGLError CGLTexImageIOSurface2D(CGLContextObj ctxt, size_t plane = 0); - already_AddRefed<SourceSurface> GetAsSurface(); - CGContextRef CreateIOSurfaceContext(); - - // FIXME This doesn't really belong here - static CGImageRef CreateImageFromIOSurfaceContext(CGContextRef aContext); - static already_AddRefed<MacIOSurface> IOSurfaceContextGetSurface(CGContextRef aContext, - double aContentsScaleFactor = 1.0, - bool aHasAlpha = true); - static size_t GetMaxWidth(); - static size_t GetMaxHeight(); - -private: - friend class nsCARenderer; - const void* mIOSurfacePtr; - double mContentsScaleFactor; - bool mHasAlpha; -}; - -class MacIOSurfaceLib { -public: - MacIOSurfaceLib() = delete; - static void *sIOSurfaceFramework; - static void *sOpenGLFramework; - static void *sCoreGraphicsFramework; - static void *sCoreVideoFramework; - static bool isLoaded; - static IOSurfaceCreateFunc sCreate; - static IOSurfaceGetIDFunc sGetID; - static IOSurfaceLookupFunc sLookup; - static IOSurfaceGetBaseAddressFunc sGetBaseAddress; - static IOSurfaceGetBaseAddressOfPlaneFunc sGetBaseAddressOfPlane; - static IOSurfaceSizeTFunc sPlaneCount; - static IOSurfaceLockFunc sLock; - static IOSurfaceUnlockFunc sUnlock; - static IOSurfaceVoidFunc sIncrementUseCount; - static IOSurfaceVoidFunc sDecrementUseCount; - static IOSurfaceSizePlaneTFunc sWidth; - static IOSurfaceSizePlaneTFunc sHeight; - static IOSurfaceSizePlaneTFunc sBytesPerRow; - static IOSurfaceGetPropertyMaximumFunc sGetPropertyMaximum; - static CGLTexImageIOSurface2DFunc sTexImage; - static IOSurfaceContextCreateFunc sIOSurfaceContextCreate; - static IOSurfaceContextCreateImageFunc sIOSurfaceContextCreateImage; - static IOSurfaceContextGetSurfaceFunc sIOSurfaceContextGetSurface; - static CVPixelBufferGetIOSurfaceFunc sCVPixelBufferGetIOSurface; - static IOSurfacePixelFormatFunc sPixelFormat; - static CFStringRef kPropWidth; - static CFStringRef kPropHeight; - static CFStringRef kPropBytesPerElem; - static CFStringRef kPropBytesPerRow; - static CFStringRef kPropIsGlobal; - - static bool isInit(); - static CFStringRef GetIOConst(const char* symbole); - static IOSurfacePtr IOSurfaceCreate(CFDictionaryRef properties); - static IOSurfacePtr IOSurfaceLookup(IOSurfaceID aIOSurfaceID); - static IOSurfaceID IOSurfaceGetID(IOSurfacePtr aIOSurfacePtr); - static void* IOSurfaceGetBaseAddress(IOSurfacePtr aIOSurfacePtr); - static void* IOSurfaceGetBaseAddressOfPlane(IOSurfacePtr aIOSurfacePtr, - size_t aPlaneIndex); - static size_t IOSurfaceGetPlaneCount(IOSurfacePtr aIOSurfacePtr); - static size_t IOSurfaceGetWidth(IOSurfacePtr aIOSurfacePtr, size_t plane); - static size_t IOSurfaceGetHeight(IOSurfacePtr aIOSurfacePtr, size_t plane); - static size_t IOSurfaceGetBytesPerRow(IOSurfacePtr aIOSurfacePtr, size_t plane); - static size_t IOSurfaceGetPropertyMaximum(CFStringRef property); - static IOReturn IOSurfaceLock(IOSurfacePtr aIOSurfacePtr, - uint32_t options, uint32_t *seed); - static IOReturn IOSurfaceUnlock(IOSurfacePtr aIOSurfacePtr, - uint32_t options, uint32_t *seed); - static void IOSurfaceIncrementUseCount(IOSurfacePtr aIOSurfacePtr); - static void IOSurfaceDecrementUseCount(IOSurfacePtr aIOSurfacePtr); - static CGLError CGLTexImageIOSurface2D(CGLContextObj ctxt, - GLenum target, GLenum internalFormat, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - IOSurfacePtr ioSurface, GLuint plane); - static CGContextRef IOSurfaceContextCreate(IOSurfacePtr aIOSurfacePtr, - unsigned aWidth, unsigned aHeight, - unsigned aBitsPerCompoent, unsigned aBytes, - CGColorSpaceRef aColorSpace, CGBitmapInfo bitmapInfo); - static CGImageRef IOSurfaceContextCreateImage(CGContextRef ref); - static IOSurfacePtr IOSurfaceContextGetSurface(CGContextRef ref); - static IOSurfacePtr CVPixelBufferGetIOSurface(CVPixelBufferRef apixelBuffer); - static OSType IOSurfaceGetPixelFormat(IOSurfacePtr aIOSurfacePtr); - static unsigned int (*sCGContextGetTypePtr) (CGContextRef); - static void LoadLibrary(); - static void CloseLibrary(); - - // Static deconstructor - static class LibraryUnloader { - public: - ~LibraryUnloader() { - CloseLibrary(); - } - } sLibraryUnloader; -}; - -#endif -#endif diff --git a/gfx/2d/NativeFontResourceMac.cpp b/gfx/2d/NativeFontResourceMac.cpp deleted file mode 100644 index 5747d737ef..0000000000 --- a/gfx/2d/NativeFontResourceMac.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 "NativeFontResourceMac.h" -#include "Types.h" - -#include "mozilla/RefPtr.h" -#include "mozilla/gfx/Logging.h" - -#ifdef MOZ_WIDGET_UIKIT -#include <CoreFoundation/CoreFoundation.h> -#endif - -namespace mozilla { -namespace gfx { - -/* static */ -already_AddRefed<NativeFontResourceMac> -NativeFontResourceMac::Create(uint8_t *aFontData, uint32_t aDataLength) -{ - // copy font data - CFDataRef data = CFDataCreate(kCFAllocatorDefault, aFontData, aDataLength); - if (!data) { - return nullptr; - } - - // create a provider - CGDataProviderRef provider = CGDataProviderCreateWithCFData(data); - - // release our reference to the CFData, provider keeps it alive - CFRelease(data); - - // create the font object - CGFontRef fontRef = CGFontCreateWithDataProvider(provider); - - // release our reference, font will keep it alive as long as needed - CGDataProviderRelease(provider); - - if (!fontRef) { - return nullptr; - } - - // passes ownership of fontRef to the NativeFontResourceMac instance - RefPtr<NativeFontResourceMac> fontResource = - new NativeFontResourceMac(fontRef); - - return fontResource.forget(); -} - -already_AddRefed<ScaledFont> -NativeFontResourceMac::CreateScaledFont(uint32_t aIndex, Float aGlyphSize, - const uint8_t* aInstanceData, uint32_t aInstanceDataLength) -{ - RefPtr<ScaledFontBase> scaledFont = new ScaledFontMac(mFontRef, aGlyphSize); - - if (!scaledFont->PopulateCairoScaledFont()) { - gfxWarning() << "Unable to create cairo scaled Mac font."; - return nullptr; - } - - return scaledFont.forget(); -} - -} // gfx -} // mozilla diff --git a/gfx/2d/NativeFontResourceMac.h b/gfx/2d/NativeFontResourceMac.h deleted file mode 100644 index bba935bc54..0000000000 --- a/gfx/2d/NativeFontResourceMac.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 mozilla_gfx_NativeFontResourceMac_h -#define mozilla_gfx_NativeFontResourceMac_h - -#include "2D.h" -#include "mozilla/AlreadyAddRefed.h" -#include "ScaledFontMac.h" - -namespace mozilla { -namespace gfx { - -class NativeFontResourceMac final : public NativeFontResource -{ -public: - MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(NativeFontResourceMac) - - static already_AddRefed<NativeFontResourceMac> - Create(uint8_t *aFontData, uint32_t aDataLength); - - already_AddRefed<ScaledFont> - CreateScaledFont(uint32_t aIndex, Float aGlyphSize, - const uint8_t* aInstanceData, uint32_t aInstanceDataLength) final; - - ~NativeFontResourceMac() - { - CFRelease(mFontRef); - } - -private: - explicit NativeFontResourceMac(CGFontRef aFontRef) : mFontRef(aFontRef) {} - - CGFontRef mFontRef; -}; - -} // gfx -} // mozilla - -#endif // mozilla_gfx_NativeFontResourceMac_h diff --git a/gfx/2d/PathCG.cpp b/gfx/2d/PathCG.cpp deleted file mode 100644 index 4d70b2607f..0000000000 --- a/gfx/2d/PathCG.cpp +++ /dev/null @@ -1,435 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * 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 "PathCG.h" -#include <math.h> -#include "Logging.h" -#include "PathHelpers.h" - -namespace mozilla { -namespace gfx { - -static inline Rect -CGRectToRect(CGRect rect) -{ - return Rect(rect.origin.x, - rect.origin.y, - rect.size.width, - rect.size.height); -} - -static inline Point -CGPointToPoint(CGPoint point) -{ - return Point(point.x, point.y); -} - -static inline void -SetStrokeOptions(CGContextRef cg, const StrokeOptions &aStrokeOptions) -{ - switch (aStrokeOptions.mLineCap) - { - case CapStyle::BUTT: - CGContextSetLineCap(cg, kCGLineCapButt); - break; - case CapStyle::ROUND: - CGContextSetLineCap(cg, kCGLineCapRound); - break; - case CapStyle::SQUARE: - CGContextSetLineCap(cg, kCGLineCapSquare); - break; - } - - switch (aStrokeOptions.mLineJoin) - { - case JoinStyle::BEVEL: - CGContextSetLineJoin(cg, kCGLineJoinBevel); - break; - case JoinStyle::ROUND: - CGContextSetLineJoin(cg, kCGLineJoinRound); - break; - case JoinStyle::MITER: - case JoinStyle::MITER_OR_BEVEL: - CGContextSetLineJoin(cg, kCGLineJoinMiter); - break; - } - - CGContextSetLineWidth(cg, aStrokeOptions.mLineWidth); - CGContextSetMiterLimit(cg, aStrokeOptions.mMiterLimit); - - // XXX: rename mDashLength to dashLength - if (aStrokeOptions.mDashLength > 0) { - // we use a regular array instead of a std::vector here because we don't want to leak the <vector> include - CGFloat *dashes = new CGFloat[aStrokeOptions.mDashLength]; - for (size_t i=0; i<aStrokeOptions.mDashLength; i++) { - dashes[i] = aStrokeOptions.mDashPattern[i]; - } - CGContextSetLineDash(cg, aStrokeOptions.mDashOffset, dashes, aStrokeOptions.mDashLength); - delete[] dashes; - } -} - -static inline CGAffineTransform -GfxMatrixToCGAffineTransform(const Matrix &m) -{ - CGAffineTransform t; - t.a = m._11; - t.b = m._12; - t.c = m._21; - t.d = m._22; - t.tx = m._31; - t.ty = m._32; - return t; -} - -PathBuilderCG::~PathBuilderCG() -{ - CGPathRelease(mCGPath); -} - -void -PathBuilderCG::MoveTo(const Point &aPoint) -{ - if (!aPoint.IsFinite()) { - return; - } - CGPathMoveToPoint(mCGPath, nullptr, aPoint.x, aPoint.y); -} - -void -PathBuilderCG::LineTo(const Point &aPoint) -{ - if (!aPoint.IsFinite()) { - return; - } - - if (CGPathIsEmpty(mCGPath)) - MoveTo(aPoint); - else - CGPathAddLineToPoint(mCGPath, nullptr, aPoint.x, aPoint.y); -} - -void -PathBuilderCG::BezierTo(const Point &aCP1, - const Point &aCP2, - const Point &aCP3) -{ - if (!aCP1.IsFinite() || !aCP2.IsFinite() || !aCP3.IsFinite()) { - return; - } - - if (CGPathIsEmpty(mCGPath)) - MoveTo(aCP1); - CGPathAddCurveToPoint(mCGPath, nullptr, - aCP1.x, aCP1.y, - aCP2.x, aCP2.y, - aCP3.x, aCP3.y); - -} - -void -PathBuilderCG::QuadraticBezierTo(const Point &aCP1, - const Point &aCP2) -{ - if (!aCP1.IsFinite() || !aCP2.IsFinite()) { - return; - } - - if (CGPathIsEmpty(mCGPath)) - MoveTo(aCP1); - CGPathAddQuadCurveToPoint(mCGPath, nullptr, - aCP1.x, aCP1.y, - aCP2.x, aCP2.y); -} - -void -PathBuilderCG::Close() -{ - if (!CGPathIsEmpty(mCGPath)) - CGPathCloseSubpath(mCGPath); -} - -void -PathBuilderCG::Arc(const Point &aOrigin, Float aRadius, Float aStartAngle, - Float aEndAngle, bool aAntiClockwise) -{ - if (!aOrigin.IsFinite() || !IsFinite(aRadius) || - !IsFinite(aStartAngle) || !IsFinite(aEndAngle)) { - return; - } - - // Disabled for now due to a CG bug when using CGPathAddArc with stroke - // dashing and rotation transforms that are multiples of 90 degrees. See: - // https://bugzilla.mozilla.org/show_bug.cgi?id=949661#c8 -#if 0 - // Core Graphic's initial coordinate system is y-axis up, whereas Moz2D's is - // y-axis down. Core Graphics therefore considers "clockwise" to mean "sweep - // in the direction of decreasing angle" whereas Moz2D considers it to mean - // "sweep in the direction of increasing angle". In other words if this - // Moz2D method is instructed to sweep anti-clockwise we need to tell - // CGPathAddArc to sweep clockwise, and vice versa. Hence why we pass the - // value of aAntiClockwise directly to CGPathAddArc's "clockwise" bool - // parameter. - CGPathAddArc(mCGPath, nullptr, - aOrigin.x, aOrigin.y, - aRadius, - aStartAngle, - aEndAngle, - aAntiClockwise); -#endif - ArcToBezier(this, aOrigin, Size(aRadius, aRadius), aStartAngle, aEndAngle, - aAntiClockwise); -} - -Point -PathBuilderCG::CurrentPoint() const -{ - Point ret; - if (!CGPathIsEmpty(mCGPath)) { - CGPoint pt = CGPathGetCurrentPoint(mCGPath); - ret.MoveTo(pt.x, pt.y); - } - return ret; -} - -void -PathBuilderCG::EnsureActive(const Point &aPoint) -{ -} - -already_AddRefed<Path> -PathBuilderCG::Finish() -{ - return MakeAndAddRef<PathCG>(mCGPath, mFillRule); -} - -already_AddRefed<PathBuilder> -PathCG::CopyToBuilder(FillRule aFillRule) const -{ - CGMutablePathRef path = CGPathCreateMutableCopy(mPath); - return MakeAndAddRef<PathBuilderCG>(path, aFillRule); -} - - - -already_AddRefed<PathBuilder> -PathCG::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFillRule) const -{ - // 10.7 adds CGPathCreateMutableCopyByTransformingPath it might be faster than doing - // this by hand - - struct TransformApplier { - CGMutablePathRef path; - CGAffineTransform transform; - static void - TranformCGPathApplierFunc(void *vinfo, const CGPathElement *element) - { - TransformApplier *info = reinterpret_cast<TransformApplier*>(vinfo); - switch (element->type) { - case kCGPathElementMoveToPoint: - { - CGPoint pt = element->points[0]; - CGPathMoveToPoint(info->path, &info->transform, pt.x, pt.y); - break; - } - case kCGPathElementAddLineToPoint: - { - CGPoint pt = element->points[0]; - CGPathAddLineToPoint(info->path, &info->transform, pt.x, pt.y); - break; - } - case kCGPathElementAddQuadCurveToPoint: - { - CGPoint cpt = element->points[0]; - CGPoint pt = element->points[1]; - CGPathAddQuadCurveToPoint(info->path, &info->transform, cpt.x, cpt.y, pt.x, pt.y); - break; - } - case kCGPathElementAddCurveToPoint: - { - CGPoint cpt1 = element->points[0]; - CGPoint cpt2 = element->points[1]; - CGPoint pt = element->points[2]; - CGPathAddCurveToPoint(info->path, &info->transform, cpt1.x, cpt1.y, cpt2.x, cpt2.y, pt.x, pt.y); - break; - } - case kCGPathElementCloseSubpath: - { - CGPathCloseSubpath(info->path); - break; - } - } - } - }; - - TransformApplier ta; - ta.path = CGPathCreateMutable(); - ta.transform = GfxMatrixToCGAffineTransform(aTransform); - - CGPathApply(mPath, &ta, TransformApplier::TranformCGPathApplierFunc); - return MakeAndAddRef<PathBuilderCG>(ta.path, aFillRule); -} - -static void -StreamPathToSinkApplierFunc(void *vinfo, const CGPathElement *element) -{ - PathSink *sink = reinterpret_cast<PathSink*>(vinfo); - switch (element->type) { - case kCGPathElementMoveToPoint: - { - CGPoint pt = element->points[0]; - sink->MoveTo(CGPointToPoint(pt)); - break; - } - case kCGPathElementAddLineToPoint: - { - CGPoint pt = element->points[0]; - sink->LineTo(CGPointToPoint(pt)); - break; - } - case kCGPathElementAddQuadCurveToPoint: - { - CGPoint cpt = element->points[0]; - CGPoint pt = element->points[1]; - sink->QuadraticBezierTo(CGPointToPoint(cpt), - CGPointToPoint(pt)); - break; - } - case kCGPathElementAddCurveToPoint: - { - CGPoint cpt1 = element->points[0]; - CGPoint cpt2 = element->points[1]; - CGPoint pt = element->points[2]; - sink->BezierTo(CGPointToPoint(cpt1), - CGPointToPoint(cpt2), - CGPointToPoint(pt)); - break; - } - case kCGPathElementCloseSubpath: - { - sink->Close(); - break; - } - } -} - -void -PathCG::StreamToSink(PathSink *aSink) const -{ - CGPathApply(mPath, aSink, StreamPathToSinkApplierFunc); -} - -bool -PathCG::ContainsPoint(const Point &aPoint, const Matrix &aTransform) const -{ - Matrix inverse = aTransform; - inverse.Invert(); - Point transformedPoint = inverse.TransformPoint(aPoint); - // We could probably drop the input transform and just transform the point at the caller? - CGPoint point = {transformedPoint.x, transformedPoint.y}; - - // The transform parameter of CGPathContainsPoint doesn't seem to work properly on OS X 10.5 - // so we transform aPoint ourselves. - return CGPathContainsPoint(mPath, nullptr, point, mFillRule == FillRule::FILL_EVEN_ODD); -} - -static size_t -PutBytesNull(void *info, const void *buffer, size_t count) -{ - return count; -} - -/* The idea of a scratch context comes from WebKit */ -static CGContextRef -CreateScratchContext() -{ - CGDataConsumerCallbacks callbacks = {PutBytesNull, nullptr}; - CGDataConsumerRef consumer = CGDataConsumerCreate(nullptr, &callbacks); - CGContextRef cg = CGPDFContextCreate(consumer, nullptr, nullptr); - CGDataConsumerRelease(consumer); - return cg; -} - -static CGContextRef -ScratchContext() -{ - static CGContextRef cg = CreateScratchContext(); - return cg; -} - -bool -PathCG::StrokeContainsPoint(const StrokeOptions &aStrokeOptions, - const Point &aPoint, - const Matrix &aTransform) const -{ - Matrix inverse = aTransform; - inverse.Invert(); - Point transformedPoint = inverse.TransformPoint(aPoint); - // We could probably drop the input transform and just transform the point at the caller? - CGPoint point = {transformedPoint.x, transformedPoint.y}; - - CGContextRef cg = ScratchContext(); - - CGContextSaveGState(cg); - - CGContextBeginPath(cg); - CGContextAddPath(cg, mPath); - - SetStrokeOptions(cg, aStrokeOptions); - - CGContextReplacePathWithStrokedPath(cg); - CGContextRestoreGState(cg); - - CGPathRef sPath = CGContextCopyPath(cg); - bool inStroke = CGPathContainsPoint(sPath, nullptr, point, false); - CGPathRelease(sPath); - - return inStroke; -} - -//XXX: what should these functions return for an empty path? -// currently they return CGRectNull {inf,inf, 0, 0} -Rect -PathCG::GetBounds(const Matrix &aTransform) const -{ - //XXX: are these bounds tight enough - Rect bounds = CGRectToRect(CGPathGetBoundingBox(mPath)); - - //XXX: currently this returns the bounds of the transformed bounds - // this is strictly looser than the bounds of the transformed path - return aTransform.TransformBounds(bounds); -} - -Rect -PathCG::GetStrokedBounds(const StrokeOptions &aStrokeOptions, - const Matrix &aTransform) const -{ - // 10.7 has CGPathCreateCopyByStrokingPath which we could use - // instead of this scratch context business - CGContextRef cg = ScratchContext(); - - CGContextSaveGState(cg); - - CGContextBeginPath(cg); - CGContextAddPath(cg, mPath); - - SetStrokeOptions(cg, aStrokeOptions); - - CGContextReplacePathWithStrokedPath(cg); - Rect bounds = CGRectToRect(CGContextGetPathBoundingBox(cg)); - - CGContextRestoreGState(cg); - - if (!bounds.IsFinite()) { - return Rect(); - } - - return aTransform.TransformBounds(bounds); -} - - -} // namespace gfx - -} // namespace mozilla diff --git a/gfx/2d/PathCG.h b/gfx/2d/PathCG.h deleted file mode 100644 index db609cb577..0000000000 --- a/gfx/2d/PathCG.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * 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 MOZILLA_GFX_PATHCG_H_ -#define MOZILLA_GFX_PATHCG_H_ - -#ifdef MOZ_WIDGET_COCOA -#include <ApplicationServices/ApplicationServices.h> -#else -#include <CoreGraphics/CoreGraphics.h> -#endif - -#include "2D.h" - -namespace mozilla { -namespace gfx { - -class PathCG; - -class PathBuilderCG : public PathBuilder -{ -public: - MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathBuilderCG) - // absorbs a reference of aPath - PathBuilderCG(CGMutablePathRef aPath, FillRule aFillRule) - : mFillRule(aFillRule) - { - mCGPath = aPath; - } - - explicit PathBuilderCG(FillRule aFillRule) - : mFillRule(aFillRule) - { - mCGPath = CGPathCreateMutable(); - } - - virtual ~PathBuilderCG(); - - virtual void MoveTo(const Point &aPoint); - virtual void LineTo(const Point &aPoint); - virtual void BezierTo(const Point &aCP1, - const Point &aCP2, - const Point &aCP3); - virtual void QuadraticBezierTo(const Point &aCP1, - const Point &aCP2); - virtual void Close(); - virtual void Arc(const Point &aOrigin, Float aRadius, Float aStartAngle, - Float aEndAngle, bool aAntiClockwise = false); - virtual Point CurrentPoint() const; - - virtual already_AddRefed<Path> Finish(); - - virtual BackendType GetBackendType() const { return BackendType::SKIA; } - -private: - friend class PathCG; - friend class ScaledFontMac; - - void EnsureActive(const Point &aPoint); - - CGMutablePathRef mCGPath; - Point mCurrentPoint; - Point mBeginPoint; - FillRule mFillRule; -}; - -class PathCG : public Path -{ -public: - MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathCG) - PathCG(CGMutablePathRef aPath, FillRule aFillRule) - : mPath(aPath) - , mFillRule(aFillRule) - { - CGPathRetain(mPath); - } - virtual ~PathCG() { CGPathRelease(mPath); } - - // Paths will always return BackendType::COREGRAPHICS, but note that they - // are compatible with BackendType::COREGRAPHICS_ACCELERATED backend. - virtual BackendType GetBackendType() const { return BackendType::SKIA; } - - virtual already_AddRefed<PathBuilder> CopyToBuilder(FillRule aFillRule) const; - virtual already_AddRefed<PathBuilder> TransformedCopyToBuilder(const Matrix &aTransform, - FillRule aFillRule) const; - - virtual bool ContainsPoint(const Point &aPoint, const Matrix &aTransform) const; - virtual bool StrokeContainsPoint(const StrokeOptions &aStrokeOptions, - const Point &aPoint, - const Matrix &aTransform) const; - virtual Rect GetBounds(const Matrix &aTransform = Matrix()) const; - virtual Rect GetStrokedBounds(const StrokeOptions &aStrokeOptions, - const Matrix &aTransform = Matrix()) const; - - virtual void StreamToSink(PathSink *aSink) const; - - virtual FillRule GetFillRule() const { return mFillRule; } - - CGMutablePathRef GetPath() const { return mPath; } - -private: - friend class DrawTargetCG; - - CGMutablePathRef mPath; - Point mEndPoint; - FillRule mFillRule; -}; - -} // namespace gfx -} // namespace mozilla - -#endif diff --git a/gfx/2d/QuartzSupport.h b/gfx/2d/QuartzSupport.h deleted file mode 100644 index f56fcb77ca..0000000000 --- a/gfx/2d/QuartzSupport.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:set ts=2 sts=2 sw=2 et cin: -/* 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 nsCoreAnimationSupport_h__ -#define nsCoreAnimationSupport_h__ -#ifdef XP_MACOSX - -#import <OpenGL/OpenGL.h> -#import <OpenGL/gl.h> -#import "ApplicationServices/ApplicationServices.h" -#include "gfxTypes.h" -#include "mozilla/RefPtr.h" -#include "mozilla/gfx/MacIOSurface.h" -#include "nsError.h" - -// Get the system color space. -CGColorSpaceRef CreateSystemColorSpace(); - -// Manages a CARenderer -struct _CGLContextObject; - -enum AllowOfflineRendererEnum { ALLOW_OFFLINE_RENDERER, DISALLOW_OFFLINE_RENDERER }; - -class nsCARenderer : public mozilla::RefCounted<nsCARenderer> { -public: - MOZ_DECLARE_REFCOUNTED_TYPENAME(nsCARenderer) - nsCARenderer() : mCARenderer(nullptr), mWrapperCALayer(nullptr), mFBOTexture(0), - mOpenGLContext(nullptr), mCGImage(nullptr), mCGData(nullptr), - mIOSurface(nullptr), mFBO(0), mIOTexture(0), - mUnsupportedWidth(UINT32_MAX), mUnsupportedHeight(UINT32_MAX), - mAllowOfflineRenderer(DISALLOW_OFFLINE_RENDERER), - mContentsScaleFactor(1.0) {} - ~nsCARenderer(); - // aWidth and aHeight are in "display pixels". A "display pixel" is the - // smallest fully addressable part of a display. But in HiDPI modes each - // "display pixel" corresponds to more than one device pixel. Multiply - // display pixels by aContentsScaleFactor to get device pixels. - nsresult SetupRenderer(void* aCALayer, int aWidth, int aHeight, - double aContentsScaleFactor, - AllowOfflineRendererEnum aAllowOfflineRenderer); - // aWidth and aHeight are in "display pixels". Multiply by - // aContentsScaleFactor to get device pixels. - nsresult Render(int aWidth, int aHeight, - double aContentsScaleFactor, - CGImageRef *aOutCAImage); - bool isInit() { return mCARenderer != nullptr; } - /* - * Render the CALayer to an IOSurface. If no IOSurface - * is attached then an internal pixel buffer will be - * used. - */ - void AttachIOSurface(MacIOSurface *aSurface); - IOSurfaceID GetIOSurfaceID(); - // aX, aY, aWidth and aHeight are in "display pixels". Multiply by - // surf->GetContentsScaleFactor() to get device pixels. - static nsresult DrawSurfaceToCGContext(CGContextRef aContext, - MacIOSurface *surf, - CGColorSpaceRef aColorSpace, - int aX, int aY, - size_t aWidth, size_t aHeight); - - // Remove & Add the layer without destroying - // the renderer for fast back buffer swapping. - void DetachCALayer(); - void AttachCALayer(void *aCALayer); -#ifdef DEBUG - static void SaveToDisk(MacIOSurface *surf); -#endif -private: - // aWidth and aHeight are in "display pixels". Multiply by - // mContentsScaleFactor to get device pixels. - void SetBounds(int aWidth, int aHeight); - // aWidth and aHeight are in "display pixels". Multiply by - // mContentsScaleFactor to get device pixels. - void SetViewport(int aWidth, int aHeight); - void Destroy(); - - void *mCARenderer; - void *mWrapperCALayer; - GLuint mFBOTexture; - _CGLContextObject *mOpenGLContext; - CGImageRef mCGImage; - void *mCGData; - RefPtr<MacIOSurface> mIOSurface; - uint32_t mFBO; - uint32_t mIOTexture; - int mUnsupportedWidth; - int mUnsupportedHeight; - AllowOfflineRendererEnum mAllowOfflineRenderer; - double mContentsScaleFactor; -}; - -#endif // XP_MACOSX -#endif // nsCoreAnimationSupport_h__ - diff --git a/gfx/2d/QuartzSupport.mm b/gfx/2d/QuartzSupport.mm deleted file mode 100644 index 464db5ecee..0000000000 --- a/gfx/2d/QuartzSupport.mm +++ /dev/null @@ -1,625 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:set ts=2 sts=2 sw=2 et cin: -/* 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 "QuartzSupport.h" -#include "nsDebug.h" -#include "MacIOSurface.h" -#include "mozilla/Sprintf.h" - -#import <QuartzCore/QuartzCore.h> -#import <AppKit/NSOpenGL.h> -#include <dlfcn.h> -#include "GLDefs.h" - -#define IOSURFACE_FRAMEWORK_PATH \ - "/System/Library/Frameworks/IOSurface.framework/IOSurface" -#define OPENGL_FRAMEWORK_PATH \ - "/System/Library/Frameworks/OpenGL.framework/OpenGL" -#define COREGRAPHICS_FRAMEWORK_PATH \ - "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/CoreGraphics" - -@interface CALayer (ContentsScale) -- (double)contentsScale; -- (void)setContentsScale:(double)scale; -@end - - -CGColorSpaceRef CreateSystemColorSpace() { - CGColorSpaceRef cspace = ::CGDisplayCopyColorSpace(::CGMainDisplayID()); - if (!cspace) { - cspace = ::CGColorSpaceCreateDeviceRGB(); - } - return cspace; -} - -nsCARenderer::~nsCARenderer() { - Destroy(); -} - -void cgdata_release_callback(void *aCGData, const void *data, size_t size) { - if (aCGData) { - free(aCGData); - } -} - -void nsCARenderer::Destroy() { - if (mCARenderer) { - CARenderer* caRenderer = (CARenderer*)mCARenderer; - // Bug 556453: - // Explicitly remove the layer from the renderer - // otherwise it does not always happen right away. - caRenderer.layer = nullptr; - [caRenderer release]; - } - if (mWrapperCALayer) { - CALayer* wrapperLayer = (CALayer*)mWrapperCALayer; - [wrapperLayer release]; - } - if (mOpenGLContext) { - if (mFBO || mIOTexture || mFBOTexture) { - // Release these resources with the context that allocated them - CGLContextObj oldContext = ::CGLGetCurrentContext(); - ::CGLSetCurrentContext(mOpenGLContext); - - if (mFBOTexture) { - ::glDeleteTextures(1, &mFBOTexture); - } - if (mIOTexture) { - ::glDeleteTextures(1, &mIOTexture); - } - if (mFBO) { - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - ::glDeleteFramebuffersEXT(1, &mFBO); - } - - if (oldContext) - ::CGLSetCurrentContext(oldContext); - } - ::CGLDestroyContext((CGLContextObj)mOpenGLContext); - } - if (mCGImage) { - ::CGImageRelease(mCGImage); - } - // mCGData is deallocated by cgdata_release_callback - - mCARenderer = nil; - mWrapperCALayer = nil; - mFBOTexture = 0; - mOpenGLContext = nullptr; - mCGImage = nullptr; - mIOSurface = nullptr; - mFBO = 0; - mIOTexture = 0; -} - -nsresult nsCARenderer::SetupRenderer(void *aCALayer, int aWidth, int aHeight, - double aContentsScaleFactor, - AllowOfflineRendererEnum aAllowOfflineRenderer) { - mAllowOfflineRenderer = aAllowOfflineRenderer; - - if (aWidth == 0 || aHeight == 0 || aContentsScaleFactor <= 0) - return NS_ERROR_FAILURE; - - if (aWidth == mUnsupportedWidth && - aHeight == mUnsupportedHeight) { - return NS_ERROR_FAILURE; - } - - CGLPixelFormatAttribute attributes[] = { - kCGLPFAAccelerated, - kCGLPFADepthSize, (CGLPixelFormatAttribute)24, - kCGLPFAAllowOfflineRenderers, - (CGLPixelFormatAttribute)0 - }; - - if (mAllowOfflineRenderer == DISALLOW_OFFLINE_RENDERER) { - attributes[3] = (CGLPixelFormatAttribute)0; - } - - GLint screen; - CGLPixelFormatObj format; - if (::CGLChoosePixelFormat(attributes, &format, &screen) != kCGLNoError) { - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - - if (::CGLCreateContext(format, nullptr, &mOpenGLContext) != kCGLNoError) { - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - ::CGLDestroyPixelFormat(format); - - CARenderer* caRenderer = [[CARenderer rendererWithCGLContext:mOpenGLContext - options:nil] retain]; - if (caRenderer == nil) { - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - CALayer* wrapperCALayer = [[CALayer layer] retain]; - if (wrapperCALayer == nil) { - [caRenderer release]; - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - - mCARenderer = caRenderer; - mWrapperCALayer = wrapperCALayer; - caRenderer.layer = wrapperCALayer; - [wrapperCALayer addSublayer:(CALayer*)aCALayer]; - mContentsScaleFactor = aContentsScaleFactor; - size_t intScaleFactor = ceil(mContentsScaleFactor); - SetBounds(aWidth, aHeight); - - // We target rendering to a CGImage if no shared IOSurface are given. - if (!mIOSurface) { - mCGData = malloc(aWidth*intScaleFactor*aHeight*4*intScaleFactor); - if (!mCGData) { - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - memset(mCGData, 0, aWidth*intScaleFactor*aHeight*4*intScaleFactor); - - CGDataProviderRef dataProvider = nullptr; - dataProvider = ::CGDataProviderCreateWithData(mCGData, - mCGData, aHeight*intScaleFactor*aWidth*4*intScaleFactor, - cgdata_release_callback); - if (!dataProvider) { - cgdata_release_callback(mCGData, mCGData, - aHeight*intScaleFactor*aWidth*4*intScaleFactor); - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - - CGColorSpaceRef colorSpace = CreateSystemColorSpace(); - - mCGImage = ::CGImageCreate(aWidth * intScaleFactor, aHeight * intScaleFactor, - 8, 32, aWidth * intScaleFactor * 4, colorSpace, - kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, - dataProvider, nullptr, true, kCGRenderingIntentDefault); - - ::CGDataProviderRelease(dataProvider); - ::CGColorSpaceRelease(colorSpace); - if (!mCGImage) { - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - } - - CGLContextObj oldContext = ::CGLGetCurrentContext(); - ::CGLSetCurrentContext(mOpenGLContext); - - if (mIOSurface) { - // Create the IOSurface mapped texture. - ::glGenTextures(1, &mIOTexture); - ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, mIOTexture); - ::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - ::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - MacIOSurfaceLib::CGLTexImageIOSurface2D(mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB, - GL_RGBA, aWidth * intScaleFactor, - aHeight * intScaleFactor, - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, - mIOSurface->mIOSurfacePtr, 0); - ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); - } else { - ::glGenTextures(1, &mFBOTexture); - ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, mFBOTexture); - ::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - ::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); - } - - // Create the fbo - ::glGenFramebuffersEXT(1, &mFBO); - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); - if (mIOSurface) { - ::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_RECTANGLE_ARB, mIOTexture, 0); - } else { - ::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_RECTANGLE_ARB, mFBOTexture, 0); - } - - - // Make sure that the Framebuffer configuration is supported on the client machine - GLenum fboStatus; - fboStatus = ::glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (fboStatus != GL_FRAMEBUFFER_COMPLETE_EXT) { - NS_ERROR("FBO not supported"); - if (oldContext) - ::CGLSetCurrentContext(oldContext); - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - - SetViewport(aWidth, aHeight); - - GLenum result = ::glGetError(); - if (result != GL_NO_ERROR) { - NS_ERROR("Unexpected OpenGL Error"); - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - if (oldContext) - ::CGLSetCurrentContext(oldContext); - return NS_ERROR_FAILURE; - } - - if (oldContext) - ::CGLSetCurrentContext(oldContext); - - return NS_OK; -} - -void nsCARenderer::SetBounds(int aWidth, int aHeight) { - CARenderer* caRenderer = (CARenderer*)mCARenderer; - CALayer* wrapperLayer = (CALayer*)mWrapperCALayer; - NSArray* sublayers = [wrapperLayer sublayers]; - CALayer* pluginLayer = (CALayer*) [sublayers objectAtIndex:0]; - - // Create a transaction and disable animations - // to make the position update instant. - [CATransaction begin]; - NSMutableDictionary *newActions = - [[NSMutableDictionary alloc] initWithObjectsAndKeys: - [NSNull null], @"onOrderIn", - [NSNull null], @"onOrderOut", - [NSNull null], @"sublayers", - [NSNull null], @"contents", - [NSNull null], @"position", - [NSNull null], @"bounds", - nil]; - wrapperLayer.actions = newActions; - [newActions release]; - - // If we're in HiDPI mode, mContentsScaleFactor will (presumably) be 2.0. - // For some reason, to make things work properly in HiDPI mode we need to - // make caRenderer's 'bounds' and 'layer' different sizes -- to set 'bounds' - // to the size of 'layer's backing store. And to avoid this possibly - // confusing the plugin, we need to hide it's effects from the plugin by - // making pluginLayer (usually the CALayer* provided by the plugin) a - // sublayer of our own wrapperLayer (see bug 829284). - size_t intScaleFactor = ceil(mContentsScaleFactor); - [CATransaction setValue: [NSNumber numberWithFloat:0.0f] forKey: kCATransactionAnimationDuration]; - [CATransaction setValue: (id) kCFBooleanTrue forKey: kCATransactionDisableActions]; - [wrapperLayer setBounds:CGRectMake(0, 0, aWidth, aHeight)]; - [wrapperLayer setPosition:CGPointMake(aWidth/2.0, aHeight/2.0)]; - [pluginLayer setBounds:CGRectMake(0, 0, aWidth, aHeight)]; - [pluginLayer setFrame:CGRectMake(0, 0, aWidth, aHeight)]; - caRenderer.bounds = CGRectMake(0, 0, aWidth * intScaleFactor, aHeight * intScaleFactor); - if (mContentsScaleFactor != 1.0) { - CGAffineTransform affineTransform = [wrapperLayer affineTransform]; - affineTransform.a = mContentsScaleFactor; - affineTransform.d = mContentsScaleFactor; - affineTransform.tx = ((double)aWidth)/mContentsScaleFactor; - affineTransform.ty = ((double)aHeight)/mContentsScaleFactor; - [wrapperLayer setAffineTransform:affineTransform]; - } else { - // These settings are the default values. But they might have been - // changed as above if we were previously running in a HiDPI mode - // (i.e. if we just switched from that to a non-HiDPI mode). - [wrapperLayer setAffineTransform:CGAffineTransformIdentity]; - } - [CATransaction commit]; -} - -void nsCARenderer::SetViewport(int aWidth, int aHeight) { - size_t intScaleFactor = ceil(mContentsScaleFactor); - aWidth *= intScaleFactor; - aHeight *= intScaleFactor; - - ::glViewport(0.0, 0.0, aWidth, aHeight); - ::glMatrixMode(GL_PROJECTION); - ::glLoadIdentity(); - ::glOrtho (0.0, aWidth, 0.0, aHeight, -1, 1); - - // Render upside down to speed up CGContextDrawImage - ::glTranslatef(0.0f, aHeight, 0.0); - ::glScalef(1.0, -1.0, 1.0); -} - -void nsCARenderer::AttachIOSurface(MacIOSurface *aSurface) { - if (mIOSurface && - aSurface->GetIOSurfaceID() == mIOSurface->GetIOSurfaceID()) { - return; - } - - mIOSurface = aSurface; - - // Update the framebuffer and viewport - if (mCARenderer) { - CARenderer* caRenderer = (CARenderer*)mCARenderer; - size_t intScaleFactor = ceil(mContentsScaleFactor); - int width = caRenderer.bounds.size.width / intScaleFactor; - int height = caRenderer.bounds.size.height / intScaleFactor; - - CGLContextObj oldContext = ::CGLGetCurrentContext(); - ::CGLSetCurrentContext(mOpenGLContext); - ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, mIOTexture); - MacIOSurfaceLib::CGLTexImageIOSurface2D(mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB, - GL_RGBA, mIOSurface->GetDevicePixelWidth(), - mIOSurface->GetDevicePixelHeight(), - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, - mIOSurface->mIOSurfacePtr, 0); - ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); - - // Rebind the FBO to make it live - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); - - if (static_cast<int>(mIOSurface->GetWidth()) != width || - static_cast<int>(mIOSurface->GetHeight()) != height) { - width = mIOSurface->GetWidth(); - height = mIOSurface->GetHeight(); - SetBounds(width, height); - SetViewport(width, height); - } - - if (oldContext) { - ::CGLSetCurrentContext(oldContext); - } - } -} - -IOSurfaceID nsCARenderer::GetIOSurfaceID() { - if (!mIOSurface) { - return 0; - } - - return mIOSurface->GetIOSurfaceID(); -} - -nsresult nsCARenderer::Render(int aWidth, int aHeight, - double aContentsScaleFactor, - CGImageRef *aOutCGImage) { - if (!aOutCGImage && !mIOSurface) { - NS_ERROR("No target destination for rendering"); - } else if (aOutCGImage) { - // We are expected to return a CGImageRef, we will set - // it to nullptr in case we fail before the image is ready. - *aOutCGImage = nullptr; - } - - if (aWidth == 0 || aHeight == 0 || aContentsScaleFactor <= 0) - return NS_OK; - - if (!mCARenderer || !mWrapperCALayer) { - return NS_ERROR_FAILURE; - } - - CARenderer* caRenderer = (CARenderer*)mCARenderer; - CALayer* wrapperLayer = (CALayer*)mWrapperCALayer; - size_t intScaleFactor = ceil(aContentsScaleFactor); - int renderer_width = caRenderer.bounds.size.width / intScaleFactor; - int renderer_height = caRenderer.bounds.size.height / intScaleFactor; - - if (renderer_width != aWidth || renderer_height != aHeight || - mContentsScaleFactor != aContentsScaleFactor) { - // XXX: This should be optimized to not rescale the buffer - // if we are resizing down. - // caLayer may be the CALayer* provided by the plugin, so we need to - // preserve it across the call to Destroy(). - NSArray* sublayers = [wrapperLayer sublayers]; - CALayer* caLayer = (CALayer*) [sublayers objectAtIndex:0]; - // mIOSurface is set by AttachIOSurface(), not by SetupRenderer(). So - // since it may have been set by a prior call to AttachIOSurface(), we - // need to preserve it across the call to Destroy(). - RefPtr<MacIOSurface> ioSurface = mIOSurface; - Destroy(); - mIOSurface = ioSurface; - if (SetupRenderer(caLayer, aWidth, aHeight, aContentsScaleFactor, - mAllowOfflineRenderer) != NS_OK) { - return NS_ERROR_FAILURE; - } - - caRenderer = (CARenderer*)mCARenderer; - } - - CGLContextObj oldContext = ::CGLGetCurrentContext(); - ::CGLSetCurrentContext(mOpenGLContext); - if (!mIOSurface) { - // If no shared IOSurface is given render to our own - // texture for readback. - ::glGenTextures(1, &mFBOTexture); - } - - GLenum result = ::glGetError(); - if (result != GL_NO_ERROR) { - NS_ERROR("Unexpected OpenGL Error"); - Destroy(); - if (oldContext) - ::CGLSetCurrentContext(oldContext); - return NS_ERROR_FAILURE; - } - - ::glClearColor(0.0, 0.0, 0.0, 0.0); - ::glClear(GL_COLOR_BUFFER_BIT); - - [CATransaction commit]; - double caTime = ::CACurrentMediaTime(); - [caRenderer beginFrameAtTime:caTime timeStamp:nullptr]; - [caRenderer addUpdateRect:CGRectMake(0,0, aWidth * intScaleFactor, - aHeight * intScaleFactor)]; - [caRenderer render]; - [caRenderer endFrame]; - - // Read the data back either to the IOSurface or mCGImage. - if (mIOSurface) { - ::glFlush(); - } else { - ::glPixelStorei(GL_PACK_ALIGNMENT, 4); - ::glPixelStorei(GL_PACK_ROW_LENGTH, 0); - ::glPixelStorei(GL_PACK_SKIP_ROWS, 0); - ::glPixelStorei(GL_PACK_SKIP_PIXELS, 0); - - ::glReadPixels(0.0f, 0.0f, aWidth * intScaleFactor, - aHeight * intScaleFactor, - GL_BGRA, GL_UNSIGNED_BYTE, - mCGData); - - *aOutCGImage = mCGImage; - } - - if (oldContext) { - ::CGLSetCurrentContext(oldContext); - } - - return NS_OK; -} - -nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext, - MacIOSurface *surf, - CGColorSpaceRef aColorSpace, - int aX, int aY, - size_t aWidth, size_t aHeight) { - surf->Lock(); - size_t bytesPerRow = surf->GetBytesPerRow(); - size_t ioWidth = surf->GetWidth(); - size_t ioHeight = surf->GetHeight(); - - // We get rendering glitches if we use a width/height that falls - // outside of the IOSurface. - if (aWidth + aX > ioWidth) - aWidth = ioWidth - aX; - if (aHeight + aY > ioHeight) - aHeight = ioHeight - aY; - - if (aX < 0 || static_cast<size_t>(aX) >= ioWidth || - aY < 0 || static_cast<size_t>(aY) >= ioHeight) { - surf->Unlock(); - return NS_ERROR_FAILURE; - } - - void* ioData = surf->GetBaseAddress(); - double scaleFactor = surf->GetContentsScaleFactor(); - size_t intScaleFactor = ceil(surf->GetContentsScaleFactor()); - CGDataProviderRef dataProvider = ::CGDataProviderCreateWithData(ioData, - ioData, ioHeight*intScaleFactor*(bytesPerRow)*4, - nullptr); //No release callback - if (!dataProvider) { - surf->Unlock(); - return NS_ERROR_FAILURE; - } - - CGImageRef cgImage = ::CGImageCreate(ioWidth * intScaleFactor, - ioHeight * intScaleFactor, 8, 32, bytesPerRow, aColorSpace, - kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, - dataProvider, nullptr, true, kCGRenderingIntentDefault); - ::CGDataProviderRelease(dataProvider); - if (!cgImage) { - surf->Unlock(); - return NS_ERROR_FAILURE; - } - CGImageRef subImage = ::CGImageCreateWithImageInRect(cgImage, - ::CGRectMake(aX * scaleFactor, - aY * scaleFactor, - aWidth * scaleFactor, - aHeight * scaleFactor)); - if (!subImage) { - ::CGImageRelease(cgImage); - surf->Unlock(); - return NS_ERROR_FAILURE; - } - - ::CGContextScaleCTM(aContext, 1.0f, -1.0f); - ::CGContextDrawImage(aContext, - CGRectMake(aX * scaleFactor, - (-(CGFloat)aY - (CGFloat)aHeight) * scaleFactor, - aWidth * scaleFactor, - aHeight * scaleFactor), - subImage); - - ::CGImageRelease(subImage); - ::CGImageRelease(cgImage); - surf->Unlock(); - return NS_OK; -} - -void nsCARenderer::DetachCALayer() { - CALayer* wrapperLayer = (CALayer*)mWrapperCALayer; - NSArray* sublayers = [wrapperLayer sublayers]; - CALayer* oldLayer = (CALayer*) [sublayers objectAtIndex:0]; - [oldLayer removeFromSuperlayer]; -} - -void nsCARenderer::AttachCALayer(void *aCALayer) { - CALayer* wrapperLayer = (CALayer*)mWrapperCALayer; - NSArray* sublayers = [wrapperLayer sublayers]; - CALayer* oldLayer = (CALayer*) [sublayers objectAtIndex:0]; - [oldLayer removeFromSuperlayer]; - [wrapperLayer addSublayer:(CALayer*)aCALayer]; -} - -#ifdef DEBUG - -int sSaveToDiskSequence = 0; -void nsCARenderer::SaveToDisk(MacIOSurface *surf) { - surf->Lock(); - size_t bytesPerRow = surf->GetBytesPerRow(); - size_t ioWidth = surf->GetWidth(); - size_t ioHeight = surf->GetHeight(); - void* ioData = surf->GetBaseAddress(); - CGDataProviderRef dataProvider = ::CGDataProviderCreateWithData(ioData, - ioData, ioHeight*(bytesPerRow)*4, - nullptr); //No release callback - if (!dataProvider) { - surf->Unlock(); - return; - } - - CGColorSpaceRef colorSpace = CreateSystemColorSpace(); - CGImageRef cgImage = ::CGImageCreate(ioWidth, ioHeight, 8, 32, bytesPerRow, - colorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, - dataProvider, nullptr, true, kCGRenderingIntentDefault); - ::CGDataProviderRelease(dataProvider); - ::CGColorSpaceRelease(colorSpace); - if (!cgImage) { - surf->Unlock(); - return; - } - - char cstr[1000]; - SprintfLiteral(cstr, "file:///Users/benoitgirard/debug/iosurface_%i.png", ++sSaveToDiskSequence); - - CFStringRef cfStr = ::CFStringCreateWithCString(kCFAllocatorDefault, cstr, kCFStringEncodingMacRoman); - - printf("Exporting: %s\n", cstr); - CFURLRef url = ::CFURLCreateWithString( nullptr, cfStr, nullptr); - ::CFRelease(cfStr); - - CFStringRef type = kUTTypePNG; - size_t count = 1; - CFDictionaryRef options = nullptr; - CGImageDestinationRef dest = ::CGImageDestinationCreateWithURL(url, type, count, options); - ::CFRelease(url); - - ::CGImageDestinationAddImage(dest, cgImage, nullptr); - - ::CGImageDestinationFinalize(dest); - ::CFRelease(dest); - ::CGImageRelease(cgImage); - - surf->Unlock(); - - return; - -} - -#endif diff --git a/gfx/2d/ScaledFontMac.cpp b/gfx/2d/ScaledFontMac.cpp deleted file mode 100644 index 6baf257826..0000000000 --- a/gfx/2d/ScaledFontMac.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * 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 "ScaledFontMac.h" -#ifdef USE_SKIA -#include "PathSkia.h" -#include "skia/include/core/SkPaint.h" -#include "skia/include/core/SkPath.h" -#include "skia/include/ports/SkTypeface_mac.h" -#endif -#include <vector> -#include <dlfcn.h> -#ifdef MOZ_WIDGET_UIKIT -#include <CoreFoundation/CoreFoundation.h> -#endif - -#ifdef MOZ_WIDGET_COCOA -// prototype for private API -extern "C" { -CGPathRef CGFontGetGlyphPath(CGFontRef fontRef, CGAffineTransform *textTransform, int unknown, CGGlyph glyph); -}; -#endif - -#ifdef USE_CAIRO_SCALED_FONT -#include "cairo-quartz.h" -#endif - -namespace mozilla { -namespace gfx { - -ScaledFontMac::CTFontDrawGlyphsFuncT* ScaledFontMac::CTFontDrawGlyphsPtr = nullptr; -bool ScaledFontMac::sSymbolLookupDone = false; - -ScaledFontMac::ScaledFontMac(CGFontRef aFont, Float aSize) - : ScaledFontBase(aSize) -{ - if (!sSymbolLookupDone) { - CTFontDrawGlyphsPtr = - (CTFontDrawGlyphsFuncT*)dlsym(RTLD_DEFAULT, "CTFontDrawGlyphs"); - sSymbolLookupDone = true; - } - - // XXX: should we be taking a reference - mFont = CGFontRetain(aFont); - if (CTFontDrawGlyphsPtr != nullptr) { - // only create mCTFont if we're going to be using the CTFontDrawGlyphs API - mCTFont = CTFontCreateWithGraphicsFont(aFont, aSize, nullptr, nullptr); - } else { - mCTFont = nullptr; - } -} - -ScaledFontMac::~ScaledFontMac() -{ - if (mCTFont) { - CFRelease(mCTFont); - } - CGFontRelease(mFont); -} - -#ifdef USE_SKIA -SkTypeface* ScaledFontMac::GetSkTypeface() -{ - if (!mTypeface) { - if (mCTFont) { - mTypeface = SkCreateTypefaceFromCTFont(mCTFont); - } else { - CTFontRef fontFace = CTFontCreateWithGraphicsFont(mFont, mSize, nullptr, nullptr); - mTypeface = SkCreateTypefaceFromCTFont(fontFace); - CFRelease(fontFace); - } - } - return mTypeface; -} -#endif - -// private API here are the public options on OS X -// CTFontCreatePathForGlyph -// ATSUGlyphGetCubicPaths -// we've used this in cairo sucessfully for some time. -// Note: cairo dlsyms it. We could do that but maybe it's -// safe just to use? - -already_AddRefed<Path> -ScaledFontMac::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget) -{ - return ScaledFontBase::GetPathForGlyphs(aBuffer, aTarget); -} - -uint32_t -CalcTableChecksum(const uint32_t *tableStart, uint32_t length, bool skipChecksumAdjust = false) -{ - uint32_t sum = 0L; - const uint32_t *table = tableStart; - const uint32_t *end = table+((length+3) & ~3) / sizeof(uint32_t); - while (table < end) { - if (skipChecksumAdjust && (table - tableStart) == 2) { - table++; - } else { - sum += CFSwapInt32BigToHost(*table++); - } - } - return sum; -} - -struct TableRecord { - uint32_t tag; - uint32_t checkSum; - uint32_t offset; - uint32_t length; - CFDataRef data; -}; - -int maxPow2LessThan(int a) -{ - int x = 1; - int shift = 0; - while ((x<<(shift+1)) < a) { - shift++; - } - return shift; -} - -struct writeBuf -{ - explicit writeBuf(int size) - { - this->data = new unsigned char [size]; - this->offset = 0; - } - ~writeBuf() { - delete this->data; - } - - template <class T> - void writeElement(T a) - { - *reinterpret_cast<T*>(&this->data[this->offset]) = a; - this->offset += sizeof(T); - } - - void writeMem(const void *data, unsigned long length) - { - memcpy(&this->data[this->offset], data, length); - this->offset += length; - } - - void align() - { - while (this->offset & 3) { - this->data[this->offset] = 0; - this->offset++; - } - } - - unsigned char *data; - int offset; -}; - -bool -ScaledFontMac::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton) -{ - // We'll reconstruct a TTF font from the tables we can get from the CGFont - CFArrayRef tags = CGFontCopyTableTags(mFont); - CFIndex count = CFArrayGetCount(tags); - - TableRecord *records = new TableRecord[count]; - uint32_t offset = 0; - offset += sizeof(uint32_t)*3; - offset += sizeof(uint32_t)*4*count; - bool CFF = false; - for (CFIndex i = 0; i<count; i++) { - uint32_t tag = (uint32_t)(uintptr_t)CFArrayGetValueAtIndex(tags, i); - if (tag == 0x43464620) // 'CFF ' - CFF = true; - CFDataRef data = CGFontCopyTableForTag(mFont, tag); - records[i].tag = tag; - records[i].offset = offset; - records[i].data = data; - records[i].length = CFDataGetLength(data); - bool skipChecksumAdjust = (tag == 0x68656164); // 'head' - records[i].checkSum = CalcTableChecksum(reinterpret_cast<const uint32_t*>(CFDataGetBytePtr(data)), - records[i].length, skipChecksumAdjust); - offset += records[i].length; - // 32 bit align the tables - offset = (offset + 3) & ~3; - } - CFRelease(tags); - - struct writeBuf buf(offset); - // write header/offset table - if (CFF) { - buf.writeElement(CFSwapInt32HostToBig(0x4f54544f)); - } else { - buf.writeElement(CFSwapInt32HostToBig(0x00010000)); - } - buf.writeElement(CFSwapInt16HostToBig(count)); - buf.writeElement(CFSwapInt16HostToBig((1<<maxPow2LessThan(count))*16)); - buf.writeElement(CFSwapInt16HostToBig(maxPow2LessThan(count))); - buf.writeElement(CFSwapInt16HostToBig(count*16-((1<<maxPow2LessThan(count))*16))); - - // write table record entries - for (CFIndex i = 0; i<count; i++) { - buf.writeElement(CFSwapInt32HostToBig(records[i].tag)); - buf.writeElement(CFSwapInt32HostToBig(records[i].checkSum)); - buf.writeElement(CFSwapInt32HostToBig(records[i].offset)); - buf.writeElement(CFSwapInt32HostToBig(records[i].length)); - } - - // write tables - int checkSumAdjustmentOffset = 0; - for (CFIndex i = 0; i<count; i++) { - if (records[i].tag == 0x68656164) { - checkSumAdjustmentOffset = buf.offset + 2*4; - } - buf.writeMem(CFDataGetBytePtr(records[i].data), CFDataGetLength(records[i].data)); - buf.align(); - CFRelease(records[i].data); - } - delete[] records; - - // clear the checksumAdjust field before checksumming the whole font - memset(&buf.data[checkSumAdjustmentOffset], 0, sizeof(uint32_t)); - uint32_t fontChecksum = CFSwapInt32HostToBig(0xb1b0afba - CalcTableChecksum(reinterpret_cast<const uint32_t*>(buf.data), offset)); - // set checkSumAdjust to the computed checksum - memcpy(&buf.data[checkSumAdjustmentOffset], &fontChecksum, sizeof(fontChecksum)); - - // we always use an index of 0 - aDataCallback(buf.data, buf.offset, 0, mSize, aBaton); - - return true; - -} - -#ifdef USE_CAIRO_SCALED_FONT -cairo_font_face_t* -ScaledFontMac::GetCairoFontFace() -{ - MOZ_ASSERT(mFont); - return cairo_quartz_font_face_create_for_cgfont(mFont); -} -#endif - -} // namespace gfx -} // namespace mozilla diff --git a/gfx/2d/ScaledFontMac.h b/gfx/2d/ScaledFontMac.h deleted file mode 100644 index c141f96b26..0000000000 --- a/gfx/2d/ScaledFontMac.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * 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 MOZILLA_GFX_SCALEDFONTMAC_H_ -#define MOZILLA_GFX_SCALEDFONTMAC_H_ - -#ifdef MOZ_WIDGET_COCOA -#include <ApplicationServices/ApplicationServices.h> -#else -#include <CoreGraphics/CoreGraphics.h> -#include <CoreText/CoreText.h> -#endif - -#include "2D.h" - -#include "ScaledFontBase.h" - -namespace mozilla { -namespace gfx { - -class GlyphRenderingOptionsCG : public GlyphRenderingOptions -{ -public: - MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GlyphRenderingOptionsCG, override) - - explicit GlyphRenderingOptionsCG(const Color &aFontSmoothingBackgroundColor) - : mFontSmoothingBackgroundColor(aFontSmoothingBackgroundColor) - {} - - const Color &FontSmoothingBackgroundColor() const { return mFontSmoothingBackgroundColor; } - - virtual FontType GetType() const override { return FontType::MAC; } - -private: - Color mFontSmoothingBackgroundColor; -}; - -class ScaledFontMac : public ScaledFontBase -{ -public: - MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontMac) - ScaledFontMac(CGFontRef aFont, Float aSize); - virtual ~ScaledFontMac(); - - virtual FontType GetType() const { return FontType::MAC; } -#ifdef USE_SKIA - virtual SkTypeface* GetSkTypeface(); -#endif - virtual already_AddRefed<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget); - virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton); - -#ifdef USE_CAIRO_SCALED_FONT - cairo_font_face_t* GetCairoFontFace(); -#endif - -private: - friend class DrawTargetSkia; - CGFontRef mFont; - CTFontRef mCTFont; // only created if CTFontDrawGlyphs is available, otherwise null - - typedef void (CTFontDrawGlyphsFuncT)(CTFontRef, - const CGGlyph[], const CGPoint[], - size_t, CGContextRef); - - static bool sSymbolLookupDone; - -public: - // function pointer for CTFontDrawGlyphs, if available; - // initialized the first time a ScaledFontMac is created, - // so it will be valid by the time DrawTargetCG wants to use it - static CTFontDrawGlyphsFuncT* CTFontDrawGlyphsPtr; -}; - -} // namespace gfx -} // namespace mozilla - -#endif /* MOZILLA_GFX_SCALEDFONTMAC_H_ */ diff --git a/gfx/2d/moz.build b/gfx/2d/moz.build index 4f437d575a..7a80b1de2e 100644 --- a/gfx/2d/moz.build +++ b/gfx/2d/moz.build @@ -58,16 +58,7 @@ EXPORTS.mozilla.gfx += [ EXPORTS.mozilla.gfx += ['ssse3-scaler.h'] -if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'): - EXPORTS.mozilla.gfx += [ - 'MacIOSurface.h', - ] - SOURCES += [ - 'NativeFontResourceMac.cpp', - 'PathCG.cpp', - 'ScaledFontMac.cpp', - ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': SOURCES += [ 'DrawTargetD2D1.cpp', 'ExtendInputEffectD2D1.cpp', @@ -181,15 +172,6 @@ if CONFIG['CLANG_CXX']: if CONFIG['GNU_CXX']: CXXFLAGS += ['-Wno-error=shadow'] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - EXPORTS.mozilla.gfx += [ - 'QuartzSupport.h', - ] - SOURCES += [ - 'MacIOSurface.cpp', - 'QuartzSupport.mm', - ] - if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['BUILD_ARM_NEON']: SOURCES += ['BlurNEON.cpp'] SOURCES['BlurNEON.cpp'].flags += CONFIG['NEON_FLAGS'] diff --git a/ipc/glue/SharedMemoryBasic_mach.h b/ipc/glue/SharedMemoryBasic_mach.h deleted file mode 100644 index 2c54652413..0000000000 --- a/ipc/glue/SharedMemoryBasic_mach.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 mozilla_ipc_SharedMemoryBasic_mach_h -#define mozilla_ipc_SharedMemoryBasic_mach_h - -#include "base/file_descriptor_posix.h" -#include "base/process.h" - -#include "SharedMemory.h" -#include <mach/port.h> - -// -// This is a low-level wrapper around platform shared memory. Don't -// use it directly; use Shmem allocated through IPDL interfaces. -// - -class MachPortSender; -class ReceivePort; - -namespace mozilla { -namespace ipc { - -class SharedMemoryBasic final : public SharedMemoryCommon<mach_port_t> -{ -public: - static void SetupMachMemory(pid_t pid, - ReceivePort* listen_port, - MachPortSender* listen_port_ack, - MachPortSender* send_port, - ReceivePort* send_port_ack, - bool pidIsParent); - - static void CleanupForPid(pid_t pid); - - static void Shutdown(); - - SharedMemoryBasic(); - - virtual bool SetHandle(const Handle& aHandle) override; - - virtual bool Create(size_t aNbytes) override; - - virtual bool Map(size_t nBytes) override; - - virtual void CloseHandle() override; - - virtual void* memory() const override - { - return mMemory; - } - - virtual SharedMemoryType Type() const override - { - return TYPE_BASIC; - } - - static Handle NULLHandle() - { - return Handle(); - } - - - virtual bool IsHandleValid(const Handle &aHandle) const override; - - virtual bool ShareToProcess(base::ProcessId aProcessId, - Handle* aNewHandle) override; - -private: - ~SharedMemoryBasic(); - - void Unmap(); - mach_port_t mPort; - // Pointer to mapped region, null if unmapped. - void *mMemory; -}; - -} // namespace ipc -} // namespace mozilla - -#endif // ifndef mozilla_ipc_SharedMemoryBasic_mach_h diff --git a/ipc/glue/SharedMemoryBasic_mach.mm b/ipc/glue/SharedMemoryBasic_mach.mm deleted file mode 100644 index 3ee5a854d5..0000000000 --- a/ipc/glue/SharedMemoryBasic_mach.mm +++ /dev/null @@ -1,664 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- - */ -/* 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 <map> - -#include <mach/vm_map.h> -#include <mach/mach_port.h> -#include <mach/mach_vm.h> -#include <pthread.h> -#include <unistd.h> -#include "SharedMemoryBasic.h" -#include "chrome/common/mach_ipc_mac.h" - -#include "mozilla/StaticMutex.h" - -#ifdef DEBUG -#define LOG_ERROR(str, args...) \ - PR_BEGIN_MACRO \ - char *msg = PR_smprintf(str, ## args); \ - NS_WARNING(msg); \ - PR_smprintf_free(msg); \ - PR_END_MACRO -#else -#define LOG_ERROR(str, args...) do { /* nothing */ } while(0) -#endif - -#define CHECK_MACH_ERROR(kr, msg) \ - PR_BEGIN_MACRO \ - if (kr != KERN_SUCCESS) { \ - LOG_ERROR("%s %s (%x)\n", msg, mach_error_string(kr), kr); \ - return false; \ - } \ - PR_END_MACRO - -/* - * This code is responsible for sharing memory between processes. Memory can be - * shared between parent and child or between two children. Each memory region is - * referenced via a Mach port. Mach ports are also used for messaging when - * sharing a memory region. - * - * When the parent starts a child, it starts a thread whose only purpose is to - * communicate with the child about shared memory. Once the child has started, - * it starts a similar thread for communicating with the parent. Each side can - * communicate with the thread on the other side via Mach ports. When either - * side wants to share memory with the other, it sends a Mach message to the - * other side. Attached to the message is the port that references the shared - * memory region. When the other side receives the message, it automatically - * gets access to the region. It sends a reply (also via a Mach port) so that - * the originating side can continue. - * - * The two sides communicate using four ports. Two ports are used when the - * parent shares memory with the child. The other two are used when the child - * shares memory with the parent. One of these two ports is used for sending the - * "share" message and the other is used for the reply. - * - * If a child wants to share memory with another child, it sends a "GetPorts" - * message to the parent. The parent forwards this GetPorts message to the - * target child. The message includes some ports so that the children can talk - * directly. Both children start up a thread to communicate with the other child, - * similar to the way parent and child communicate. In the future, when these - * two children want to communicate, they re-use the channels that were created. - * - * When a child shuts down, the parent notifies all other children. Those - * children then have the opportunity to shut down any threads they might have - * been using to communicate directly with that child. - */ - -namespace mozilla { -namespace ipc { - -struct MemoryPorts { - MachPortSender* mSender; - ReceivePort* mReceiver; - - MemoryPorts() {} - MemoryPorts(MachPortSender* sender, ReceivePort* receiver) - : mSender(sender), mReceiver(receiver) {} -}; - -// Protects gMemoryCommPorts and gThreads. -static StaticMutex gMutex; - -static std::map<pid_t, MemoryPorts> gMemoryCommPorts; - -enum { - kGetPortsMsg = 1, - kSharePortsMsg, - kReturnIdMsg, - kReturnPortsMsg, - kShutdownMsg, - kCleanupMsg, -}; - -const int kTimeout = 1000; -const int kLongTimeout = 60 * kTimeout; - -pid_t gParentPid = 0; - -struct PIDPair { - pid_t mRequester; - pid_t mRequested; - - PIDPair(pid_t requester, pid_t requested) - : mRequester(requester), mRequested(requested) {} -}; - -struct ListeningThread { - pthread_t mThread; - MemoryPorts* mPorts; - - ListeningThread() {} - ListeningThread(pthread_t thread, MemoryPorts* ports) - : mThread(thread), mPorts(ports) {} -}; - -struct SharePortsReply { - uint64_t serial; - mach_port_t port; -}; - -std::map<pid_t, ListeningThread> gThreads; - -static void * -PortServerThread(void *argument); - - -static void -SetupMachMemory(pid_t pid, - ReceivePort* listen_port, - MachPortSender* listen_port_ack, - MachPortSender* send_port, - ReceivePort* send_port_ack, - bool pidIsParent) -{ - if (pidIsParent) { - gParentPid = pid; - } - MemoryPorts* listen_ports = new MemoryPorts(listen_port_ack, listen_port); - pthread_t thread; - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - int err = pthread_create(&thread, &attr, PortServerThread, listen_ports); - if (err) { - LOG_ERROR("pthread_create failed with %x\n", err); - return; - } - - gMutex.AssertCurrentThreadOwns(); - gThreads[pid] = ListeningThread(thread, listen_ports); - gMemoryCommPorts[pid] = MemoryPorts(send_port, send_port_ack); -} - -// Send two communication ports to another process along with the pid of the process that is -// listening on them. -bool -SendPortsMessage(MachPortSender* sender, - mach_port_t ports_in_receiver, - mach_port_t ports_out_receiver, - PIDPair pid_pair) -{ - MachSendMessage getPortsMsg(kGetPortsMsg); - if (!getPortsMsg.AddDescriptor(MachMsgPortDescriptor(ports_in_receiver))) { - LOG_ERROR("Adding descriptor to message failed"); - return false; - } - if (!getPortsMsg.AddDescriptor(MachMsgPortDescriptor(ports_out_receiver))) { - LOG_ERROR("Adding descriptor to message failed"); - return false; - } - - getPortsMsg.SetData(&pid_pair, sizeof(PIDPair)); - kern_return_t err = sender->SendMessage(getPortsMsg, kTimeout); - if (KERN_SUCCESS != err) { - LOG_ERROR("Error sending get ports message %s (%x)\n", mach_error_string(err), err); - return false; - } - return true; -} - -// Receive two communication ports from another process -bool -RecvPortsMessage(ReceivePort* receiver, mach_port_t* ports_in_sender, mach_port_t* ports_out_sender) -{ - MachReceiveMessage rcvPortsMsg; - kern_return_t err = receiver->WaitForMessage(&rcvPortsMsg, kTimeout); - if (KERN_SUCCESS != err) { - LOG_ERROR("Error receiving get ports message %s (%x)\n", mach_error_string(err), err); - } - if (rcvPortsMsg.GetTranslatedPort(0) == MACH_PORT_NULL) { - LOG_ERROR("GetTranslatedPort(0) failed"); - return false; - } - *ports_in_sender = rcvPortsMsg.GetTranslatedPort(0); - - if (rcvPortsMsg.GetTranslatedPort(1) == MACH_PORT_NULL) { - LOG_ERROR("GetTranslatedPort(1) failed"); - return false; - } - *ports_out_sender = rcvPortsMsg.GetTranslatedPort(1); - return true; -} - -// Send two communication ports to another process and receive two back -bool -RequestPorts(const MemoryPorts& request_ports, - mach_port_t ports_in_receiver, - mach_port_t* ports_in_sender, - mach_port_t* ports_out_sender, - mach_port_t ports_out_receiver, - PIDPair pid_pair) -{ - if (!SendPortsMessage(request_ports.mSender, ports_in_receiver, ports_out_receiver, pid_pair)) { - return false; - } - return RecvPortsMessage(request_ports.mReceiver, ports_in_sender, ports_out_sender); -} - -MemoryPorts* -GetMemoryPortsForPid(pid_t pid) -{ - gMutex.AssertCurrentThreadOwns(); - - if (gMemoryCommPorts.find(pid) == gMemoryCommPorts.end()) { - // We don't have the ports open to communicate with that pid, so we're going to - // ask our parent process over IPC to set them up for us. - if (gParentPid == 0) { - // If we're the top level parent process, we have no parent to ask. - LOG_ERROR("request for ports for pid %d, but we're the chrome process\n", pid); - return nullptr; - } - const MemoryPorts& parent = gMemoryCommPorts[gParentPid]; - - // Create two receiving ports in this process to send to the parent. One will be used for - // for listening for incoming memory to be shared, the other for getting the Handle of - // memory we share to the other process. - ReceivePort* ports_in_receiver = new ReceivePort(); - ReceivePort* ports_out_receiver = new ReceivePort(); - mach_port_t raw_ports_in_sender, raw_ports_out_sender; - if (!RequestPorts(parent, - ports_in_receiver->GetPort(), - &raw_ports_in_sender, - &raw_ports_out_sender, - ports_out_receiver->GetPort(), - PIDPair(getpid(), pid))) { - LOG_ERROR("failed to request ports\n"); - return nullptr; - } - // Our parent process sent us two ports, one is for sending new memory to, the other - // is for replying with the Handle when we receive new memory. - MachPortSender* ports_in_sender = new MachPortSender(raw_ports_in_sender); - MachPortSender* ports_out_sender = new MachPortSender(raw_ports_out_sender); - SetupMachMemory(pid, - ports_in_receiver, - ports_in_sender, - ports_out_sender, - ports_out_receiver, - false); - MOZ_ASSERT(gMemoryCommPorts.find(pid) != gMemoryCommPorts.end()); - } - return &gMemoryCommPorts.at(pid); -} - -// We just received a port representing a region of shared memory, reply to -// the process that set it with the mach_port_t that represents it in this process. -// That will be the Handle to be shared over normal IPC -void -HandleSharePortsMessage(MachReceiveMessage* rmsg, MemoryPorts* ports) -{ - mach_port_t port = rmsg->GetTranslatedPort(0); - uint64_t* serial = reinterpret_cast<uint64_t*>(rmsg->GetData()); - MachSendMessage msg(kReturnIdMsg); - // Construct the reply message, echoing the serial, and adding the port - SharePortsReply replydata; - replydata.port = port; - replydata.serial = *serial; - msg.SetData(&replydata, sizeof(SharePortsReply)); - kern_return_t err = ports->mSender->SendMessage(msg, kTimeout); - if (KERN_SUCCESS != err) { - LOG_ERROR("SendMessage failed 0x%x %s\n", err, mach_error_string(err)); - } -} - -// We were asked by another process to get communications ports to some process. Return -// those ports via an IPC message. -bool -SendReturnPortsMsg(MachPortSender* sender, - mach_port_t raw_ports_in_sender, - mach_port_t raw_ports_out_sender) -{ - MachSendMessage getPortsMsg(kReturnPortsMsg); - if (!getPortsMsg.AddDescriptor(MachMsgPortDescriptor(raw_ports_in_sender))) { - LOG_ERROR("Adding descriptor to message failed"); - return false; - } - - if (!getPortsMsg.AddDescriptor(MachMsgPortDescriptor(raw_ports_out_sender))) { - LOG_ERROR("Adding descriptor to message failed"); - return false; - } - kern_return_t err = sender->SendMessage(getPortsMsg, kTimeout); - if (KERN_SUCCESS != err) { - LOG_ERROR("Error sending get ports message %s (%x)\n", mach_error_string(err), err); - return false; - } - return true; -} - -// We were asked for communcations ports to a process that isn't us. Assuming that process -// is one of our children, forward that request on. -void -ForwardGetPortsMessage(MachReceiveMessage* rmsg, MemoryPorts* ports, PIDPair* pid_pair) -{ - if (rmsg->GetTranslatedPort(0) == MACH_PORT_NULL) { - LOG_ERROR("GetTranslatedPort(0) failed"); - return; - } - if (rmsg->GetTranslatedPort(1) == MACH_PORT_NULL) { - LOG_ERROR("GetTranslatedPort(1) failed"); - return; - } - mach_port_t raw_ports_in_sender, raw_ports_out_sender; - MemoryPorts* requestedPorts = GetMemoryPortsForPid(pid_pair->mRequested); - if (!requestedPorts) { - LOG_ERROR("failed to find port for process\n"); - return; - } - if (!RequestPorts(*requestedPorts, rmsg->GetTranslatedPort(0), &raw_ports_in_sender, - &raw_ports_out_sender, rmsg->GetTranslatedPort(1), *pid_pair)) { - LOG_ERROR("failed to request ports\n"); - return; - } - SendReturnPortsMsg(ports->mSender, raw_ports_in_sender, raw_ports_out_sender); -} - -// We receieved a message asking us to get communications ports for another process -void -HandleGetPortsMessage(MachReceiveMessage* rmsg, MemoryPorts* ports) -{ - PIDPair* pid_pair; - if (rmsg->GetDataLength() != sizeof(PIDPair)) { - LOG_ERROR("Improperly formatted message\n"); - return; - } - pid_pair = reinterpret_cast<PIDPair*>(rmsg->GetData()); - if (pid_pair->mRequested != getpid()) { - // This request is for ports to a process that isn't us, forward it to that process - ForwardGetPortsMessage(rmsg, ports, pid_pair); - } else { - if (rmsg->GetTranslatedPort(0) == MACH_PORT_NULL) { - LOG_ERROR("GetTranslatedPort(0) failed"); - return; - } - - if (rmsg->GetTranslatedPort(1) == MACH_PORT_NULL) { - LOG_ERROR("GetTranslatedPort(1) failed"); - return; - } - - MachPortSender* ports_in_sender = new MachPortSender(rmsg->GetTranslatedPort(0)); - MachPortSender* ports_out_sender = new MachPortSender(rmsg->GetTranslatedPort(1)); - - ReceivePort* ports_in_receiver = new ReceivePort(); - ReceivePort* ports_out_receiver = new ReceivePort(); - if (SendReturnPortsMsg(ports->mSender, ports_in_receiver->GetPort(), ports_out_receiver->GetPort())) { - SetupMachMemory(pid_pair->mRequester, - ports_out_receiver, - ports_out_sender, - ports_in_sender, - ports_in_receiver, - false); - } - } -} - -static void * -PortServerThread(void *argument) -{ - MemoryPorts* ports = static_cast<MemoryPorts*>(argument); - MachReceiveMessage child_message; - while (true) { - MachReceiveMessage rmsg; - kern_return_t err = ports->mReceiver->WaitForMessage(&rmsg, MACH_MSG_TIMEOUT_NONE); - if (err != KERN_SUCCESS) { - LOG_ERROR("Wait for message failed 0x%x %s\n", err, mach_error_string(err)); - continue; - } - if (rmsg.GetMessageID() == kShutdownMsg) { - delete ports->mSender; - delete ports->mReceiver; - delete ports; - return nullptr; - } - StaticMutexAutoLock smal(gMutex); - switch (rmsg.GetMessageID()) { - case kSharePortsMsg: - HandleSharePortsMessage(&rmsg, ports); - break; - case kGetPortsMsg: - HandleGetPortsMessage(&rmsg, ports); - break; - case kCleanupMsg: - if (gParentPid == 0) { - LOG_ERROR("Cleanup message not valid for parent process"); - continue; - } - - pid_t* pid; - if (rmsg.GetDataLength() != sizeof(pid_t)) { - LOG_ERROR("Improperly formatted message\n"); - continue; - } - pid = reinterpret_cast<pid_t*>(rmsg.GetData()); - SharedMemoryBasic::CleanupForPid(*pid); - break; - default: - LOG_ERROR("Unknown message\n"); - } - } -} - -void -SharedMemoryBasic::SetupMachMemory(pid_t pid, - ReceivePort* listen_port, - MachPortSender* listen_port_ack, - MachPortSender* send_port, - ReceivePort* send_port_ack, - bool pidIsParent) -{ - StaticMutexAutoLock smal(gMutex); - mozilla::ipc::SetupMachMemory(pid, listen_port, listen_port_ack, send_port, send_port_ack, pidIsParent); -} - -void -SharedMemoryBasic::Shutdown() -{ - StaticMutexAutoLock smal(gMutex); - - for (auto it = gThreads.begin(); it != gThreads.end(); ++it) { - MachSendMessage shutdownMsg(kShutdownMsg); - it->second.mPorts->mReceiver->SendMessageToSelf(shutdownMsg, kTimeout); - } - gThreads.clear(); - - for (auto it = gMemoryCommPorts.begin(); it != gMemoryCommPorts.end(); ++it) { - delete it->second.mSender; - delete it->second.mReceiver; - } - gMemoryCommPorts.clear(); -} - -void -SharedMemoryBasic::CleanupForPid(pid_t pid) -{ - if (gThreads.find(pid) == gThreads.end()) { - return; - } - const ListeningThread& listeningThread = gThreads[pid]; - MachSendMessage shutdownMsg(kShutdownMsg); - kern_return_t ret = listeningThread.mPorts->mReceiver->SendMessageToSelf(shutdownMsg, kTimeout); - if (ret != KERN_SUCCESS) { - LOG_ERROR("sending shutdown msg failed %s %x\n", mach_error_string(ret), ret); - } - gThreads.erase(pid); - - if (gParentPid == 0) { - // We're the parent. Broadcast the cleanup message to everyone else. - for (auto it = gMemoryCommPorts.begin(); it != gMemoryCommPorts.end(); ++it) { - MachSendMessage msg(kCleanupMsg); - msg.SetData(&pid, sizeof(pid)); - // We don't really care if this fails, we could be trying to send to an already shut down proc - it->second.mSender->SendMessage(msg, kTimeout); - } - } - - MemoryPorts& ports = gMemoryCommPorts[pid]; - delete ports.mSender; - delete ports.mReceiver; - gMemoryCommPorts.erase(pid); -} - -SharedMemoryBasic::SharedMemoryBasic() - : mPort(MACH_PORT_NULL) - , mMemory(nullptr) -{ -} - -SharedMemoryBasic::~SharedMemoryBasic() -{ - Unmap(); - CloseHandle(); -} - -bool -SharedMemoryBasic::SetHandle(const Handle& aHandle) -{ - MOZ_ASSERT(mPort == MACH_PORT_NULL, "already initialized"); - - mPort = aHandle; - return true; -} - -static inline void* -toPointer(mach_vm_address_t address) -{ - return reinterpret_cast<void*>(static_cast<uintptr_t>(address)); -} - -static inline mach_vm_address_t -toVMAddress(void* pointer) -{ - return static_cast<mach_vm_address_t>(reinterpret_cast<uintptr_t>(pointer)); -} - -bool -SharedMemoryBasic::Create(size_t size) -{ - mach_vm_address_t address; - - kern_return_t kr = mach_vm_allocate(mach_task_self(), &address, round_page(size), VM_FLAGS_ANYWHERE); - if (kr != KERN_SUCCESS) { - LOG_ERROR("Failed to allocate mach_vm_allocate shared memory (%zu bytes). %s (%x)\n", - size, mach_error_string(kr), kr); - return false; - } - - memory_object_size_t memoryObjectSize = round_page(size); - - kr = mach_make_memory_entry_64(mach_task_self(), - &memoryObjectSize, - address, - VM_PROT_DEFAULT, - &mPort, - MACH_PORT_NULL); - if (kr != KERN_SUCCESS) { - LOG_ERROR("Failed to make memory entry (%zu bytes). %s (%x)\n", - size, mach_error_string(kr), kr); - return false; - } - - mMemory = toPointer(address); - Mapped(size); - return true; -} - -bool -SharedMemoryBasic::Map(size_t size) -{ - if (mMemory) { - return true; - } - - if (MACH_PORT_NULL == mPort) { - return false; - } - - kern_return_t kr; - mach_vm_address_t address = 0; - - vm_prot_t vmProtection = VM_PROT_READ | VM_PROT_WRITE; - - kr = mach_vm_map(mach_task_self(), &address, round_page(size), 0, VM_FLAGS_ANYWHERE, - mPort, 0, false, vmProtection, vmProtection, VM_INHERIT_NONE); - if (kr != KERN_SUCCESS) { - LOG_ERROR("Failed to map shared memory (%zu bytes) into %x, port %x. %s (%x)\n", - size, mach_task_self(), mPort, mach_error_string(kr), kr); - return false; - } - - mMemory = toPointer(address); - Mapped(size); - return true; -} - -bool -SharedMemoryBasic::ShareToProcess(base::ProcessId pid, - Handle* aNewHandle) -{ - if (pid == getpid()) { - *aNewHandle = mPort; - return mach_port_mod_refs(mach_task_self(), *aNewHandle, MACH_PORT_RIGHT_SEND, 1) == KERN_SUCCESS; - } - StaticMutexAutoLock smal(gMutex); - - // Serially number the messages, to check whether - // the reply we get was meant for us. - static uint64_t serial = 0; - uint64_t my_serial = serial; - serial++; - - MemoryPorts* ports = GetMemoryPortsForPid(pid); - if (!ports) { - LOG_ERROR("Unable to get ports for process.\n"); - return false; - } - MachSendMessage smsg(kSharePortsMsg); - smsg.AddDescriptor(MachMsgPortDescriptor(mPort, MACH_MSG_TYPE_COPY_SEND)); - smsg.SetData(&my_serial, sizeof(uint64_t)); - kern_return_t err = ports->mSender->SendMessage(smsg, kTimeout); - if (err != KERN_SUCCESS) { - LOG_ERROR("sending port failed %s %x\n", mach_error_string(err), err); - return false; - } - MachReceiveMessage msg; - err = ports->mReceiver->WaitForMessage(&msg, kTimeout); - if (err != KERN_SUCCESS) { - LOG_ERROR("short timeout didn't get an id %s %x\n", mach_error_string(err), err); - err = ports->mReceiver->WaitForMessage(&msg, kLongTimeout); - - if (err != KERN_SUCCESS) { - LOG_ERROR("long timeout didn't get an id %s %x\n", mach_error_string(err), err); - return false; - } - } - if (msg.GetDataLength() != sizeof(SharePortsReply)) { - LOG_ERROR("Improperly formatted reply\n"); - return false; - } - SharePortsReply* msg_data = reinterpret_cast<SharePortsReply*>(msg.GetData()); - mach_port_t id = msg_data->port; - uint64_t serial_check = msg_data->serial; - if (serial_check != my_serial) { - LOG_ERROR("Serials do not match up: %d vs %d", serial_check, my_serial); - return false; - } - *aNewHandle = id; - return true; -} - -void -SharedMemoryBasic::Unmap() -{ - if (!mMemory) { - return; - } - vm_address_t address = toVMAddress(mMemory); - kern_return_t kr = vm_deallocate(mach_task_self(), address, round_page(mMappedSize)); - if (kr != KERN_SUCCESS) { - LOG_ERROR("Failed to deallocate shared memory. %s (%x)\n", mach_error_string(kr), kr); - return; - } - mMemory = nullptr; -} - -void -SharedMemoryBasic::CloseHandle() -{ - if (mPort != MACH_PORT_NULL) { - mach_port_deallocate(mach_task_self(), mPort); - mPort = MACH_PORT_NULL; - } -} - -bool -SharedMemoryBasic::IsHandleValid(const Handle& aHandle) const -{ - return aHandle > 0; -} - -} // namespace ipc -} // namespace mozilla diff --git a/ipc/glue/moz.build b/ipc/glue/moz.build index 426e796668..d882e3fbd1 100644 --- a/ipc/glue/moz.build +++ b/ipc/glue/moz.build @@ -77,13 +77,7 @@ else: 'CrossProcessMutex_unimplemented.cpp', ] -if CONFIG['OS_ARCH'] == 'Darwin': - EXPORTS.mozilla.ipc += ['SharedMemoryBasic_mach.h'] - SOURCES += [ - 'SharedMemoryBasic_mach.mm', - ] -else: - EXPORTS.mozilla.ipc += ['SharedMemoryBasic_chromium.h'] +EXPORTS.mozilla.ipc += ['SharedMemoryBasic_chromium.h'] if CONFIG['OS_ARCH'] == 'Linux': UNIFIED_SOURCES += [ diff --git a/media/ffvpx/config_darwin64.asm b/media/ffvpx/config_darwin64.asm deleted file mode 100644 index bfaa6f05f5..0000000000 --- a/media/ffvpx/config_darwin64.asm +++ /dev/null @@ -1,642 +0,0 @@ -; Automatically generated by configure - do not modify! -%define ARCH_AARCH64 0 -%define ARCH_ALPHA 0 -%define ARCH_ARM 0 -%define ARCH_AVR32 0 -%define ARCH_AVR32_AP 0 -%define ARCH_AVR32_UC 0 -%define ARCH_BFIN 0 -%define ARCH_IA64 0 -%define ARCH_M68K 0 -%define ARCH_MIPS 0 -%define ARCH_MIPS64 0 -%define ARCH_PARISC 0 -%define ARCH_PPC 0 -%define ARCH_PPC64 0 -%define ARCH_S390 0 -%define ARCH_SH4 0 -%define ARCH_SPARC 0 -%define ARCH_SPARC64 0 -%define ARCH_TILEGX 0 -%define ARCH_TILEPRO 0 -%define ARCH_TOMI 0 -%define ARCH_X86 1 -%define ARCH_X86_32 0 -%define ARCH_X86_64 1 -%define HAVE_ARMV5TE 0 -%define HAVE_ARMV6 0 -%define HAVE_ARMV6T2 0 -%define HAVE_ARMV8 0 -%define HAVE_NEON 0 -%define HAVE_VFP 0 -%define HAVE_VFPV3 0 -%define HAVE_SETEND 0 -%define HAVE_ALTIVEC 0 -%define HAVE_DCBZL 0 -%define HAVE_LDBRX 0 -%define HAVE_POWER8 0 -%define HAVE_PPC4XX 0 -%define HAVE_VSX 0 -%define HAVE_AESNI 1 -%define HAVE_AMD3DNOW 1 -%define HAVE_AMD3DNOWEXT 1 -%define HAVE_AVX 1 -%define HAVE_AVX2 1 -%define HAVE_AVX512 1 -%define HAVE_FMA3 1 -%define HAVE_FMA4 1 -%define HAVE_MMX 1 -%define HAVE_MMXEXT 1 -%define HAVE_SSE 1 -%define HAVE_SSE2 1 -%define HAVE_SSE3 1 -%define HAVE_SSE4 1 -%define HAVE_SSE42 1 -%define HAVE_SSSE3 1 -%define HAVE_XOP 1 -%define HAVE_CPUNOP 0 -%define HAVE_I686 1 -%define HAVE_MIPSFPU 0 -%define HAVE_MIPS32R2 0 -%define HAVE_MIPS32R5 0 -%define HAVE_MIPS64R2 0 -%define HAVE_MIPS32R6 0 -%define HAVE_MIPS64R6 0 -%define HAVE_MIPSDSP 0 -%define HAVE_MIPSDSPR2 0 -%define HAVE_MSA 0 -%define HAVE_LOONGSON2 0 -%define HAVE_LOONGSON3 0 -%define HAVE_MMI 0 -%define HAVE_ARMV5TE_EXTERNAL 0 -%define HAVE_ARMV6_EXTERNAL 0 -%define HAVE_ARMV6T2_EXTERNAL 0 -%define HAVE_ARMV8_EXTERNAL 0 -%define HAVE_NEON_EXTERNAL 0 -%define HAVE_VFP_EXTERNAL 0 -%define HAVE_VFPV3_EXTERNAL 0 -%define HAVE_SETEND_EXTERNAL 0 -%define HAVE_ALTIVEC_EXTERNAL 0 -%define HAVE_DCBZL_EXTERNAL 0 -%define HAVE_LDBRX_EXTERNAL 0 -%define HAVE_POWER8_EXTERNAL 0 -%define HAVE_PPC4XX_EXTERNAL 0 -%define HAVE_VSX_EXTERNAL 0 -%define HAVE_AESNI_EXTERNAL 1 -%define HAVE_AMD3DNOW_EXTERNAL 1 -%define HAVE_AMD3DNOWEXT_EXTERNAL 1 -%define HAVE_AVX_EXTERNAL 1 -%define HAVE_AVX2_EXTERNAL 1 -%define HAVE_AVX512_EXTERNAL 1 -%define HAVE_FMA3_EXTERNAL 1 -%define HAVE_FMA4_EXTERNAL 1 -%define HAVE_MMX_EXTERNAL 1 -%define HAVE_MMXEXT_EXTERNAL 1 -%define HAVE_SSE_EXTERNAL 1 -%define HAVE_SSE2_EXTERNAL 1 -%define HAVE_SSE3_EXTERNAL 1 -%define HAVE_SSE4_EXTERNAL 1 -%define HAVE_SSE42_EXTERNAL 1 -%define HAVE_SSSE3_EXTERNAL 1 -%define HAVE_XOP_EXTERNAL 1 -%define HAVE_CPUNOP_EXTERNAL 0 -%define HAVE_I686_EXTERNAL 0 -%define HAVE_MIPSFPU_EXTERNAL 0 -%define HAVE_MIPS32R2_EXTERNAL 0 -%define HAVE_MIPS32R5_EXTERNAL 0 -%define HAVE_MIPS64R2_EXTERNAL 0 -%define HAVE_MIPS32R6_EXTERNAL 0 -%define HAVE_MIPS64R6_EXTERNAL 0 -%define HAVE_MIPSDSP_EXTERNAL 0 -%define HAVE_MIPSDSPR2_EXTERNAL 0 -%define HAVE_MSA_EXTERNAL 0 -%define HAVE_LOONGSON2_EXTERNAL 0 -%define HAVE_LOONGSON3_EXTERNAL 0 -%define HAVE_MMI_EXTERNAL 0 -%define HAVE_ARMV5TE_INLINE 0 -%define HAVE_ARMV6_INLINE 0 -%define HAVE_ARMV6T2_INLINE 0 -%define HAVE_ARMV8_INLINE 0 -%define HAVE_NEON_INLINE 0 -%define HAVE_VFP_INLINE 0 -%define HAVE_VFPV3_INLINE 0 -%define HAVE_SETEND_INLINE 0 -%define HAVE_ALTIVEC_INLINE 0 -%define HAVE_DCBZL_INLINE 0 -%define HAVE_LDBRX_INLINE 0 -%define HAVE_POWER8_INLINE 0 -%define HAVE_PPC4XX_INLINE 0 -%define HAVE_VSX_INLINE 0 -%define HAVE_AESNI_INLINE 1 -%define HAVE_AMD3DNOW_INLINE 1 -%define HAVE_AMD3DNOWEXT_INLINE 1 -%define HAVE_AVX_INLINE 1 -%define HAVE_AVX2_INLINE 1 -%define HAVE_AVX512_INLINE 1 -%define HAVE_FMA3_INLINE 1 -%define HAVE_FMA4_INLINE 1 -%define HAVE_MMX_INLINE 1 -%define HAVE_MMXEXT_INLINE 1 -%define HAVE_SSE_INLINE 1 -%define HAVE_SSE2_INLINE 1 -%define HAVE_SSE3_INLINE 1 -%define HAVE_SSE4_INLINE 1 -%define HAVE_SSE42_INLINE 1 -%define HAVE_SSSE3_INLINE 1 -%define HAVE_XOP_INLINE 1 -%define HAVE_CPUNOP_INLINE 0 -%define HAVE_I686_INLINE 0 -%define HAVE_MIPSFPU_INLINE 0 -%define HAVE_MIPS32R2_INLINE 0 -%define HAVE_MIPS32R5_INLINE 0 -%define HAVE_MIPS64R2_INLINE 0 -%define HAVE_MIPS32R6_INLINE 0 -%define HAVE_MIPS64R6_INLINE 0 -%define HAVE_MIPSDSP_INLINE 0 -%define HAVE_MIPSDSPR2_INLINE 0 -%define HAVE_MSA_INLINE 0 -%define HAVE_LOONGSON2_INLINE 0 -%define HAVE_LOONGSON3_INLINE 0 -%define HAVE_MMI_INLINE 0 -%define HAVE_ALIGNED_STACK 1 -%define HAVE_FAST_64BIT 1 -%define HAVE_FAST_CLZ 1 -%define HAVE_FAST_CMOV 1 -%define HAVE_LOCAL_ALIGNED 1 -%define HAVE_SIMD_ALIGN_16 1 -%define HAVE_SIMD_ALIGN_32 1 -%define HAVE_SIMD_ALIGN_64 1 -%define HAVE_ATOMIC_CAS_PTR 0 -%define HAVE_MACHINE_RW_BARRIER 0 -%define HAVE_MEMORYBARRIER 0 -%define HAVE_MM_EMPTY 1 -%define HAVE_RDTSC 0 -%define HAVE_SEM_TIMEDWAIT 0 -%define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1 -%define HAVE_CABS 1 -%define HAVE_CEXP 1 -%define HAVE_INLINE_ASM 1 -%define HAVE_SYMVER 1 -%define HAVE_X86ASM 1 -%define HAVE_BIGENDIAN 0 -%define HAVE_FAST_UNALIGNED 1 -%define HAVE_ARPA_INET_H 1 -%define HAVE_ASM_TYPES_H 0 -%define HAVE_CDIO_PARANOIA_H 0 -%define HAVE_CDIO_PARANOIA_PARANOIA_H 0 -%define HAVE_CUDA_H 0 -%define HAVE_DISPATCH_DISPATCH_H 1 -%define HAVE_DEV_BKTR_IOCTL_BT848_H 0 -%define HAVE_DEV_BKTR_IOCTL_METEOR_H 0 -%define HAVE_DEV_IC_BT8XX_H 0 -%define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0 -%define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0 -%define HAVE_DIRECT_H 0 -%define HAVE_DIRENT_H 1 -%define HAVE_DXGIDEBUG_H 0 -%define HAVE_DXVA_H 0 -%define HAVE_ES2_GL_H 0 -%define HAVE_GSM_H 0 -%define HAVE_IO_H 0 -%define HAVE_LINUX_PERF_EVENT_H 0 -%define HAVE_MACHINE_IOCTL_BT848_H 0 -%define HAVE_MACHINE_IOCTL_METEOR_H 0 -%define HAVE_OPENCV2_CORE_CORE_C_H 0 -%define HAVE_OPENGL_GL3_H 0 -%define HAVE_POLL_H 1 -%define HAVE_SYS_PARAM_H 1 -%define HAVE_SYS_RESOURCE_H 1 -%define HAVE_SYS_SELECT_H 1 -%define HAVE_SYS_SOUNDCARD_H 0 -%define HAVE_SYS_TIME_H 1 -%define HAVE_SYS_UN_H 1 -%define HAVE_SYS_VIDEOIO_H 0 -%define HAVE_TERMIOS_H 1 -%define HAVE_UDPLITE_H 0 -%define HAVE_UNISTD_H 1 -%define HAVE_VALGRIND_VALGRIND_H 0 -%define HAVE_WINDOWS_H 0 -%define HAVE_WINSOCK2_H 0 -%define HAVE_INTRINSICS_NEON 0 -%define HAVE_ATANF 1 -%define HAVE_ATAN2F 1 -%define HAVE_CBRT 1 -%define HAVE_CBRTF 1 -%define HAVE_COPYSIGN 1 -%define HAVE_COSF 1 -%define HAVE_ERF 1 -%define HAVE_EXP2 1 -%define HAVE_EXP2F 1 -%define HAVE_EXPF 1 -%define HAVE_HYPOT 1 -%define HAVE_ISFINITE 1 -%define HAVE_ISINF 1 -%define HAVE_ISNAN 1 -%define HAVE_LDEXPF 1 -%define HAVE_LLRINT 1 -%define HAVE_LLRINTF 1 -%define HAVE_LOG2 1 -%define HAVE_LOG2F 1 -%define HAVE_LOG10F 1 -%define HAVE_LRINT 1 -%define HAVE_LRINTF 1 -%define HAVE_POWF 1 -%define HAVE_RINT 1 -%define HAVE_ROUND 1 -%define HAVE_ROUNDF 1 -%define HAVE_SINF 1 -%define HAVE_TRUNC 1 -%define HAVE_TRUNCF 1 -%define HAVE_DOS_PATHS 0 -%define HAVE_LIBC_MSVCRT 0 -%define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0 -%define HAVE_SECTION_DATA_REL_RO 0 -%define HAVE_THREADS 1 -%define HAVE_UWP 0 -%define HAVE_WINRT 0 -%define HAVE_ACCESS 1 -%define HAVE_ALIGNED_MALLOC 0 -%define HAVE_CLOCK_GETTIME 1 -%define HAVE_CLOSESOCKET 0 -%define HAVE_COMMANDLINETOARGVW 0 -%define HAVE_FCNTL 1 -%define HAVE_GETADDRINFO 1 -%define HAVE_GETHRTIME 0 -%define HAVE_GETOPT 1 -%define HAVE_GETPROCESSAFFINITYMASK 0 -%define HAVE_GETPROCESSMEMORYINFO 0 -%define HAVE_GETPROCESSTIMES 0 -%define HAVE_GETRUSAGE 1 -%define HAVE_GETSYSTEMTIMEASFILETIME 0 -%define HAVE_GETTIMEOFDAY 1 -%define HAVE_GLOB 1 -%define HAVE_GLXGETPROCADDRESS 0 -%define HAVE_GMTIME_R 1 -%define HAVE_INET_ATON 1 -%define HAVE_ISATTY 1 -%define HAVE_KBHIT 0 -%define HAVE_LSTAT 1 -%define HAVE_LZO1X_999_COMPRESS 0 -%define HAVE_MACH_ABSOLUTE_TIME 1 -%define HAVE_MAPVIEWOFFILE 0 -%define HAVE_MKSTEMP 1 -%define HAVE_MMAP 1 -%define HAVE_MPROTECT 1 -%define HAVE_NANOSLEEP 1 -%define HAVE_PEEKNAMEDPIPE 0 -%define HAVE_PTHREAD_CANCEL 1 -%define HAVE_SCHED_GETAFFINITY 0 -%define HAVE_SECITEMIMPORT 0 -%define HAVE_SETCONSOLETEXTATTRIBUTE 0 -%define HAVE_SETCONSOLECTRLHANDLER 0 -%define HAVE_SETMODE 0 -%define HAVE_SETRLIMIT 1 -%define HAVE_SLEEP 0 -%define HAVE_STRERROR_R 1 -%define HAVE_SYSCONF 1 -%define HAVE_SYSCTL 1 -%define HAVE_USLEEP 1 -%define HAVE_UTGETOSTYPEFROMSTRING 0 -%define HAVE_VIRTUALALLOC 0 -%define HAVE_WGLGETPROCADDRESS 0 -%define HAVE_BCRYPT 0 -%define HAVE_VAAPI_DRM 0 -%define HAVE_VAAPI_X11 0 -%define HAVE_VDPAU_X11 0 -%define HAVE_PTHREADS 1 -%define HAVE_OS2THREADS 0 -%define HAVE_W32THREADS 0 -%define HAVE_AS_ARCH_DIRECTIVE 0 -%define HAVE_AS_DN_DIRECTIVE 0 -%define HAVE_AS_FPU_DIRECTIVE 0 -%define HAVE_AS_FUNC 0 -%define HAVE_AS_OBJECT_ARCH 0 -%define HAVE_ASM_MOD_Q 0 -%define HAVE_BLOCKS_EXTENSION 1 -%define HAVE_EBP_AVAILABLE 1 -%define HAVE_EBX_AVAILABLE 1 -%define HAVE_GNU_AS 0 -%define HAVE_GNU_WINDRES 0 -%define HAVE_IBM_ASM 0 -%define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1 -%define HAVE_INLINE_ASM_LABELS 1 -%define HAVE_INLINE_ASM_NONLOCAL_LABELS 1 -%define HAVE_PRAGMA_DEPRECATED 1 -%define HAVE_RSYNC_CONTIMEOUT 0 -%define HAVE_SYMVER_ASM_LABEL 1 -%define HAVE_SYMVER_GNU_ASM 0 -%define HAVE_VFP_ARGS 0 -%define HAVE_XFORM_ASM 0 -%define HAVE_XMM_CLOBBERS 1 -%define HAVE_KCMVIDEOCODECTYPE_HEVC 0 -%define HAVE_SOCKLEN_T 1 -%define HAVE_STRUCT_ADDRINFO 1 -%define HAVE_STRUCT_GROUP_SOURCE_REQ 1 -%define HAVE_STRUCT_IP_MREQ_SOURCE 1 -%define HAVE_STRUCT_IPV6_MREQ 1 -%define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1 -%define HAVE_STRUCT_POLLFD 1 -%define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1 -%define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0 -%define HAVE_STRUCT_SOCKADDR_IN6 1 -%define HAVE_STRUCT_SOCKADDR_SA_LEN 1 -%define HAVE_STRUCT_SOCKADDR_STORAGE 1 -%define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0 -%define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0 -%define HAVE_MAKEINFO 1 -%define HAVE_MAKEINFO_HTML 0 -%define HAVE_OPENCL_D3D11 0 -%define HAVE_OPENCL_DRM_ARM 0 -%define HAVE_OPENCL_DRM_BEIGNET 0 -%define HAVE_OPENCL_DXVA2 0 -%define HAVE_OPENCL_VAAPI_BEIGNET 0 -%define HAVE_OPENCL_VAAPI_INTEL_MEDIA 0 -%define HAVE_PERL 1 -%define HAVE_POD2MAN 1 -%define HAVE_TEXI2HTML 1 -%define CONFIG_DOC 0 -%define CONFIG_HTMLPAGES 1 -%define CONFIG_MANPAGES 1 -%define CONFIG_PODPAGES 1 -%define CONFIG_TXTPAGES 1 -%define CONFIG_AVIO_DIR_CMD_EXAMPLE 1 -%define CONFIG_AVIO_READING_EXAMPLE 1 -%define CONFIG_DECODE_AUDIO_EXAMPLE 1 -%define CONFIG_DECODE_VIDEO_EXAMPLE 1 -%define CONFIG_DEMUXING_DECODING_EXAMPLE 0 -%define CONFIG_ENCODE_AUDIO_EXAMPLE 1 -%define CONFIG_ENCODE_VIDEO_EXAMPLE 1 -%define CONFIG_EXTRACT_MVS_EXAMPLE 0 -%define CONFIG_FILTER_AUDIO_EXAMPLE 0 -%define CONFIG_FILTERING_AUDIO_EXAMPLE 0 -%define CONFIG_FILTERING_VIDEO_EXAMPLE 0 -%define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0 -%define CONFIG_HW_DECODE_EXAMPLE 0 -%define CONFIG_METADATA_EXAMPLE 0 -%define CONFIG_MUXING_EXAMPLE 0 -%define CONFIG_QSVDEC_EXAMPLE 0 -%define CONFIG_REMUXING_EXAMPLE 0 -%define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0 -%define CONFIG_SCALING_VIDEO_EXAMPLE 0 -%define CONFIG_TRANSCODE_AAC_EXAMPLE 0 -%define CONFIG_TRANSCODING_EXAMPLE 0 -%define CONFIG_VAAPI_ENCODE_EXAMPLE 0 -%define CONFIG_VAAPI_TRANSCODE_EXAMPLE 0 -%define CONFIG_AVISYNTH 0 -%define CONFIG_FREI0R 0 -%define CONFIG_LIBCDIO 0 -%define CONFIG_LIBRUBBERBAND 0 -%define CONFIG_LIBVIDSTAB 0 -%define CONFIG_LIBX264 0 -%define CONFIG_LIBX265 0 -%define CONFIG_LIBXAVS 0 -%define CONFIG_LIBXVID 0 -%define CONFIG_DECKLINK 0 -%define CONFIG_LIBNDI_NEWTEK 0 -%define CONFIG_LIBFDK_AAC 0 -%define CONFIG_OPENSSL 0 -%define CONFIG_LIBTLS 0 -%define CONFIG_GMP 0 -%define CONFIG_LIBOPENCORE_AMRNB 0 -%define CONFIG_LIBOPENCORE_AMRWB 0 -%define CONFIG_LIBVMAF 0 -%define CONFIG_LIBVO_AMRWBENC 0 -%define CONFIG_RKMPP 0 -%define CONFIG_LIBSMBCLIENT 0 -%define CONFIG_CHROMAPRINT 0 -%define CONFIG_GCRYPT 0 -%define CONFIG_GNUTLS 0 -%define CONFIG_JNI 0 -%define CONFIG_LADSPA 0 -%define CONFIG_LIBAOM 0 -%define CONFIG_LIBASS 0 -%define CONFIG_LIBBLURAY 0 -%define CONFIG_LIBBS2B 0 -%define CONFIG_LIBCACA 0 -%define CONFIG_LIBCELT 0 -%define CONFIG_LIBCODEC2 0 -%define CONFIG_LIBDC1394 0 -%define CONFIG_LIBDRM 0 -%define CONFIG_LIBFLITE 0 -%define CONFIG_LIBFONTCONFIG 0 -%define CONFIG_LIBFREETYPE 0 -%define CONFIG_LIBFRIBIDI 0 -%define CONFIG_LIBGME 0 -%define CONFIG_LIBGSM 0 -%define CONFIG_LIBIEC61883 0 -%define CONFIG_LIBILBC 0 -%define CONFIG_LIBJACK 0 -%define CONFIG_LIBKVAZAAR 0 -%define CONFIG_LIBMODPLUG 0 -%define CONFIG_LIBMP3LAME 0 -%define CONFIG_LIBMYSOFA 0 -%define CONFIG_LIBOPENCV 0 -%define CONFIG_LIBOPENH264 0 -%define CONFIG_LIBOPENJPEG 0 -%define CONFIG_LIBOPENMPT 0 -%define CONFIG_LIBOPUS 0 -%define CONFIG_LIBPULSE 0 -%define CONFIG_LIBRSVG 0 -%define CONFIG_LIBRTMP 0 -%define CONFIG_LIBSHINE 0 -%define CONFIG_LIBSMBCLIENT 0 -%define CONFIG_LIBSNAPPY 0 -%define CONFIG_LIBSOXR 0 -%define CONFIG_LIBSPEEX 0 -%define CONFIG_LIBSRT 0 -%define CONFIG_LIBSSH 0 -%define CONFIG_LIBTESSERACT 0 -%define CONFIG_LIBTHEORA 0 -%define CONFIG_LIBTWOLAME 0 -%define CONFIG_LIBV4L2 0 -%define CONFIG_LIBVORBIS 0 -%define CONFIG_LIBVPX 0 -%define CONFIG_LIBWAVPACK 0 -%define CONFIG_LIBWEBP 0 -%define CONFIG_LIBXML2 0 -%define CONFIG_LIBZIMG 0 -%define CONFIG_LIBZMQ 0 -%define CONFIG_LIBZVBI 0 -%define CONFIG_LV2 0 -%define CONFIG_MEDIACODEC 0 -%define CONFIG_OPENAL 0 -%define CONFIG_OPENGL 0 -%define CONFIG_ALSA 0 -%define CONFIG_APPKIT 1 -%define CONFIG_AVFOUNDATION 1 -%define CONFIG_BZLIB 1 -%define CONFIG_COREIMAGE 1 -%define CONFIG_ICONV 0 -%define CONFIG_LIBXCB 0 -%define CONFIG_LIBXCB_SHM 0 -%define CONFIG_LIBXCB_SHAPE 0 -%define CONFIG_LIBXCB_XFIXES 0 -%define CONFIG_LZMA 1 -%define CONFIG_SCHANNEL 0 -%define CONFIG_SDL2 0 -%define CONFIG_SECURETRANSPORT 0 -%define CONFIG_SNDIO 0 -%define CONFIG_XLIB 1 -%define CONFIG_ZLIB 1 -%define CONFIG_CUDA_SDK 0 -%define CONFIG_LIBNPP 0 -%define CONFIG_LIBMFX 0 -%define CONFIG_MMAL 0 -%define CONFIG_OMX 0 -%define CONFIG_OPENCL 0 -%define CONFIG_AMF 0 -%define CONFIG_AUDIOTOOLBOX 1 -%define CONFIG_CRYSTALHD 0 -%define CONFIG_CUDA 0 -%define CONFIG_CUVID 0 -%define CONFIG_D3D11VA 0 -%define CONFIG_DXVA2 0 -%define CONFIG_FFNVCODEC 0 -%define CONFIG_NVDEC 0 -%define CONFIG_NVENC 0 -%define CONFIG_VAAPI 0 -%define CONFIG_VDPAU 0 -%define CONFIG_VIDEOTOOLBOX 0 -%define CONFIG_V4L2_M2M 0 -%define CONFIG_XVMC 0 -%define CONFIG_FTRAPV 0 -%define CONFIG_GRAY 0 -%define CONFIG_HARDCODED_TABLES 0 -%define CONFIG_OMX_RPI 0 -%define CONFIG_RUNTIME_CPUDETECT 1 -%define CONFIG_SAFE_BITSTREAM_READER 1 -%define CONFIG_SHARED 1 -%define CONFIG_SMALL 0 -%define CONFIG_STATIC 0 -%define CONFIG_SWSCALE_ALPHA 1 -%define CONFIG_GPL 0 -%define CONFIG_NONFREE 0 -%define CONFIG_VERSION3 0 -%define CONFIG_AVCODEC 1 -%define CONFIG_AVDEVICE 0 -%define CONFIG_AVFILTER 0 -%define CONFIG_AVFORMAT 0 -%define CONFIG_AVRESAMPLE 0 -%define CONFIG_AVUTIL 1 -%define CONFIG_POSTPROC 0 -%define CONFIG_SWRESAMPLE 0 -%define CONFIG_SWSCALE 0 -%define CONFIG_FFPLAY 0 -%define CONFIG_FFPROBE 0 -%define CONFIG_FFMPEG 0 -%define CONFIG_DCT 0 -%define CONFIG_DWT 0 -%define CONFIG_ERROR_RESILIENCE 0 -%define CONFIG_FAAN 1 -%define CONFIG_FAST_UNALIGNED 1 -%define CONFIG_FFT 0 -%define CONFIG_LSP 0 -%define CONFIG_LZO 0 -%define CONFIG_MDCT 0 -%define CONFIG_PIXELUTILS 0 -%define CONFIG_NETWORK 0 -%define CONFIG_RDFT 0 -%define CONFIG_AUTODETECT 0 -%define CONFIG_FONTCONFIG 0 -%define CONFIG_LINUX_PERF 0 -%define CONFIG_MEMORY_POISONING 0 -%define CONFIG_NEON_CLOBBER_TEST 0 -%define CONFIG_OSSFUZZ 0 -%define CONFIG_PIC 1 -%define CONFIG_THUMB 0 -%define CONFIG_VALGRIND_BACKTRACE 0 -%define CONFIG_XMM_CLOBBER_TEST 0 -%define CONFIG_BSFS 1 -%define CONFIG_DECODERS 1 -%define CONFIG_PARSERS 1 -%define CONFIG_AANDCTTABLES 0 -%define CONFIG_AC3DSP 0 -%define CONFIG_ADTS_HEADER 0 -%define CONFIG_AUDIO_FRAME_QUEUE 0 -%define CONFIG_AUDIODSP 0 -%define CONFIG_BLOCKDSP 0 -%define CONFIG_BSWAPDSP 0 -%define CONFIG_CABAC 0 -%define CONFIG_CBS 0 -%define CONFIG_CBS_H264 0 -%define CONFIG_CBS_H265 0 -%define CONFIG_CBS_MPEG2 0 -%define CONFIG_DIRAC_PARSE 0 -%define CONFIG_DVPROFILE 0 -%define CONFIG_EXIF 0 -%define CONFIG_FAANDCT 1 -%define CONFIG_FAANIDCT 1 -%define CONFIG_FDCTDSP 1 -%define CONFIG_FLACDSP 1 -%define CONFIG_FMTCONVERT 0 -%define CONFIG_G722DSP 0 -%define CONFIG_GOLOMB 0 -%define CONFIG_GPLV3 0 -%define CONFIG_H263DSP 0 -%define CONFIG_H264CHROMA 0 -%define CONFIG_H264DSP 0 -%define CONFIG_H264PARSE 0 -%define CONFIG_H264PRED 1 -%define CONFIG_H264QPEL 0 -%define CONFIG_HEVCPARSE 0 -%define CONFIG_HPELDSP 0 -%define CONFIG_HUFFMAN 0 -%define CONFIG_HUFFYUVDSP 0 -%define CONFIG_HUFFYUVENCDSP 0 -%define CONFIG_IDCTDSP 1 -%define CONFIG_IIRFILTER 0 -%define CONFIG_MDCT15 0 -%define CONFIG_INTRAX8 0 -%define CONFIG_ISO_MEDIA 0 -%define CONFIG_IVIDSP 0 -%define CONFIG_JPEGTABLES 0 -%define CONFIG_LGPLV3 0 -%define CONFIG_LIBX262 0 -%define CONFIG_LLAUDDSP 0 -%define CONFIG_LLVIDDSP 0 -%define CONFIG_LLVIDENCDSP 0 -%define CONFIG_LPC 0 -%define CONFIG_LZF 0 -%define CONFIG_ME_CMP 0 -%define CONFIG_MPEG_ER 0 -%define CONFIG_MPEGAUDIO 0 -%define CONFIG_MPEGAUDIODSP 0 -%define CONFIG_MPEGAUDIOHEADER 0 -%define CONFIG_MPEGVIDEO 0 -%define CONFIG_MPEGVIDEOENC 0 -%define CONFIG_MSS34DSP 0 -%define CONFIG_PIXBLOCKDSP 0 -%define CONFIG_QPELDSP 0 -%define CONFIG_QSV 0 -%define CONFIG_QSVDEC 0 -%define CONFIG_QSVENC 0 -%define CONFIG_QSVVPP 0 -%define CONFIG_RANGECODER 0 -%define CONFIG_RIFFDEC 0 -%define CONFIG_RIFFENC 0 -%define CONFIG_RTPDEC 0 -%define CONFIG_RTPENC_CHAIN 0 -%define CONFIG_RV34DSP 0 -%define CONFIG_SINEWIN 0 -%define CONFIG_SNAPPY 0 -%define CONFIG_SRTP 0 -%define CONFIG_STARTCODE 0 -%define CONFIG_TEXTUREDSP 0 -%define CONFIG_TEXTUREDSPENC 0 -%define CONFIG_TPELDSP 0 -%define CONFIG_VAAPI_1 0 -%define CONFIG_VAAPI_ENCODE 0 -%define CONFIG_VC1DSP 0 -%define CONFIG_VIDEODSP 1 -%define CONFIG_VP3DSP 0 -%define CONFIG_VP56DSP 0 -%define CONFIG_VP8DSP 1 -%define CONFIG_WMA_FREQS 0 -%define CONFIG_WMV2DSP 0 -%define CONFIG_NULL_BSF 1 -%define CONFIG_VP9_SUPERFRAME_SPLIT_BSF 1 -%define CONFIG_VP8_DECODER 1 -%define CONFIG_VP9_DECODER 1 -%define CONFIG_FLAC_DECODER 1 -%define CONFIG_VP8_PARSER 1 -%define CONFIG_VP9_PARSER 1 diff --git a/media/ffvpx/config_darwin64.h b/media/ffvpx/config_darwin64.h deleted file mode 100644 index 03f19b3c25..0000000000 --- a/media/ffvpx/config_darwin64.h +++ /dev/null @@ -1,658 +0,0 @@ -/* Automatically generated by configure - do not modify! */ -#ifndef FFMPEG_CONFIG_H -#define FFMPEG_CONFIG_H -#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-x86asm --disable-cuda --disable-cuvid" -#define FFMPEG_LICENSE "LGPL version 2.1 or later" -#define CONFIG_THIS_YEAR 2018 -#define FFMPEG_DATADIR "/usr/local/share/ffmpeg" -#define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "Apple LLVM version 9.1.0 (clang-902.0.39.2)" -#define av_restrict restrict -#define EXTERN_PREFIX "_" -#define EXTERN_ASM _ -#define BUILDSUF "" -#define SLIBSUF ".dylib" -#define HAVE_MMX2 HAVE_MMXEXT -#define SWS_MAX_FILTER_SIZE 256 -#define ARCH_AARCH64 0 -#define ARCH_ALPHA 0 -#define ARCH_ARM 0 -#define ARCH_AVR32 0 -#define ARCH_AVR32_AP 0 -#define ARCH_AVR32_UC 0 -#define ARCH_BFIN 0 -#define ARCH_IA64 0 -#define ARCH_M68K 0 -#define ARCH_MIPS 0 -#define ARCH_MIPS64 0 -#define ARCH_PARISC 0 -#define ARCH_PPC 0 -#define ARCH_PPC64 0 -#define ARCH_S390 0 -#define ARCH_SH4 0 -#define ARCH_SPARC 0 -#define ARCH_SPARC64 0 -#define ARCH_TILEGX 0 -#define ARCH_TILEPRO 0 -#define ARCH_TOMI 0 -#define ARCH_X86 1 -#define ARCH_X86_32 0 -#define ARCH_X86_64 1 -#define HAVE_ARMV5TE 0 -#define HAVE_ARMV6 0 -#define HAVE_ARMV6T2 0 -#define HAVE_ARMV8 0 -#define HAVE_NEON 0 -#define HAVE_VFP 0 -#define HAVE_VFPV3 0 -#define HAVE_SETEND 0 -#define HAVE_ALTIVEC 0 -#define HAVE_DCBZL 0 -#define HAVE_LDBRX 0 -#define HAVE_POWER8 0 -#define HAVE_PPC4XX 0 -#define HAVE_VSX 0 -#define HAVE_AESNI 1 -#define HAVE_AMD3DNOW 1 -#define HAVE_AMD3DNOWEXT 1 -#define HAVE_AVX 1 -#define HAVE_AVX2 1 -#define HAVE_AVX512 1 -#define HAVE_FMA3 1 -#define HAVE_FMA4 1 -#define HAVE_MMX 1 -#define HAVE_MMXEXT 1 -#define HAVE_SSE 1 -#define HAVE_SSE2 1 -#define HAVE_SSE3 1 -#define HAVE_SSE4 1 -#define HAVE_SSE42 1 -#define HAVE_SSSE3 1 -#define HAVE_XOP 1 -#define HAVE_CPUNOP 0 -#define HAVE_I686 1 -#define HAVE_MIPSFPU 0 -#define HAVE_MIPS32R2 0 -#define HAVE_MIPS32R5 0 -#define HAVE_MIPS64R2 0 -#define HAVE_MIPS32R6 0 -#define HAVE_MIPS64R6 0 -#define HAVE_MIPSDSP 0 -#define HAVE_MIPSDSPR2 0 -#define HAVE_MSA 0 -#define HAVE_LOONGSON2 0 -#define HAVE_LOONGSON3 0 -#define HAVE_MMI 0 -#define HAVE_ARMV5TE_EXTERNAL 0 -#define HAVE_ARMV6_EXTERNAL 0 -#define HAVE_ARMV6T2_EXTERNAL 0 -#define HAVE_ARMV8_EXTERNAL 0 -#define HAVE_NEON_EXTERNAL 0 -#define HAVE_VFP_EXTERNAL 0 -#define HAVE_VFPV3_EXTERNAL 0 -#define HAVE_SETEND_EXTERNAL 0 -#define HAVE_ALTIVEC_EXTERNAL 0 -#define HAVE_DCBZL_EXTERNAL 0 -#define HAVE_LDBRX_EXTERNAL 0 -#define HAVE_POWER8_EXTERNAL 0 -#define HAVE_PPC4XX_EXTERNAL 0 -#define HAVE_VSX_EXTERNAL 0 -#define HAVE_AESNI_EXTERNAL 1 -#define HAVE_AMD3DNOW_EXTERNAL 1 -#define HAVE_AMD3DNOWEXT_EXTERNAL 1 -#define HAVE_AVX_EXTERNAL 1 -#define HAVE_AVX2_EXTERNAL 1 -#define HAVE_AVX512_EXTERNAL 1 -#define HAVE_FMA3_EXTERNAL 1 -#define HAVE_FMA4_EXTERNAL 1 -#define HAVE_MMX_EXTERNAL 1 -#define HAVE_MMXEXT_EXTERNAL 1 -#define HAVE_SSE_EXTERNAL 1 -#define HAVE_SSE2_EXTERNAL 1 -#define HAVE_SSE3_EXTERNAL 1 -#define HAVE_SSE4_EXTERNAL 1 -#define HAVE_SSE42_EXTERNAL 1 -#define HAVE_SSSE3_EXTERNAL 1 -#define HAVE_XOP_EXTERNAL 1 -#define HAVE_CPUNOP_EXTERNAL 0 -#define HAVE_I686_EXTERNAL 0 -#define HAVE_MIPSFPU_EXTERNAL 0 -#define HAVE_MIPS32R2_EXTERNAL 0 -#define HAVE_MIPS32R5_EXTERNAL 0 -#define HAVE_MIPS64R2_EXTERNAL 0 -#define HAVE_MIPS32R6_EXTERNAL 0 -#define HAVE_MIPS64R6_EXTERNAL 0 -#define HAVE_MIPSDSP_EXTERNAL 0 -#define HAVE_MIPSDSPR2_EXTERNAL 0 -#define HAVE_MSA_EXTERNAL 0 -#define HAVE_LOONGSON2_EXTERNAL 0 -#define HAVE_LOONGSON3_EXTERNAL 0 -#define HAVE_MMI_EXTERNAL 0 -#define HAVE_ARMV5TE_INLINE 0 -#define HAVE_ARMV6_INLINE 0 -#define HAVE_ARMV6T2_INLINE 0 -#define HAVE_ARMV8_INLINE 0 -#define HAVE_NEON_INLINE 0 -#define HAVE_VFP_INLINE 0 -#define HAVE_VFPV3_INLINE 0 -#define HAVE_SETEND_INLINE 0 -#define HAVE_ALTIVEC_INLINE 0 -#define HAVE_DCBZL_INLINE 0 -#define HAVE_LDBRX_INLINE 0 -#define HAVE_POWER8_INLINE 0 -#define HAVE_PPC4XX_INLINE 0 -#define HAVE_VSX_INLINE 0 -#define HAVE_AESNI_INLINE 1 -#define HAVE_AMD3DNOW_INLINE 1 -#define HAVE_AMD3DNOWEXT_INLINE 1 -#define HAVE_AVX_INLINE 1 -#define HAVE_AVX2_INLINE 1 -#define HAVE_AVX512_INLINE 1 -#define HAVE_FMA3_INLINE 1 -#define HAVE_FMA4_INLINE 1 -#define HAVE_MMX_INLINE 1 -#define HAVE_MMXEXT_INLINE 1 -#define HAVE_SSE_INLINE 1 -#define HAVE_SSE2_INLINE 1 -#define HAVE_SSE3_INLINE 1 -#define HAVE_SSE4_INLINE 1 -#define HAVE_SSE42_INLINE 1 -#define HAVE_SSSE3_INLINE 1 -#define HAVE_XOP_INLINE 1 -#define HAVE_CPUNOP_INLINE 0 -#define HAVE_I686_INLINE 0 -#define HAVE_MIPSFPU_INLINE 0 -#define HAVE_MIPS32R2_INLINE 0 -#define HAVE_MIPS32R5_INLINE 0 -#define HAVE_MIPS64R2_INLINE 0 -#define HAVE_MIPS32R6_INLINE 0 -#define HAVE_MIPS64R6_INLINE 0 -#define HAVE_MIPSDSP_INLINE 0 -#define HAVE_MIPSDSPR2_INLINE 0 -#define HAVE_MSA_INLINE 0 -#define HAVE_LOONGSON2_INLINE 0 -#define HAVE_LOONGSON3_INLINE 0 -#define HAVE_MMI_INLINE 0 -#define HAVE_ALIGNED_STACK 1 -#define HAVE_FAST_64BIT 1 -#define HAVE_FAST_CLZ 1 -#define HAVE_FAST_CMOV 1 -#define HAVE_LOCAL_ALIGNED 1 -#define HAVE_SIMD_ALIGN_16 1 -#define HAVE_SIMD_ALIGN_32 1 -#define HAVE_SIMD_ALIGN_64 1 -#define HAVE_ATOMIC_CAS_PTR 0 -#define HAVE_MACHINE_RW_BARRIER 0 -#define HAVE_MEMORYBARRIER 0 -#define HAVE_MM_EMPTY 1 -#define HAVE_RDTSC 0 -#define HAVE_SEM_TIMEDWAIT 0 -#define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1 -#define HAVE_CABS 1 -#define HAVE_CEXP 1 -#define HAVE_INLINE_ASM 1 -#define HAVE_SYMVER 1 -#define HAVE_X86ASM 1 -#define HAVE_BIGENDIAN 0 -#define HAVE_FAST_UNALIGNED 1 -#define HAVE_ARPA_INET_H 1 -#define HAVE_ASM_TYPES_H 0 -#define HAVE_CDIO_PARANOIA_H 0 -#define HAVE_CDIO_PARANOIA_PARANOIA_H 0 -#define HAVE_CUDA_H 0 -#define HAVE_DISPATCH_DISPATCH_H 1 -#define HAVE_DEV_BKTR_IOCTL_BT848_H 0 -#define HAVE_DEV_BKTR_IOCTL_METEOR_H 0 -#define HAVE_DEV_IC_BT8XX_H 0 -#define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0 -#define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0 -#define HAVE_DIRECT_H 0 -#define HAVE_DIRENT_H 1 -#define HAVE_DXGIDEBUG_H 0 -#define HAVE_DXVA_H 0 -#define HAVE_ES2_GL_H 0 -#define HAVE_GSM_H 0 -#define HAVE_IO_H 0 -#define HAVE_LINUX_PERF_EVENT_H 0 -#define HAVE_MACHINE_IOCTL_BT848_H 0 -#define HAVE_MACHINE_IOCTL_METEOR_H 0 -#define HAVE_OPENCV2_CORE_CORE_C_H 0 -#define HAVE_OPENGL_GL3_H 0 -#define HAVE_POLL_H 1 -#define HAVE_SYS_PARAM_H 1 -#define HAVE_SYS_RESOURCE_H 1 -#define HAVE_SYS_SELECT_H 1 -#define HAVE_SYS_SOUNDCARD_H 0 -#define HAVE_SYS_TIME_H 1 -#define HAVE_SYS_UN_H 1 -#define HAVE_SYS_VIDEOIO_H 0 -#define HAVE_TERMIOS_H 1 -#define HAVE_UDPLITE_H 0 -#define HAVE_UNISTD_H 1 -#define HAVE_VALGRIND_VALGRIND_H 0 -#define HAVE_WINDOWS_H 0 -#define HAVE_WINSOCK2_H 0 -#define HAVE_INTRINSICS_NEON 0 -#define HAVE_ATANF 1 -#define HAVE_ATAN2F 1 -#define HAVE_CBRT 1 -#define HAVE_CBRTF 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COSF 1 -#define HAVE_ERF 1 -#define HAVE_EXP2 1 -#define HAVE_EXP2F 1 -#define HAVE_EXPF 1 -#define HAVE_HYPOT 1 -#define HAVE_ISFINITE 1 -#define HAVE_ISINF 1 -#define HAVE_ISNAN 1 -#define HAVE_LDEXPF 1 -#define HAVE_LLRINT 1 -#define HAVE_LLRINTF 1 -#define HAVE_LOG2 1 -#define HAVE_LOG2F 1 -#define HAVE_LOG10F 1 -#define HAVE_LRINT 1 -#define HAVE_LRINTF 1 -#define HAVE_POWF 1 -#define HAVE_RINT 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SINF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_DOS_PATHS 0 -#define HAVE_LIBC_MSVCRT 0 -#define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0 -#define HAVE_SECTION_DATA_REL_RO 0 -#define HAVE_THREADS 1 -#define HAVE_UWP 0 -#define HAVE_WINRT 0 -#define HAVE_ACCESS 1 -#define HAVE_ALIGNED_MALLOC 0 -#define HAVE_CLOCK_GETTIME 1 -#define HAVE_CLOSESOCKET 0 -#define HAVE_COMMANDLINETOARGVW 0 -#define HAVE_FCNTL 1 -#define HAVE_GETADDRINFO 1 -#define HAVE_GETHRTIME 0 -#define HAVE_GETOPT 1 -#define HAVE_GETPROCESSAFFINITYMASK 0 -#define HAVE_GETPROCESSMEMORYINFO 0 -#define HAVE_GETPROCESSTIMES 0 -#define HAVE_GETRUSAGE 1 -#define HAVE_GETSYSTEMTIMEASFILETIME 0 -#define HAVE_GETTIMEOFDAY 1 -#define HAVE_GLOB 1 -#define HAVE_GLXGETPROCADDRESS 0 -#define HAVE_GMTIME_R 1 -#define HAVE_INET_ATON 1 -#define HAVE_ISATTY 1 -#define HAVE_KBHIT 0 -#define HAVE_LSTAT 1 -#define HAVE_LZO1X_999_COMPRESS 0 -#define HAVE_MACH_ABSOLUTE_TIME 1 -#define HAVE_MAPVIEWOFFILE 0 -#define HAVE_MKSTEMP 1 -#define HAVE_MMAP 1 -#define HAVE_MPROTECT 1 -#define HAVE_NANOSLEEP 1 -#define HAVE_PEEKNAMEDPIPE 0 -#define HAVE_PTHREAD_CANCEL 1 -#define HAVE_SCHED_GETAFFINITY 0 -#define HAVE_SECITEMIMPORT 0 -#define HAVE_SETCONSOLETEXTATTRIBUTE 0 -#define HAVE_SETCONSOLECTRLHANDLER 0 -#define HAVE_SETMODE 0 -#define HAVE_SETRLIMIT 1 -#define HAVE_SLEEP 0 -#define HAVE_STRERROR_R 1 -#define HAVE_SYSCONF 1 -#define HAVE_SYSCTL 1 -#define HAVE_USLEEP 1 -#define HAVE_UTGETOSTYPEFROMSTRING 0 -#define HAVE_VIRTUALALLOC 0 -#define HAVE_WGLGETPROCADDRESS 0 -#define HAVE_BCRYPT 0 -#define HAVE_VAAPI_DRM 0 -#define HAVE_VAAPI_X11 0 -#define HAVE_VDPAU_X11 0 -#define HAVE_PTHREADS 1 -#define HAVE_OS2THREADS 0 -#define HAVE_W32THREADS 0 -#define HAVE_AS_ARCH_DIRECTIVE 0 -#define HAVE_AS_DN_DIRECTIVE 0 -#define HAVE_AS_FPU_DIRECTIVE 0 -#define HAVE_AS_FUNC 0 -#define HAVE_AS_OBJECT_ARCH 0 -#define HAVE_ASM_MOD_Q 0 -#define HAVE_BLOCKS_EXTENSION 1 -#define HAVE_EBP_AVAILABLE 1 -#define HAVE_EBX_AVAILABLE 1 -#define HAVE_GNU_AS 0 -#define HAVE_GNU_WINDRES 0 -#define HAVE_IBM_ASM 0 -#define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1 -#define HAVE_INLINE_ASM_LABELS 1 -#define HAVE_INLINE_ASM_NONLOCAL_LABELS 1 -#define HAVE_PRAGMA_DEPRECATED 1 -#define HAVE_RSYNC_CONTIMEOUT 0 -#define HAVE_SYMVER_ASM_LABEL 1 -#define HAVE_SYMVER_GNU_ASM 0 -#define HAVE_VFP_ARGS 0 -#define HAVE_XFORM_ASM 0 -#define HAVE_XMM_CLOBBERS 1 -#define HAVE_KCMVIDEOCODECTYPE_HEVC 0 -#define HAVE_SOCKLEN_T 1 -#define HAVE_STRUCT_ADDRINFO 1 -#define HAVE_STRUCT_GROUP_SOURCE_REQ 1 -#define HAVE_STRUCT_IP_MREQ_SOURCE 1 -#define HAVE_STRUCT_IPV6_MREQ 1 -#define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1 -#define HAVE_STRUCT_POLLFD 1 -#define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1 -#define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0 -#define HAVE_STRUCT_SOCKADDR_IN6 1 -#define HAVE_STRUCT_SOCKADDR_SA_LEN 1 -#define HAVE_STRUCT_SOCKADDR_STORAGE 1 -#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0 -#define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0 -#define HAVE_MAKEINFO 1 -#define HAVE_MAKEINFO_HTML 0 -#define HAVE_OPENCL_D3D11 0 -#define HAVE_OPENCL_DRM_ARM 0 -#define HAVE_OPENCL_DRM_BEIGNET 0 -#define HAVE_OPENCL_DXVA2 0 -#define HAVE_OPENCL_VAAPI_BEIGNET 0 -#define HAVE_OPENCL_VAAPI_INTEL_MEDIA 0 -#define HAVE_PERL 1 -#define HAVE_POD2MAN 1 -#define HAVE_TEXI2HTML 1 -#define CONFIG_DOC 0 -#define CONFIG_HTMLPAGES 1 -#define CONFIG_MANPAGES 1 -#define CONFIG_PODPAGES 1 -#define CONFIG_TXTPAGES 1 -#define CONFIG_AVIO_DIR_CMD_EXAMPLE 1 -#define CONFIG_AVIO_READING_EXAMPLE 1 -#define CONFIG_DECODE_AUDIO_EXAMPLE 1 -#define CONFIG_DECODE_VIDEO_EXAMPLE 1 -#define CONFIG_DEMUXING_DECODING_EXAMPLE 0 -#define CONFIG_ENCODE_AUDIO_EXAMPLE 1 -#define CONFIG_ENCODE_VIDEO_EXAMPLE 1 -#define CONFIG_EXTRACT_MVS_EXAMPLE 0 -#define CONFIG_FILTER_AUDIO_EXAMPLE 0 -#define CONFIG_FILTERING_AUDIO_EXAMPLE 0 -#define CONFIG_FILTERING_VIDEO_EXAMPLE 0 -#define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0 -#define CONFIG_HW_DECODE_EXAMPLE 0 -#define CONFIG_METADATA_EXAMPLE 0 -#define CONFIG_MUXING_EXAMPLE 0 -#define CONFIG_QSVDEC_EXAMPLE 0 -#define CONFIG_REMUXING_EXAMPLE 0 -#define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0 -#define CONFIG_SCALING_VIDEO_EXAMPLE 0 -#define CONFIG_TRANSCODE_AAC_EXAMPLE 0 -#define CONFIG_TRANSCODING_EXAMPLE 0 -#define CONFIG_VAAPI_ENCODE_EXAMPLE 0 -#define CONFIG_VAAPI_TRANSCODE_EXAMPLE 0 -#define CONFIG_AVISYNTH 0 -#define CONFIG_FREI0R 0 -#define CONFIG_LIBCDIO 0 -#define CONFIG_LIBRUBBERBAND 0 -#define CONFIG_LIBVIDSTAB 0 -#define CONFIG_LIBX264 0 -#define CONFIG_LIBX265 0 -#define CONFIG_LIBXAVS 0 -#define CONFIG_LIBXVID 0 -#define CONFIG_DECKLINK 0 -#define CONFIG_LIBNDI_NEWTEK 0 -#define CONFIG_LIBFDK_AAC 0 -#define CONFIG_OPENSSL 0 -#define CONFIG_LIBTLS 0 -#define CONFIG_GMP 0 -#define CONFIG_LIBOPENCORE_AMRNB 0 -#define CONFIG_LIBOPENCORE_AMRWB 0 -#define CONFIG_LIBVMAF 0 -#define CONFIG_LIBVO_AMRWBENC 0 -#define CONFIG_RKMPP 0 -#define CONFIG_LIBSMBCLIENT 0 -#define CONFIG_CHROMAPRINT 0 -#define CONFIG_GCRYPT 0 -#define CONFIG_GNUTLS 0 -#define CONFIG_JNI 0 -#define CONFIG_LADSPA 0 -#define CONFIG_LIBAOM 0 -#define CONFIG_LIBASS 0 -#define CONFIG_LIBBLURAY 0 -#define CONFIG_LIBBS2B 0 -#define CONFIG_LIBCACA 0 -#define CONFIG_LIBCELT 0 -#define CONFIG_LIBCODEC2 0 -#define CONFIG_LIBDC1394 0 -#define CONFIG_LIBDRM 0 -#define CONFIG_LIBFLITE 0 -#define CONFIG_LIBFONTCONFIG 0 -#define CONFIG_LIBFREETYPE 0 -#define CONFIG_LIBFRIBIDI 0 -#define CONFIG_LIBGME 0 -#define CONFIG_LIBGSM 0 -#define CONFIG_LIBIEC61883 0 -#define CONFIG_LIBILBC 0 -#define CONFIG_LIBJACK 0 -#define CONFIG_LIBKVAZAAR 0 -#define CONFIG_LIBMODPLUG 0 -#define CONFIG_LIBMP3LAME 0 -#define CONFIG_LIBMYSOFA 0 -#define CONFIG_LIBOPENCV 0 -#define CONFIG_LIBOPENH264 0 -#define CONFIG_LIBOPENJPEG 0 -#define CONFIG_LIBOPENMPT 0 -#define CONFIG_LIBOPUS 0 -#define CONFIG_LIBPULSE 0 -#define CONFIG_LIBRSVG 0 -#define CONFIG_LIBRTMP 0 -#define CONFIG_LIBSHINE 0 -#define CONFIG_LIBSMBCLIENT 0 -#define CONFIG_LIBSNAPPY 0 -#define CONFIG_LIBSOXR 0 -#define CONFIG_LIBSPEEX 0 -#define CONFIG_LIBSRT 0 -#define CONFIG_LIBSSH 0 -#define CONFIG_LIBTESSERACT 0 -#define CONFIG_LIBTHEORA 0 -#define CONFIG_LIBTWOLAME 0 -#define CONFIG_LIBV4L2 0 -#define CONFIG_LIBVORBIS 0 -#define CONFIG_LIBVPX 0 -#define CONFIG_LIBWAVPACK 0 -#define CONFIG_LIBWEBP 0 -#define CONFIG_LIBXML2 0 -#define CONFIG_LIBZIMG 0 -#define CONFIG_LIBZMQ 0 -#define CONFIG_LIBZVBI 0 -#define CONFIG_LV2 0 -#define CONFIG_MEDIACODEC 0 -#define CONFIG_OPENAL 0 -#define CONFIG_OPENGL 0 -#define CONFIG_ALSA 0 -#define CONFIG_APPKIT 1 -#define CONFIG_AVFOUNDATION 1 -#define CONFIG_BZLIB 1 -#define CONFIG_COREIMAGE 1 -#define CONFIG_ICONV 0 -#define CONFIG_LIBXCB 0 -#define CONFIG_LIBXCB_SHM 0 -#define CONFIG_LIBXCB_SHAPE 0 -#define CONFIG_LIBXCB_XFIXES 0 -#define CONFIG_LZMA 1 -#define CONFIG_SCHANNEL 0 -#define CONFIG_SDL2 0 -#define CONFIG_SECURETRANSPORT 0 -#define CONFIG_SNDIO 0 -#define CONFIG_XLIB 1 -#define CONFIG_ZLIB 1 -#define CONFIG_CUDA_SDK 0 -#define CONFIG_LIBNPP 0 -#define CONFIG_LIBMFX 0 -#define CONFIG_MMAL 0 -#define CONFIG_OMX 0 -#define CONFIG_OPENCL 0 -#define CONFIG_AMF 0 -#define CONFIG_AUDIOTOOLBOX 1 -#define CONFIG_CRYSTALHD 0 -#define CONFIG_CUDA 0 -#define CONFIG_CUVID 0 -#define CONFIG_D3D11VA 0 -#define CONFIG_DXVA2 0 -#define CONFIG_FFNVCODEC 0 -#define CONFIG_NVDEC 0 -#define CONFIG_NVENC 0 -#define CONFIG_VAAPI 0 -#define CONFIG_VDPAU 0 -#define CONFIG_VIDEOTOOLBOX 0 -#define CONFIG_V4L2_M2M 0 -#define CONFIG_XVMC 0 -#define CONFIG_FTRAPV 0 -#define CONFIG_GRAY 0 -#define CONFIG_HARDCODED_TABLES 0 -#define CONFIG_OMX_RPI 0 -#define CONFIG_RUNTIME_CPUDETECT 1 -#define CONFIG_SAFE_BITSTREAM_READER 1 -#define CONFIG_SHARED 1 -#define CONFIG_SMALL 0 -#define CONFIG_STATIC 0 -#define CONFIG_SWSCALE_ALPHA 1 -#define CONFIG_GPL 0 -#define CONFIG_NONFREE 0 -#define CONFIG_VERSION3 0 -#define CONFIG_AVCODEC 1 -#define CONFIG_AVDEVICE 0 -#define CONFIG_AVFILTER 0 -#define CONFIG_AVFORMAT 0 -#define CONFIG_AVRESAMPLE 0 -#define CONFIG_AVUTIL 1 -#define CONFIG_POSTPROC 0 -#define CONFIG_SWRESAMPLE 0 -#define CONFIG_SWSCALE 0 -#define CONFIG_FFPLAY 0 -#define CONFIG_FFPROBE 0 -#define CONFIG_FFMPEG 0 -#define CONFIG_DCT 0 -#define CONFIG_DWT 0 -#define CONFIG_ERROR_RESILIENCE 0 -#define CONFIG_FAAN 1 -#define CONFIG_FAST_UNALIGNED 1 -#define CONFIG_FFT 0 -#define CONFIG_LSP 0 -#define CONFIG_LZO 0 -#define CONFIG_MDCT 0 -#define CONFIG_PIXELUTILS 0 -#define CONFIG_NETWORK 0 -#define CONFIG_RDFT 0 -#define CONFIG_AUTODETECT 0 -#define CONFIG_FONTCONFIG 0 -#define CONFIG_LINUX_PERF 0 -#define CONFIG_MEMORY_POISONING 0 -#define CONFIG_NEON_CLOBBER_TEST 0 -#define CONFIG_OSSFUZZ 0 -#define CONFIG_PIC 1 -#define CONFIG_THUMB 0 -#define CONFIG_VALGRIND_BACKTRACE 0 -#define CONFIG_XMM_CLOBBER_TEST 0 -#define CONFIG_BSFS 1 -#define CONFIG_DECODERS 1 -#define CONFIG_PARSERS 1 -#define CONFIG_AANDCTTABLES 0 -#define CONFIG_AC3DSP 0 -#define CONFIG_ADTS_HEADER 0 -#define CONFIG_AUDIO_FRAME_QUEUE 0 -#define CONFIG_AUDIODSP 0 -#define CONFIG_BLOCKDSP 0 -#define CONFIG_BSWAPDSP 0 -#define CONFIG_CABAC 0 -#define CONFIG_CBS 0 -#define CONFIG_CBS_H264 0 -#define CONFIG_CBS_H265 0 -#define CONFIG_CBS_MPEG2 0 -#define CONFIG_DIRAC_PARSE 0 -#define CONFIG_DVPROFILE 0 -#define CONFIG_EXIF 0 -#define CONFIG_FAANDCT 1 -#define CONFIG_FAANIDCT 1 -#define CONFIG_FDCTDSP 1 -#define CONFIG_FLACDSP 1 -#define CONFIG_FMTCONVERT 0 -#define CONFIG_G722DSP 0 -#define CONFIG_GOLOMB 0 -#define CONFIG_GPLV3 0 -#define CONFIG_H263DSP 0 -#define CONFIG_H264CHROMA 0 -#define CONFIG_H264DSP 0 -#define CONFIG_H264PARSE 0 -#define CONFIG_H264PRED 1 -#define CONFIG_H264QPEL 0 -#define CONFIG_HEVCPARSE 0 -#define CONFIG_HPELDSP 0 -#define CONFIG_HUFFMAN 0 -#define CONFIG_HUFFYUVDSP 0 -#define CONFIG_HUFFYUVENCDSP 0 -#define CONFIG_IDCTDSP 1 -#define CONFIG_IIRFILTER 0 -#define CONFIG_MDCT15 0 -#define CONFIG_INTRAX8 0 -#define CONFIG_ISO_MEDIA 0 -#define CONFIG_IVIDSP 0 -#define CONFIG_JPEGTABLES 0 -#define CONFIG_LGPLV3 0 -#define CONFIG_LIBX262 0 -#define CONFIG_LLAUDDSP 0 -#define CONFIG_LLVIDDSP 0 -#define CONFIG_LLVIDENCDSP 0 -#define CONFIG_LPC 0 -#define CONFIG_LZF 0 -#define CONFIG_ME_CMP 0 -#define CONFIG_MPEG_ER 0 -#define CONFIG_MPEGAUDIO 0 -#define CONFIG_MPEGAUDIODSP 0 -#define CONFIG_MPEGAUDIOHEADER 0 -#define CONFIG_MPEGVIDEO 0 -#define CONFIG_MPEGVIDEOENC 0 -#define CONFIG_MSS34DSP 0 -#define CONFIG_PIXBLOCKDSP 0 -#define CONFIG_QPELDSP 0 -#define CONFIG_QSV 0 -#define CONFIG_QSVDEC 0 -#define CONFIG_QSVENC 0 -#define CONFIG_QSVVPP 0 -#define CONFIG_RANGECODER 0 -#define CONFIG_RIFFDEC 0 -#define CONFIG_RIFFENC 0 -#define CONFIG_RTPDEC 0 -#define CONFIG_RTPENC_CHAIN 0 -#define CONFIG_RV34DSP 0 -#define CONFIG_SINEWIN 0 -#define CONFIG_SNAPPY 0 -#define CONFIG_SRTP 0 -#define CONFIG_STARTCODE 0 -#define CONFIG_TEXTUREDSP 0 -#define CONFIG_TEXTUREDSPENC 0 -#define CONFIG_TPELDSP 0 -#define CONFIG_VAAPI_1 0 -#define CONFIG_VAAPI_ENCODE 0 -#define CONFIG_VC1DSP 0 -#define CONFIG_VIDEODSP 1 -#define CONFIG_VP3DSP 0 -#define CONFIG_VP56DSP 0 -#define CONFIG_VP8DSP 1 -#define CONFIG_WMA_FREQS 0 -#define CONFIG_WMV2DSP 0 -#define CONFIG_NULL_BSF 1 -#define CONFIG_VP9_SUPERFRAME_SPLIT_BSF 1 -#define CONFIG_VP8_DECODER 1 -#define CONFIG_VP9_DECODER 1 -#define CONFIG_FLAC_DECODER 1 -#define CONFIG_VP8_PARSER 1 -#define CONFIG_VP9_PARSER 1 -#endif /* FFMPEG_CONFIG_H */ diff --git a/media/libav/config_darwin.asm b/media/libav/config_darwin.asm deleted file mode 100644 index 89413c594e..0000000000 --- a/media/libav/config_darwin.asm +++ /dev/null @@ -1,249 +0,0 @@ -%include "config_common.asm" -%define HAVE_ARMV5TE 0 -%define HAVE_ARMV6 0 -%define HAVE_ARMV6T2 0 -%define HAVE_ARMV8 0 -%define HAVE_NEON 0 -%define HAVE_VFP 0 -%define HAVE_VFPV3 0 -%define HAVE_ALTIVEC 0 -%define HAVE_DCBZL 1 -%define HAVE_LDBRX 1 -%define HAVE_PPC4XX 0 -%define HAVE_AMD3DNOW 1 -%define HAVE_AMD3DNOWEXT 1 -%define HAVE_AVX 1 -%define HAVE_AVX2 1 -%define HAVE_FMA3 1 -%define HAVE_FMA4 1 -%define HAVE_MMX 1 -%define HAVE_MMXEXT 1 -%define HAVE_SSE 1 -%define HAVE_SSE2 1 -%define HAVE_SSE3 1 -%define HAVE_SSE4 1 -%define HAVE_SSE42 1 -%define HAVE_SSSE3 1 -%define HAVE_XOP 1 -%define HAVE_CPUNOP 1 -%define HAVE_I686 1 -%define HAVE_LOONGSON 1 -%define HAVE_VIS 1 -%define HAVE_ARMV5TE_EXTERNAL 0 -%define HAVE_ARMV6_EXTERNAL 0 -%define HAVE_ARMV6T2_EXTERNAL 0 -%define HAVE_ARMV8_EXTERNAL 0 -%define HAVE_NEON_EXTERNAL 0 -%define HAVE_VFP_EXTERNAL 0 -%define HAVE_VFPV3_EXTERNAL 0 -%define HAVE_ALTIVEC_EXTERNAL 0 -%define HAVE_DCBZL_EXTERNAL 0 -%define HAVE_LDBRX_EXTERNAL 0 -%define HAVE_PPC4XX_EXTERNAL 0 -%define HAVE_AMD3DNOW_EXTERNAL 1 -%define HAVE_AMD3DNOWEXT_EXTERNAL 1 -%define HAVE_AVX_EXTERNAL 1 -%define HAVE_AVX2_EXTERNAL 1 -%define HAVE_FMA3_EXTERNAL 1 -%define HAVE_FMA4_EXTERNAL 1 -%define HAVE_MMX_EXTERNAL 1 -%define HAVE_MMXEXT_EXTERNAL 1 -%define HAVE_SSE_EXTERNAL 1 -%define HAVE_SSE2_EXTERNAL 1 -%define HAVE_SSE3_EXTERNAL 1 -%define HAVE_SSE4_EXTERNAL 1 -%define HAVE_SSE42_EXTERNAL 1 -%define HAVE_SSSE3_EXTERNAL 1 -%define HAVE_XOP_EXTERNAL 1 -%define HAVE_CPUNOP_EXTERNAL 0 -%define HAVE_I686_EXTERNAL 0 -%define HAVE_LOONGSON_EXTERNAL 0 -%define HAVE_VIS_EXTERNAL 0 -%define HAVE_ARMV5TE_INLINE 0 -%define HAVE_ARMV6_INLINE 0 -%define HAVE_ARMV6T2_INLINE 0 -%define HAVE_ARMV8_INLINE 0 -%define HAVE_NEON_INLINE 0 -%define HAVE_VFP_INLINE 0 -%define HAVE_VFPV3_INLINE 0 -%define HAVE_ALTIVEC_INLINE 0 -%define HAVE_DCBZL_INLINE 0 -%define HAVE_LDBRX_INLINE 0 -%define HAVE_PPC4XX_INLINE 0 -%define HAVE_AMD3DNOW_INLINE 1 -%define HAVE_AMD3DNOWEXT_INLINE 1 -%define HAVE_AVX_INLINE 1 -%define HAVE_AVX2_INLINE 1 -%define HAVE_FMA3_INLINE 1 -%define HAVE_FMA4_INLINE 1 -%define HAVE_MMX_INLINE 1 -%define HAVE_MMXEXT_INLINE 1 -%define HAVE_SSE_INLINE 1 -%define HAVE_SSE2_INLINE 1 -%define HAVE_SSE3_INLINE 1 -%define HAVE_SSE4_INLINE 1 -%define HAVE_SSE42_INLINE 1 -%define HAVE_SSSE3_INLINE 1 -%define HAVE_XOP_INLINE 1 -%define HAVE_CPUNOP_INLINE 0 -%define HAVE_I686_INLINE 0 -%define HAVE_LOONGSON_INLINE 0 -%define HAVE_VIS_INLINE 0 -%define HAVE_ALIGNED_STACK 1 -%define HAVE_FAST_64BIT 0 -%define HAVE_FAST_CLZ 0 -%define HAVE_FAST_CMOV 0 -%define HAVE_LOCAL_ALIGNED_8 1 -%define HAVE_LOCAL_ALIGNED_16 1 -%define HAVE_SIMD_ALIGN_16 1 -%define HAVE_ATOMICS_GCC 1 -%define HAVE_ATOMICS_SUNCC 0 -%define HAVE_ATOMICS_WIN32 0 -%define HAVE_ATOMIC_CAS_PTR 0 -%define HAVE_MACHINE_RW_BARRIER 0 -%define HAVE_MEMORYBARRIER 0 -%define HAVE_MM_EMPTY 1 -%define HAVE_RDTSC 0 -%define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1 -%define HAVE_INLINE_ASM 1 -%define HAVE_SYMVER 0 -%define HAVE_YASM 1 -%define HAVE_BIGENDIAN 0 -%define HAVE_FAST_UNALIGNED 1 -%define HAVE_ALSA_ASOUNDLIB_H 0 -%define HAVE_ALTIVEC_H 0 -%define HAVE_ARPA_INET_H 0 -%define HAVE_CDIO_PARANOIA_H 0 -%define HAVE_CDIO_PARANOIA_PARANOIA_H 0 -%define HAVE_DEV_BKTR_IOCTL_BT848_H 0 -%define HAVE_DEV_BKTR_IOCTL_METEOR_H 0 -%define HAVE_DEV_IC_BT8XX_H 0 -%define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0 -%define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0 -%define HAVE_DIRECT_H 0 -%define HAVE_DLFCN_H 1 -%define HAVE_DXVA_H 0 -%define HAVE_GSM_H 0 -%define HAVE_IO_H 0 -%define HAVE_MACH_MACH_TIME_H 1 -%define HAVE_MACHINE_IOCTL_BT848_H 0 -%define HAVE_MACHINE_IOCTL_METEOR_H 0 -%define HAVE_POLL_H 1 -%define HAVE_SNDIO_H 0 -%define HAVE_SOUNDCARD_H 0 -%define HAVE_SYS_MMAN_H 1 -%define HAVE_SYS_PARAM_H 1 -%define HAVE_SYS_RESOURCE_H 1 -%define HAVE_SYS_SELECT_H 1 -%define HAVE_SYS_SOUNDCARD_H 0 -%define HAVE_SYS_TIME_H 1 -%define HAVE_SYS_UN_H 1 -%define HAVE_SYS_VIDEOIO_H 0 -%define HAVE_UNISTD_H 1 -%define HAVE_WINDOWS_H 0 -%define HAVE_WINSOCK2_H 0 -%define HAVE_INTRINSICS_NEON 0 -%define HAVE_ATANF 1 -%define HAVE_ATAN2F 1 -%define HAVE_CBRTF 1 -%define HAVE_COSF 1 -%define HAVE_EXP2 1 -%define HAVE_EXP2F 1 -%define HAVE_EXPF 1 -%define HAVE_ISINF 1 -%define HAVE_ISNAN 1 -%define HAVE_LDEXPF 1 -%define HAVE_LLRINT 1 -%define HAVE_LLRINTF 1 -%define HAVE_LOG2 1 -%define HAVE_LOG2F 1 -%define HAVE_LOG10F 1 -%define HAVE_LRINT 1 -%define HAVE_LRINTF 1 -%define HAVE_POWF 1 -%define HAVE_RINT 1 -%define HAVE_ROUND 1 -%define HAVE_ROUNDF 1 -%define HAVE_SINF 1 -%define HAVE_TRUNC 1 -%define HAVE_TRUNCF 1 -%define HAVE_ALIGNED_MALLOC 0 -%define HAVE_CLOSESOCKET 0 -%define HAVE_COMMANDLINETOARGVW 0 -%define HAVE_COTASKMEMFREE 0 -%define HAVE_CRYPTGENRANDOM 0 -%define HAVE_DLOPEN 1 -%define HAVE_FCNTL 1 -%define HAVE_FLT_LIM 1 -%define HAVE_FORK 1 -%define HAVE_GETADDRINFO 0 -%define HAVE_GETHRTIME 0 -%define HAVE_GETOPT 1 -%define HAVE_GETPROCESSAFFINITYMASK 0 -%define HAVE_GETPROCESSMEMORYINFO 0 -%define HAVE_GETPROCESSTIMES 0 -%define HAVE_GETRUSAGE 1 -%define HAVE_GETSERVBYPORT 0 -%define HAVE_GETSYSTEMTIMEASFILETIME 0 -%define HAVE_GETTIMEOFDAY 1 -%define HAVE_INET_ATON 0 -%define HAVE_ISATTY 1 -%define HAVE_JACK_PORT_GET_LATENCY_RANGE 0 -%define HAVE_MACH_ABSOLUTE_TIME 1 -%define HAVE_MAPVIEWOFFILE 0 -%define HAVE_MKSTEMP 1 -%define HAVE_MMAP 1 -%define HAVE_MPROTECT 1 -%define HAVE_NANOSLEEP 1 -%define HAVE_SCHED_GETAFFINITY 0 -%define HAVE_SETCONSOLETEXTATTRIBUTE 0 -%define HAVE_SETMODE 0 -%define HAVE_SETRLIMIT 1 -%define HAVE_SLEEP 0 -%define HAVE_STRERROR_R 1 -%define HAVE_STRPTIME 1 -%define HAVE_SYSCONF 1 -%define HAVE_SYSCTL 1 -%define HAVE_USLEEP 1 -%define HAVE_VIRTUALALLOC 0 -%define HAVE_PTHREADS 0 -%define HAVE_W32THREADS 0 -%define HAVE_AS_DN_DIRECTIVE 0 -%define HAVE_AS_FUNC 0 -%define HAVE_AS_OBJECT_ARCH 0 -%define HAVE_ASM_MOD_Q 0 -%define HAVE_ATTRIBUTE_MAY_ALIAS 1 -%define HAVE_ATTRIBUTE_PACKED 1 -%define HAVE_EBP_AVAILABLE 1 -%define HAVE_EBX_AVAILABLE 1 -%define HAVE_GNU_AS 0 -%define HAVE_IBM_ASM 0 -%define HAVE_INLINE_ASM_LABELS 1 -%define HAVE_PRAGMA_DEPRECATED 1 -%define HAVE_SYMVER_ASM_LABEL 0 -%define HAVE_SYMVER_GNU_ASM 0 -%define HAVE_VFP_ARGS 0 -%define HAVE_XFORM_ASM 0 -%define HAVE_XMM_CLOBBERS 1 -%define HAVE_SOCKLEN_T 0 -%define HAVE_STRUCT_ADDRINFO 0 -%define HAVE_STRUCT_GROUP_SOURCE_REQ 0 -%define HAVE_STRUCT_IP_MREQ_SOURCE 0 -%define HAVE_STRUCT_IPV6_MREQ 0 -%define HAVE_STRUCT_POLLFD 0 -%define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1 -%define HAVE_STRUCT_SOCKADDR_IN6 0 -%define HAVE_STRUCT_SOCKADDR_SA_LEN 0 -%define HAVE_STRUCT_SOCKADDR_STORAGE 0 -%define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0 -%define HAVE_ATOMICS_NATIVE 1 -%define HAVE_DOS_PATHS 0 -%define HAVE_DXVA2_LIB 0 -%define HAVE_LIBC_MSVCRT 0 -%define HAVE_LIBDC1394_1 0 -%define HAVE_LIBDC1394_2 0 -%define HAVE_SDL 0 -%define HAVE_THREADS 0 -%define HAVE_VDPAU_X11 0 -%define HAVE_XLIB 0 - diff --git a/media/libav/config_darwin.h b/media/libav/config_darwin.h deleted file mode 100644 index ae7844f3aa..0000000000 --- a/media/libav/config_darwin.h +++ /dev/null @@ -1,259 +0,0 @@ -/* Automatically generated by configure - do not modify! */ -#ifndef LIBAV_CONFIG_H -#define LIBAV_CONFIG_H -#define LIBAV_CONFIGURATION "--disable-programs --disable-everything" -#define LIBAV_LICENSE "LGPL version 2.1 or later" -#define AVCONV_DATADIR "/usr/local/share/avconv" -#define CC_IDENT "Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)" -#define restrict restrict -#define EXTERN_PREFIX "" -#define EXTERN_ASM -#define SLIBSUF ".dylib" -#define HAVE_ARMV5TE 0 -#define HAVE_ARMV6 0 -#define HAVE_ARMV6T2 0 -#define HAVE_ARMV8 0 -#define HAVE_NEON 0 -#define HAVE_VFP 0 -#define HAVE_VFPV3 0 -#define HAVE_ALTIVEC 0 -#define HAVE_DCBZL 1 -#define HAVE_LDBRX 1 -#define HAVE_PPC4XX 0 -#define HAVE_AMD3DNOW 1 -#define HAVE_AMD3DNOWEXT 1 -#define HAVE_AVX 1 -#define HAVE_AVX2 1 -#define HAVE_FMA3 1 -#define HAVE_FMA4 1 -#define HAVE_MMX 1 -#define HAVE_MMXEXT 1 -#define HAVE_SSE 1 -#define HAVE_SSE2 1 -#define HAVE_SSE3 1 -#define HAVE_SSE4 1 -#define HAVE_SSE42 1 -#define HAVE_SSSE3 1 -#define HAVE_XOP 1 -#define HAVE_CPUNOP 1 -#define HAVE_I686 1 -#define HAVE_LOONGSON 1 -#define HAVE_VIS 1 -#define HAVE_ARMV5TE_EXTERNAL 0 -#define HAVE_ARMV6_EXTERNAL 0 -#define HAVE_ARMV6T2_EXTERNAL 0 -#define HAVE_ARMV8_EXTERNAL 0 -#define HAVE_NEON_EXTERNAL 0 -#define HAVE_VFP_EXTERNAL 0 -#define HAVE_VFPV3_EXTERNAL 0 -#define HAVE_ALTIVEC_EXTERNAL 0 -#define HAVE_DCBZL_EXTERNAL 0 -#define HAVE_LDBRX_EXTERNAL 0 -#define HAVE_PPC4XX_EXTERNAL 0 -#define HAVE_AMD3DNOW_EXTERNAL 1 -#define HAVE_AMD3DNOWEXT_EXTERNAL 1 -#define HAVE_AVX_EXTERNAL 1 -#define HAVE_AVX2_EXTERNAL 1 -#define HAVE_FMA3_EXTERNAL 1 -#define HAVE_FMA4_EXTERNAL 1 -#define HAVE_MMX_EXTERNAL 1 -#define HAVE_MMXEXT_EXTERNAL 1 -#define HAVE_SSE_EXTERNAL 1 -#define HAVE_SSE2_EXTERNAL 1 -#define HAVE_SSE3_EXTERNAL 1 -#define HAVE_SSE4_EXTERNAL 1 -#define HAVE_SSE42_EXTERNAL 1 -#define HAVE_SSSE3_EXTERNAL 1 -#define HAVE_XOP_EXTERNAL 1 -#define HAVE_CPUNOP_EXTERNAL 0 -#define HAVE_I686_EXTERNAL 0 -#define HAVE_LOONGSON_EXTERNAL 0 -#define HAVE_VIS_EXTERNAL 0 -#define HAVE_ARMV5TE_INLINE 0 -#define HAVE_ARMV6_INLINE 0 -#define HAVE_ARMV6T2_INLINE 0 -#define HAVE_ARMV8_INLINE 0 -#define HAVE_NEON_INLINE 0 -#define HAVE_VFP_INLINE 0 -#define HAVE_VFPV3_INLINE 0 -#define HAVE_ALTIVEC_INLINE 0 -#define HAVE_DCBZL_INLINE 0 -#define HAVE_LDBRX_INLINE 0 -#define HAVE_PPC4XX_INLINE 0 -#define HAVE_AMD3DNOW_INLINE 1 -#define HAVE_AMD3DNOWEXT_INLINE 1 -#define HAVE_AVX_INLINE 1 -#define HAVE_AVX2_INLINE 1 -#define HAVE_FMA3_INLINE 1 -#define HAVE_FMA4_INLINE 1 -#define HAVE_MMX_INLINE 1 -#define HAVE_MMXEXT_INLINE 1 -#define HAVE_SSE_INLINE 1 -#define HAVE_SSE2_INLINE 1 -#define HAVE_SSE3_INLINE 1 -#define HAVE_SSE4_INLINE 1 -#define HAVE_SSE42_INLINE 1 -#define HAVE_SSSE3_INLINE 1 -#define HAVE_XOP_INLINE 1 -#define HAVE_CPUNOP_INLINE 0 -#define HAVE_I686_INLINE 0 -#define HAVE_LOONGSON_INLINE 0 -#define HAVE_VIS_INLINE 0 -#define HAVE_ALIGNED_STACK 1 -#define HAVE_FAST_64BIT 0 -#define HAVE_FAST_CLZ 0 -#define HAVE_FAST_CMOV 0 -#define HAVE_LOCAL_ALIGNED_8 1 -#define HAVE_LOCAL_ALIGNED_16 1 -#define HAVE_SIMD_ALIGN_16 1 -#define HAVE_ATOMICS_GCC 1 -#define HAVE_ATOMICS_SUNCC 0 -#define HAVE_ATOMICS_WIN32 0 -#define HAVE_ATOMIC_CAS_PTR 0 -#define HAVE_MACHINE_RW_BARRIER 0 -#define HAVE_MEMORYBARRIER 0 -#define HAVE_MM_EMPTY 1 -#define HAVE_RDTSC 0 -#define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1 -#define HAVE_INLINE_ASM 1 -#define HAVE_SYMVER 0 -#define HAVE_YASM 1 -#define HAVE_BIGENDIAN 0 -#define HAVE_FAST_UNALIGNED 1 -#define HAVE_ALSA_ASOUNDLIB_H 0 -#define HAVE_ALTIVEC_H 0 -#define HAVE_ARPA_INET_H 0 -#define HAVE_CDIO_PARANOIA_H 0 -#define HAVE_CDIO_PARANOIA_PARANOIA_H 0 -#define HAVE_DEV_BKTR_IOCTL_BT848_H 0 -#define HAVE_DEV_BKTR_IOCTL_METEOR_H 0 -#define HAVE_DEV_IC_BT8XX_H 0 -#define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0 -#define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0 -#define HAVE_DIRECT_H 0 -#define HAVE_DLFCN_H 1 -#define HAVE_DXVA_H 0 -#define HAVE_GSM_H 0 -#define HAVE_IO_H 0 -#define HAVE_MACH_MACH_TIME_H 1 -#define HAVE_MACHINE_IOCTL_BT848_H 0 -#define HAVE_MACHINE_IOCTL_METEOR_H 0 -#define HAVE_POLL_H 1 -#define HAVE_SNDIO_H 0 -#define HAVE_SOUNDCARD_H 0 -#define HAVE_SYS_MMAN_H 1 -#define HAVE_SYS_PARAM_H 1 -#define HAVE_SYS_RESOURCE_H 1 -#define HAVE_SYS_SELECT_H 1 -#define HAVE_SYS_SOUNDCARD_H 0 -#define HAVE_SYS_TIME_H 1 -#define HAVE_SYS_UN_H 1 -#define HAVE_SYS_VIDEOIO_H 0 -#define HAVE_UNISTD_H 1 -#define HAVE_WINDOWS_H 0 -#define HAVE_WINSOCK2_H 0 -#define HAVE_INTRINSICS_NEON 0 -#define HAVE_ATANF 1 -#define HAVE_ATAN2F 1 -#define HAVE_CBRTF 1 -#define HAVE_COSF 1 -#define HAVE_EXP2 1 -#define HAVE_EXP2F 1 -#define HAVE_EXPF 1 -#define HAVE_ISINF 1 -#define HAVE_ISNAN 1 -#define HAVE_LDEXPF 1 -#define HAVE_LLRINT 1 -#define HAVE_LLRINTF 1 -#define HAVE_LOG2 1 -#define HAVE_LOG2F 1 -#define HAVE_LOG10F 1 -#define HAVE_LRINT 1 -#define HAVE_LRINTF 1 -#define HAVE_POWF 1 -#define HAVE_RINT 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SINF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_ALIGNED_MALLOC 0 -#define HAVE_CLOSESOCKET 0 -#define HAVE_COMMANDLINETOARGVW 0 -#define HAVE_COTASKMEMFREE 0 -#define HAVE_CRYPTGENRANDOM 0 -#define HAVE_DLOPEN 1 -#define HAVE_FCNTL 1 -#define HAVE_FLT_LIM 1 -#define HAVE_FORK 1 -#define HAVE_GETADDRINFO 0 -#define HAVE_GETHRTIME 0 -#define HAVE_GETOPT 1 -#define HAVE_GETPROCESSAFFINITYMASK 0 -#define HAVE_GETPROCESSMEMORYINFO 0 -#define HAVE_GETPROCESSTIMES 0 -#define HAVE_GETRUSAGE 1 -#define HAVE_GETSERVBYPORT 0 -#define HAVE_GETSYSTEMTIMEASFILETIME 0 -#define HAVE_GETTIMEOFDAY 1 -#define HAVE_INET_ATON 0 -#define HAVE_ISATTY 1 -#define HAVE_JACK_PORT_GET_LATENCY_RANGE 0 -#define HAVE_MACH_ABSOLUTE_TIME 1 -#define HAVE_MAPVIEWOFFILE 0 -#define HAVE_MKSTEMP 1 -#define HAVE_MMAP 1 -#define HAVE_MPROTECT 1 -#define HAVE_NANOSLEEP 1 -#define HAVE_SCHED_GETAFFINITY 0 -#define HAVE_SETCONSOLETEXTATTRIBUTE 0 -#define HAVE_SETMODE 0 -#define HAVE_SETRLIMIT 1 -#define HAVE_SLEEP 0 -#define HAVE_STRERROR_R 1 -#define HAVE_STRPTIME 1 -#define HAVE_SYSCONF 1 -#define HAVE_SYSCTL 1 -#define HAVE_USLEEP 1 -#define HAVE_VIRTUALALLOC 0 -#define HAVE_PTHREADS 0 -#define HAVE_W32THREADS 0 -#define HAVE_AS_DN_DIRECTIVE 0 -#define HAVE_AS_FUNC 0 -#define HAVE_AS_OBJECT_ARCH 0 -#define HAVE_ASM_MOD_Q 0 -#define HAVE_ATTRIBUTE_MAY_ALIAS 1 -#define HAVE_ATTRIBUTE_PACKED 1 -#define HAVE_EBP_AVAILABLE 1 -#define HAVE_EBX_AVAILABLE 1 -#define HAVE_GNU_AS 0 -#define HAVE_IBM_ASM 0 -#define HAVE_INLINE_ASM_LABELS 1 -#define HAVE_PRAGMA_DEPRECATED 1 -#define HAVE_SYMVER_ASM_LABEL 0 -#define HAVE_SYMVER_GNU_ASM 0 -#define HAVE_VFP_ARGS 0 -#define HAVE_XFORM_ASM 0 -#define HAVE_XMM_CLOBBERS 1 -#define HAVE_SOCKLEN_T 0 -#define HAVE_STRUCT_ADDRINFO 0 -#define HAVE_STRUCT_GROUP_SOURCE_REQ 0 -#define HAVE_STRUCT_IP_MREQ_SOURCE 0 -#define HAVE_STRUCT_IPV6_MREQ 0 -#define HAVE_STRUCT_POLLFD 0 -#define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1 -#define HAVE_STRUCT_SOCKADDR_IN6 0 -#define HAVE_STRUCT_SOCKADDR_SA_LEN 0 -#define HAVE_STRUCT_SOCKADDR_STORAGE 0 -#define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0 -#define HAVE_ATOMICS_NATIVE 1 -#define HAVE_DOS_PATHS 0 -#define HAVE_DXVA2_LIB 0 -#define HAVE_LIBC_MSVCRT 0 -#define HAVE_LIBDC1394_1 0 -#define HAVE_LIBDC1394_2 0 -#define HAVE_SDL 0 -#define HAVE_THREADS 0 -#define HAVE_VDPAU_X11 0 -#define HAVE_XLIB 0 -#endif /* LIBAV_CONFIG_H */ |