diff options
Diffstat (limited to 'src/3rdparty')
27 files changed, 198 insertions, 114 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp index 4a87488014..84515f4c6c 100644..100755 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp @@ -203,6 +203,7 @@ egl::Error SurfaceD3D::swapRect(EGLint x, EGLint y, EGLint width, EGLint height) if (width == 0 || height == 0) { + checkForOutOfDateSwapChain(); return egl::Error(EGL_SUCCESS); } diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp index dc539cf66e..0af2cf12c6 100644 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp @@ -154,14 +154,8 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei const bool useSharedResource = !mNativeWindow.getNativeWindow() && mRenderer->getShareHandleSupport(); D3D11_TEXTURE2D_DESC offscreenTextureDesc = {0}; -#if defined(ANGLE_ENABLE_WINDOWS_STORE) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) - const int textureLength = std::max(backbufferWidth, backbufferHeight); - offscreenTextureDesc.Width = textureLength; - offscreenTextureDesc.Height = textureLength; -#else offscreenTextureDesc.Width = backbufferWidth; offscreenTextureDesc.Height = backbufferHeight; -#endif offscreenTextureDesc.Format = backbufferFormatInfo.texFormat; offscreenTextureDesc.MipLevels = 1; offscreenTextureDesc.ArraySize = 1; @@ -241,14 +235,8 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei if (mDepthBufferFormat != GL_NONE) { D3D11_TEXTURE2D_DESC depthStencilTextureDesc; -#if defined(ANGLE_ENABLE_WINDOWS_STORE) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) - const int textureLength = std::max(backbufferWidth, backbufferHeight); - depthStencilTextureDesc.Width = textureLength; - depthStencilTextureDesc.Height = textureLength; -#else depthStencilTextureDesc.Width = backbufferWidth; depthStencilTextureDesc.Height = backbufferHeight; -#endif depthStencilTextureDesc.Format = depthBufferFormatInfo.texFormat; depthStencilTextureDesc.MipLevels = 1; depthStencilTextureDesc.ArraySize = 1; @@ -349,7 +337,6 @@ EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight) return EGL_SUCCESS; } -#if !defined(ANGLE_ENABLE_WINDOWS_STORE) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) // Can only call resize if we have already created our swap buffer and resources ASSERT(mSwapChain && mBackBufferTexture && mBackBufferRTView); @@ -392,12 +379,6 @@ EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight) } return resetOffscreenTexture(backbufferWidth, backbufferHeight); -#else - // Do nothing on Windows Phone apart from updating the internal buffer/width height - mWidth = backbufferWidth; - mHeight = backbufferHeight; - return EGL_SUCCESS; -#endif } EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swapInterval) @@ -552,27 +533,6 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height) d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(mappedResource.pData); -#if defined(ANGLE_ENABLE_WINDOWS_STORE) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) - // Create a quad in homogeneous coordinates - float x1 = -1.0f; - float y1 = -1.0f; - float x2 = 1.0f; - float y2 = 1.0f; - - const float dim = std::max(mWidth, mHeight); - float u1 = 0; - float v1 = 0; - float u2 = float(width) / dim; - float v2 = float(height) / dim; - - const NativeWindow::RotationFlags flags = mNativeWindow.rotationFlags(); - const bool rotateL = flags == NativeWindow::RotateLeft; - const bool rotateR = flags == NativeWindow::RotateRight; - d3d11::SetPositionTexCoordVertex(&vertices[0], x1, y1, rotateL ? u2 : u1, rotateR ? v2 : v1); - d3d11::SetPositionTexCoordVertex(&vertices[1], x1, y2, rotateR ? u2 : u1, rotateL ? v1 : v2); - d3d11::SetPositionTexCoordVertex(&vertices[2], x2, y1, rotateR ? u1 : u2, rotateL ? v2 : v1); - d3d11::SetPositionTexCoordVertex(&vertices[3], x2, y2, rotateL ? u1 : u2, rotateR ? v1 : v2); -#else // Create a quad in homogeneous coordinates float x1 = (x / float(mWidth)) * 2.0f - 1.0f; float y1 = (y / float(mHeight)) * 2.0f - 1.0f; @@ -588,7 +548,6 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height) d3d11::SetPositionTexCoordVertex(&vertices[1], x1, y2, u1, v2); d3d11::SetPositionTexCoordVertex(&vertices[2], x2, y1, u2, v1); d3d11::SetPositionTexCoordVertex(&vertices[3], x2, y2, u2, v2); -#endif deviceContext->Unmap(mQuadVB, 0); @@ -618,13 +577,8 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height) D3D11_VIEWPORT viewport; viewport.TopLeftX = 0; viewport.TopLeftY = 0; -#if defined(ANGLE_ENABLE_WINDOWS_STORE) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) - viewport.Width = (rotateL || rotateR) ? height : width; - viewport.Height = (rotateL || rotateR) ? width : height; -#else viewport.Width = mWidth; viewport.Height = mHeight; -#endif viewport.MinDepth = 0.0f; viewport.MaxDepth = 1.0f; deviceContext->RSSetViewports(1, &viewport); diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp index fa9a69c5a1..f45a077d97 100644 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp @@ -191,25 +191,4 @@ HRESULT GetCoreWindowSizeInPixels(const ComPtr<ABI::Windows::UI::Core::ICoreWind return result; } - -static float GetLogicalDpi() -{ - ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> displayProperties; - float dpi = 96.0f; - - if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), displayProperties.GetAddressOf()))) - { - if (SUCCEEDED(displayProperties->get_LogicalDpi(&dpi))) - { - return dpi; - } - } - return dpi; -} - -long ConvertDipsToPixels(float dips) -{ - static const float dipsPerInch = 96.0f; - return lround((dips * GetLogicalDpi() / dipsPerInch)); -} } diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h index 59df9d5a6c..87cdfe6f22 100644 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h @@ -19,7 +19,6 @@ typedef ABI::Windows::Foundation::__FITypedEventHandler_2_Windows__CGraphics__CD namespace rx { -long ConvertDipsToPixels(float dips); class CoreWindowNativeWindow : public InspectableNativeWindow, public std::enable_shared_from_this<CoreWindowNativeWindow> { @@ -64,8 +63,7 @@ class CoreWindowSizeChangedHandler : ABI::Windows::Foundation::Size windowSize; if (SUCCEEDED(sizeChangedEventArgs->get_Size(&windowSize))) { - SIZE windowSizeInPixels = { ConvertDipsToPixels(windowSize.Width), ConvertDipsToPixels(windowSize.Height) }; - host->setNewClientSize(windowSizeInPixels); + host->setNewClientSize(windowSize); } } diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp index 2bf48c5d94..e83f47929f 100644 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp @@ -288,4 +288,25 @@ HRESULT GetOptionalSizePropertyValue(const ComPtr<ABI::Windows::Foundation::Coll return result; } + +static float GetLogicalDpi() +{ + ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> displayProperties; + float dpi = 96.0f; + + if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), displayProperties.GetAddressOf()))) + { + if (SUCCEEDED(displayProperties->get_LogicalDpi(&dpi))) + { + return dpi; + } + } + return dpi; +} + +long ConvertDipsToPixels(float dips) +{ + static const float dipsPerInch = 96.0f; + return lround((dips * GetLogicalDpi() / dipsPerInch)); +} } diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h index 575bdf8a58..f0534077ae 100644 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h @@ -26,6 +26,8 @@ using namespace ABI::Windows::Foundation::Collections; namespace rx { +long ConvertDipsToPixels(float dips); + class InspectableNativeWindow { public: @@ -45,7 +47,7 @@ class InspectableNativeWindow virtual HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain) = 0; virtual bool registerForSizeChangeEvents() = 0; virtual void unregisterForSizeChangeEvents() = 0; - virtual HRESULT scaleSwapChain(const SIZE& newSize) { return S_OK; } + virtual HRESULT scaleSwapChain(const Size& newSize) { return S_OK; } bool getClientRect(RECT *rect) { @@ -59,11 +61,11 @@ class InspectableNativeWindow return true; } - void setNewClientSize(const SIZE &newSize) + void setNewClientSize(const Size &newSize) { - if (mSupportsSwapChainResize && !mRequiresSwapChainScaling) + if (mSupportsSwapChainResize) { - mNewClientRect = { 0, 0, newSize.cx, newSize.cy }; + mNewClientRect = { 0, 0, ConvertDipsToPixels(newSize.Width), ConvertDipsToPixels(newSize.Height) }; mClientRectChanged = true; } diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp index 53899dbb30..0b48b54334 100644 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp @@ -66,7 +66,7 @@ bool SwapChainPanelNativeWindow::initialize(EGLNativeWindowType window, IPropert } else { - result = GetSwapChainPanelSize(mSwapChainPanel, &mClientRect); + result = GetSwapChainPanelSize(mSwapChainPanel, &mClientRect, &mRequiresSwapChainScaling); } } @@ -139,7 +139,6 @@ HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, DXGIFa ComPtr<IDXGISwapChain1> newSwapChain; ComPtr<ISwapChainPanelNative> swapChainPanelNative; - RECT currentPanelSize = {}; HRESULT result = factory->CreateSwapChainForComposition(device, &swapChainDesc, nullptr, newSwapChain.ReleaseAndGetAddressOf()); @@ -167,13 +166,13 @@ HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, DXGIFa // first reading the current size of the swapchain panel, then scaling if (SUCCEEDED(result) && mRequiresSwapChainScaling) { - result = GetSwapChainPanelSize(mSwapChainPanel, ¤tPanelSize); - } + ComPtr<ABI::Windows::UI::Xaml::IUIElement> uiElement; + result = mSwapChainPanel.As(&uiElement); + ASSERT(SUCCEEDED(result)); - // Scale the swapchain to fit inside the contents of the panel. - if (SUCCEEDED(result) && mRequiresSwapChainScaling) - { - SIZE currentSize = { currentPanelSize.right, currentPanelSize.bottom }; + Size currentSize; + result = uiElement->get_RenderSize(¤tSize); + ASSERT(SUCCEEDED(result)); result = scaleSwapChain(currentSize); } @@ -190,9 +189,9 @@ HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, DXGIFa return result; } -HRESULT SwapChainPanelNativeWindow::scaleSwapChain(const SIZE &newSize) +HRESULT SwapChainPanelNativeWindow::scaleSwapChain(const Size &newSize) { - ABI::Windows::Foundation::Size renderScale = { (float)newSize.cx/(float)mClientRect.right, (float)newSize.cy/(float)mClientRect.bottom }; + ABI::Windows::Foundation::Size renderScale = { newSize.Width / mNewClientRect.right, newSize.Height / mNewClientRect.bottom }; // Setup a scale matrix for the swap chain DXGI_MATRIX_3X2_F scaleMatrix = {}; scaleMatrix._11 = renderScale.Width; @@ -208,7 +207,7 @@ HRESULT SwapChainPanelNativeWindow::scaleSwapChain(const SIZE &newSize) return result; } -HRESULT GetSwapChainPanelSize(const ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> &swapChainPanel, RECT *windowSize) +HRESULT GetSwapChainPanelSize(const ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> &swapChainPanel, RECT *windowSize, bool *scalingActive) { ComPtr<ABI::Windows::UI::Xaml::IUIElement> uiElement; ABI::Windows::Foundation::Size renderSize = { 0, 0 }; @@ -220,7 +219,14 @@ HRESULT GetSwapChainPanelSize(const ComPtr<ABI::Windows::UI::Xaml::Controls::ISw if (SUCCEEDED(result)) { - *windowSize = { 0, 0, lround(renderSize.Width), lround(renderSize.Height) }; + long width = ConvertDipsToPixels(renderSize.Width); + long height = ConvertDipsToPixels(renderSize.Height); + *windowSize = { 0, 0, width, height }; + + if (scalingActive) + { + *scalingActive = width != renderSize.Width || height != renderSize.Height; + } } return result; diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h index caf327d913..5debd2fd0b 100644 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h @@ -22,7 +22,7 @@ class SwapChainPanelNativeWindow : public InspectableNativeWindow, public std::e bool registerForSizeChangeEvents(); void unregisterForSizeChangeEvents(); HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain); - HRESULT scaleSwapChain(const SIZE &newSize); + HRESULT scaleSwapChain(const Size &newSize) override; private: ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> mSwapChainPanel; @@ -62,8 +62,7 @@ class SwapChainPanelSizeChangedHandler : HRESULT result = sizeChangedEventArgs->get_NewSize(&newSize); if (SUCCEEDED(result)) { - SIZE windowSize = { lround(newSize.Width), lround(newSize.Height) }; - host->setNewClientSize(windowSize); + host->setNewClientSize(newSize); } } @@ -74,6 +73,6 @@ class SwapChainPanelSizeChangedHandler : std::weak_ptr<InspectableNativeWindow> mHost; }; -HRESULT GetSwapChainPanelSize(const ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> &swapChainPanel, RECT *windowSize); +HRESULT GetSwapChainPanelSize(const ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> &swapChainPanel, RECT *windowSize, bool *scalingActive = nullptr); } #endif // LIBANGLE_RENDERER_D3D_D3D11_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_ diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c index a61198a954..51223aef1f 100644 --- a/src/3rdparty/forkfd/forkfd.c +++ b/src/3rdparty/forkfd/forkfd.c @@ -25,9 +25,8 @@ #ifndef _GNU_SOURCE # define _GNU_SOURCE -# define _POSIX_C_SOURCE 200809L -# define _XOPEN_SOURCE 700 #endif + #include "forkfd.h" #include <sys/types.h> @@ -44,6 +43,7 @@ #include <unistd.h> #ifdef __linux__ +# define HAVE_WAIT4 1 # if defined(__BIONIC__) || (defined(__GLIBC__) && (__GLIBC__ << 8) + __GLIBC_MINOR__ >= 0x207 && \ (!defined(__UCLIBC__) || ((__UCLIBC_MAJOR__ << 16) + (__UCLIBC_MINOR__ << 8) + __UCLIBC_SUBLEVEL__ > 0x921))) # include <sys/eventfd.h> @@ -54,6 +54,9 @@ # define HAVE_PIPE2 1 # endif #endif +#if defined(__FreeBSD__) && __FreeBSD__ >= 9 +# include <sys/procdesc.h> +#endif #if _POSIX_VERSION-0 >= 200809L || _XOPEN_VERSION-0 >= 500 # define HAVE_WAITID 1 @@ -62,6 +65,10 @@ #if defined(__FreeBSD__) # define HAVE_PIPE2 1 #endif +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) || \ + defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) +# define HAVE_WAIT4 1 +#endif #if defined(__APPLE__) /* Up until OS X 10.7, waitid(P_ALL, ...) will return success, but will not @@ -194,12 +201,33 @@ static int isChildReady(pid_t pid, siginfo_t *info) } #endif +static void convertStatusToForkfdInfo(int status, struct forkfd_info *info) +{ + if (WIFEXITED(status)) { + info->code = CLD_EXITED; + info->status = WEXITSTATUS(status); + } else if (WIFSIGNALED(status)) { + info->code = CLD_KILLED; +# ifdef WCOREDUMP + if (WCOREDUMP(status)) + info->code = CLD_DUMPED; +# endif + info->status = WTERMSIG(status); + } +} + static int tryReaping(pid_t pid, struct pipe_payload *payload) { /* reap the child */ -#ifdef HAVE_WAITID +#if defined(HAVE_WAIT4) + int status; + if (wait4(pid, &status, WNOHANG, &payload->rusage) <= 0) + return 0; + convertStatusToForkfdInfo(status, &payload->info); +#else +# if defined(HAVE_WAITID) if (waitid_works) { - // we have waitid(2), which fills in siginfo_t for us + /* we have waitid(2), which gets us some payload values on some systems */ siginfo_t info; info.si_pid = 0; int ret = waitid(P_PID, pid, &info, WEXITED | WNOHANG) == 0 && info.si_pid == pid; @@ -208,30 +236,20 @@ static int tryReaping(pid_t pid, struct pipe_payload *payload) payload->info.code = info.si_code; payload->info.status = info.si_status; -# ifdef __linux__ +# ifdef __linux__ payload->rusage.ru_utime.tv_sec = info.si_utime / CLOCKS_PER_SEC; payload->rusage.ru_utime.tv_usec = info.si_utime % CLOCKS_PER_SEC; payload->rusage.ru_stime.tv_sec = info.si_stime / CLOCKS_PER_SEC; payload->rusage.ru_stime.tv_usec = info.si_stime % CLOCKS_PER_SEC; -# endif +# endif return 1; } -#endif +# endif // HAVE_WAITID int status; if (waitpid(pid, &status, WNOHANG) <= 0) return 0; // child did not change state - - if (WIFEXITED(status)) { - payload->info.code = CLD_EXITED; - payload->info.status = WEXITSTATUS(status); - } else if (WIFSIGNALED(status)) { - payload->info.code = CLD_KILLED; -# ifdef WCOREDUMP - if (WCOREDUMP(status)) - payload->info.code = CLD_DUMPED; -# endif - payload->info.status = WTERMSIG(status); - } + convertStatusToForkfdInfo(status, &payload->info); +#endif // !HAVE_WAIT4 return 1; } @@ -491,6 +509,55 @@ static int create_pipe(int filedes[], int flags) return ret; } +#if defined(FORKFD_NO_SPAWNFD) && defined(__FreeBSD__) && __FreeBSD__ >= 9 +# if __FreeBSD__ == 9 +/* PROCDESC is an optional feature in the kernel and wasn't enabled + * by default on FreeBSD 9. So we need to check for it at runtime. */ +static ffd_atomic_int system_has_forkfd = FFD_ATOMIC_INIT(1); +# else +/* On FreeBSD 10, PROCDESC was enabled by default. On v11, it's not an option + * anymore and can't be disabled. */ +static const int system_has_forkfd = 1; +# endif + +static int system_forkfd(int flags, pid_t *ppid) +{ + int ret; + pid_t pid; + pid = pdfork(&ret, PD_DAEMON); + if (__builtin_expect(pid == -1, 0)) { +# if __FreeBSD__ == 9 + if (errno == ENOSYS) { + /* PROCDESC wasn't compiled into the kernel: don't try it again. */ + ffd_atomic_store(&system_has_forkfd, 0, FFD_ATOMIC_RELAXED); + } +# endif + return -1; + } + if (pid == 0) { + /* child process */ + return FFD_CHILD_PROCESS; + } + + /* parent process */ + if (flags & FFD_CLOEXEC) + fcntl(ret, F_SETFD, FD_CLOEXEC); + if (flags & FFD_NONBLOCK) + fcntl(ret, F_SETFL, fcntl(ret, F_GETFL) | O_NONBLOCK); + if (ppid) + *ppid = pid; + return ret; +} +#else +static const int system_has_forkfd = 0; +static int system_forkfd(int flags, pid_t *ppid) +{ + (void)flags; + (void)ppid; + return -1; +} +#endif + #ifndef FORKFD_NO_FORKFD /** * @brief forkfd returns a file descriptor representing a child process @@ -538,6 +605,12 @@ int forkfd(int flags, pid_t *ppid) int efd; #endif + if (system_has_forkfd) { + ret = system_forkfd(flags, ppid); + if (system_has_forkfd) + return ret; + } + (void) pthread_once(&forkfd_initialization, forkfd_initialize); info = allocateInfo(&header); @@ -661,6 +734,8 @@ int spawnfd(int flags, pid_t *ppid, const char *path, const posix_spawn_file_act /* we can only do work if we have a way to start the child in stopped mode; * otherwise, we have a major race condition. */ + assert(!system_has_forkfd); + (void) pthread_once(&forkfd_initialization, forkfd_initialize); info = allocateInfo(&header); @@ -717,6 +792,26 @@ int forkfd_wait(int ffd, forkfd_info *info, struct rusage *rusage) struct pipe_payload payload; int ret; + if (system_has_forkfd) { +#if defined(__FreeBSD__) && __FreeBSD__ >= 9 + pid_t pid; + int status; + int options = WEXITED; + + ret = pdgetpid(ffd, &pid); + if (ret == -1) + return ret; + ret = fcntl(ffd, F_GETFL); + if (ret == -1) + return ret; + options |= (ret & O_NONBLOCK) ? WNOHANG : 0; + ret = wait4(pid, &status, options, rusage); + if (ret != -1 && info) + convertStatusToForkfdInfo(status, info); + return ret == -1 ? -1 : 0; +#endif + } + ret = read(ffd, &payload, sizeof(payload)); if (ret == -1) return ret; /* pass errno, probably EINTR, EBADF or EWOULDBLOCK */ diff --git a/src/3rdparty/harfbuzz-ng/src/hb-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-private.hh index 06b24a80f8..06d7f228a7 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-private.hh +++ b/src/3rdparty/harfbuzz-ng/src/hb-private.hh @@ -121,16 +121,17 @@ # if defined(_WIN32_WCE) /* Some things not defined on Windows CE. */ +# define strdup _strdup # define getenv(Name) NULL -# define setlocale(Category, Locale) "C" +# if _WIN32_WCE < 0x800 +# define setlocale(Category, Locale) "C" static int errno = 0; /* Use something better? */ +# endif # elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) # define getenv(Name) NULL # endif -# if (defined(__WIN32__) && !defined(__WINE__)) || defined(_MSC_VER) +# if defined(_MSC_VER) && _MSC_VER < 1900 # define snprintf _snprintf - /* Windows CE only has _strdup, while rest of Windows has both. */ -# define strdup _strdup # endif #endif diff --git a/src/3rdparty/sha3/KeccakF-1600-32-rvk.macros b/src/3rdparty/sha3/KeccakF-1600-32-rvk.macros index c0c9029873..c0c9029873 100755..100644 --- a/src/3rdparty/sha3/KeccakF-1600-32-rvk.macros +++ b/src/3rdparty/sha3/KeccakF-1600-32-rvk.macros diff --git a/src/3rdparty/sha3/KeccakF-1600-32.macros b/src/3rdparty/sha3/KeccakF-1600-32.macros index 9ade600067..9ade600067 100755..100644 --- a/src/3rdparty/sha3/KeccakF-1600-32.macros +++ b/src/3rdparty/sha3/KeccakF-1600-32.macros diff --git a/src/3rdparty/sha3/KeccakF-1600-64.macros b/src/3rdparty/sha3/KeccakF-1600-64.macros index 0c20bca40f..0c20bca40f 100755..100644 --- a/src/3rdparty/sha3/KeccakF-1600-64.macros +++ b/src/3rdparty/sha3/KeccakF-1600-64.macros diff --git a/src/3rdparty/sha3/KeccakF-1600-int-set.h b/src/3rdparty/sha3/KeccakF-1600-int-set.h index 0ed1d802e3..0ed1d802e3 100755..100644 --- a/src/3rdparty/sha3/KeccakF-1600-int-set.h +++ b/src/3rdparty/sha3/KeccakF-1600-int-set.h diff --git a/src/3rdparty/sha3/KeccakF-1600-interface.h b/src/3rdparty/sha3/KeccakF-1600-interface.h index ce2710eeb2..ce2710eeb2 100755..100644 --- a/src/3rdparty/sha3/KeccakF-1600-interface.h +++ b/src/3rdparty/sha3/KeccakF-1600-interface.h diff --git a/src/3rdparty/sha3/KeccakF-1600-opt32-settings.h b/src/3rdparty/sha3/KeccakF-1600-opt32-settings.h index b135918ca9..b135918ca9 100755..100644 --- a/src/3rdparty/sha3/KeccakF-1600-opt32-settings.h +++ b/src/3rdparty/sha3/KeccakF-1600-opt32-settings.h diff --git a/src/3rdparty/sha3/KeccakF-1600-opt32.c b/src/3rdparty/sha3/KeccakF-1600-opt32.c index 4e32dca9cb..4e32dca9cb 100755..100644 --- a/src/3rdparty/sha3/KeccakF-1600-opt32.c +++ b/src/3rdparty/sha3/KeccakF-1600-opt32.c diff --git a/src/3rdparty/sha3/KeccakF-1600-opt64-settings.h b/src/3rdparty/sha3/KeccakF-1600-opt64-settings.h index 8f16ada636..8f16ada636 100755..100644 --- a/src/3rdparty/sha3/KeccakF-1600-opt64-settings.h +++ b/src/3rdparty/sha3/KeccakF-1600-opt64-settings.h diff --git a/src/3rdparty/sha3/KeccakF-1600-unrolling.macros b/src/3rdparty/sha3/KeccakF-1600-unrolling.macros index 83c694ca48..83c694ca48 100755..100644 --- a/src/3rdparty/sha3/KeccakF-1600-unrolling.macros +++ b/src/3rdparty/sha3/KeccakF-1600-unrolling.macros diff --git a/src/3rdparty/sha3/KeccakNISTInterface.c b/src/3rdparty/sha3/KeccakNISTInterface.c index e530a11db5..e530a11db5 100755..100644 --- a/src/3rdparty/sha3/KeccakNISTInterface.c +++ b/src/3rdparty/sha3/KeccakNISTInterface.c diff --git a/src/3rdparty/sha3/KeccakNISTInterface.h b/src/3rdparty/sha3/KeccakNISTInterface.h index cd85f24aa7..cd85f24aa7 100755..100644 --- a/src/3rdparty/sha3/KeccakNISTInterface.h +++ b/src/3rdparty/sha3/KeccakNISTInterface.h diff --git a/src/3rdparty/sha3/KeccakSponge.c b/src/3rdparty/sha3/KeccakSponge.c index 6f3da95dbb..6f3da95dbb 100755..100644 --- a/src/3rdparty/sha3/KeccakSponge.c +++ b/src/3rdparty/sha3/KeccakSponge.c diff --git a/src/3rdparty/sha3/KeccakSponge.h b/src/3rdparty/sha3/KeccakSponge.h index 8bb11a8a1d..8bb11a8a1d 100755..100644 --- a/src/3rdparty/sha3/KeccakSponge.h +++ b/src/3rdparty/sha3/KeccakSponge.h diff --git a/src/3rdparty/sha3/brg_endian.h b/src/3rdparty/sha3/brg_endian.h index 7226eb3bec..7226eb3bec 100755..100644 --- a/src/3rdparty/sha3/brg_endian.h +++ b/src/3rdparty/sha3/brg_endian.h diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c index ff78701615..06f6d154f1 100644 --- a/src/3rdparty/sqlite/sqlite3.c +++ b/src/3rdparty/sqlite/sqlite3.c @@ -35209,6 +35209,7 @@ static void winLogIoerr(int nRetry, int lineno){ ** create a substitute. */ /* #include <time.h> */ +# if _WIN32_WCE < 0x800 struct tm *__cdecl localtime(const time_t *t) { static struct tm y; @@ -35230,6 +35231,7 @@ struct tm *__cdecl localtime(const time_t *t) y.tm_sec = pTm.wSecond; return &y; } +# endif #endif #define HANDLE_TO_WINFILE(a) (winFile*)&((char*)a)[-(int)offsetof(winFile,h)] diff --git a/src/3rdparty/zlib/0001-Fix-WEC2013-build-of-zlib.patch b/src/3rdparty/zlib/0001-Fix-WEC2013-build-of-zlib.patch new file mode 100644 index 0000000000..ef6fb33eed --- /dev/null +++ b/src/3rdparty/zlib/0001-Fix-WEC2013-build-of-zlib.patch @@ -0,0 +1,26 @@ +From f2652cfd83f34ec3e70a936e5ea9f8623b66bd95 Mon Sep 17 00:00:00 2001 +From: Bjoern Breitmeyer <bjoern.breitmeyer@kdab.com> +Date: Fri, 27 Mar 2015 15:46:59 +0100 +Subject: [PATCH] Fix WEC2013 build of zlib. + +Change-Id: I4d1908f1175ed39e2df8717fb0b5a17befe88744 +--- + src/3rdparty/zlib/zutil.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/3rdparty/zlib/zutil.h b/src/3rdparty/zlib/zutil.h +index 8e535ac..4d367a9 100644 +--- a/src/3rdparty/zlib/zutil.h ++++ b/src/3rdparty/zlib/zutil.h +@@ -143,7 +143,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + #endif + + #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX +-# if defined(_WIN32_WCE) ++# if defined(_WIN32_WCE) && _WIN32_WCE < 0x800 + # define fdopen(fd,mode) NULL /* No fdopen() */ + # ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +-- +1.8.1.msysgit.1 + diff --git a/src/3rdparty/zlib/zutil.h b/src/3rdparty/zlib/zutil.h index 8e535acf40..4d367a92db 100644 --- a/src/3rdparty/zlib/zutil.h +++ b/src/3rdparty/zlib/zutil.h @@ -143,7 +143,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #endif #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) +# if defined(_WIN32_WCE) && _WIN32_WCE < 0x800 # define fdopen(fd,mode) NULL /* No fdopen() */ # ifndef _PTRDIFF_T_DEFINED typedef int ptrdiff_t; |