[*] Checkout 6.4 (stable, to forward port) and fixup Windows 7 regressions
Change-Id: I476bd9de253720bf87827f3ff3ff279728634197
This commit is contained in:
parent
d39353085e
commit
21b26bac26
@ -345,6 +345,10 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
|
||||
|
||||
Q_Q(QEventDispatcherWin32);
|
||||
|
||||
// literally who? none of this shit matters under aurora
|
||||
// timers are driven either via a timed condvar aware of all or io timers limited to the kernels frequency and spurious yield checks.
|
||||
// fuck relying on win32 and legacy multi-media timers to receive updoot notifications
|
||||
|
||||
bool ok = false;
|
||||
ULONG tolerance = calculateNextTimeout(t, qt_msectime());
|
||||
uint interval = t->interval;
|
||||
@ -359,11 +363,7 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
|
||||
TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS);
|
||||
ok = t->fastTimerId;
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
// user normal timers for (Very)CoarseTimers, or if no more multimedia timers available
|
||||
ok = SetCoalescableTimer(internalHwnd, t->timerId, interval, nullptr, tolerance);
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
ok = SetTimer(internalHwnd, t->timerId, interval, nullptr);
|
||||
|
||||
|
@ -15,16 +15,16 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <qdeadlinetimer.h>
|
||||
#include <private/qglobal_p.h>
|
||||
#include <QtCore/qtsan_impl.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtDummyFutex {
|
||||
constexpr inline bool futexAvailable() { return false; }
|
||||
template <typename Atomic>
|
||||
inline bool futexWait(Atomic &, typename Atomic::Type, QDeadlineTimer = {})
|
||||
{ Q_UNREACHABLE_RETURN(false); }
|
||||
inline bool futexWait(Atomic &, typename Atomic::Type, int = 0)
|
||||
{ Q_UNREACHABLE(); return false; }
|
||||
template <typename Atomic> inline void futexWakeOne(Atomic &)
|
||||
{ Q_UNREACHABLE(); }
|
||||
template <typename Atomic> inline void futexWakeAll(Atomic &)
|
||||
@ -33,16 +33,116 @@ namespace QtDummyFutex {
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
# include "qfutex_mac_p.h"
|
||||
#elif defined(Q_OS_FREEBSD)
|
||||
# include "qfutex_freebsd_p.h"
|
||||
#elif defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
|
||||
#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
|
||||
// use Linux mutexes everywhere except for LSB builds
|
||||
# include "qfutex_linux_p.h"
|
||||
# include <sys/syscall.h>
|
||||
# include <errno.h>
|
||||
# include <limits.h>
|
||||
# include <unistd.h>
|
||||
# include <asm/unistd.h>
|
||||
# include <linux/futex.h>
|
||||
# define QT_ALWAYS_USE_FUTEX
|
||||
|
||||
// if not defined in linux/futex.h
|
||||
# define FUTEX_PRIVATE_FLAG 128 // added in v2.6.22
|
||||
|
||||
// RISC-V does not supply __NR_futex
|
||||
# ifndef __NR_futex
|
||||
# define __NR_futex __NR_futex_time64
|
||||
# endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace QtLinuxFutex {
|
||||
constexpr inline bool futexAvailable() { return true; }
|
||||
inline int _q_futex(int *addr, int op, int val, quintptr val2 = 0,
|
||||
int *addr2 = nullptr, int val3 = 0) noexcept
|
||||
{
|
||||
QtTsan::futexRelease(addr, addr2);
|
||||
|
||||
// we use __NR_futex because some libcs (like Android's bionic) don't
|
||||
// provide SYS_futex etc.
|
||||
int result = syscall(__NR_futex, addr, op | FUTEX_PRIVATE_FLAG, val, val2, addr2, val3);
|
||||
|
||||
QtTsan::futexAcquire(addr, addr2);
|
||||
|
||||
return result;
|
||||
}
|
||||
template <typename T> int *addr(T *ptr)
|
||||
{
|
||||
int *int_addr = reinterpret_cast<int *>(ptr);
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
if (sizeof(T) > sizeof(int))
|
||||
int_addr++; //We want a pointer to the least significant half
|
||||
#endif
|
||||
return int_addr;
|
||||
}
|
||||
|
||||
template <typename Atomic>
|
||||
inline void futexWait(Atomic &futex, typename Atomic::Type expectedValue)
|
||||
{
|
||||
_q_futex(addr(&futex), FUTEX_WAIT, qintptr(expectedValue));
|
||||
}
|
||||
template <typename Atomic>
|
||||
inline bool futexWait(Atomic &futex, typename Atomic::Type expectedValue, qint64 nstimeout)
|
||||
{
|
||||
struct timespec ts;
|
||||
ts.tv_sec = nstimeout / 1000 / 1000 / 1000;
|
||||
ts.tv_nsec = nstimeout % (1000 * 1000 * 1000);
|
||||
int r = _q_futex(addr(&futex), FUTEX_WAIT, qintptr(expectedValue), quintptr(&ts));
|
||||
return r == 0 || errno != ETIMEDOUT;
|
||||
}
|
||||
template <typename Atomic> inline void futexWakeOne(Atomic &futex)
|
||||
{
|
||||
_q_futex(addr(&futex), FUTEX_WAKE, 1);
|
||||
}
|
||||
template <typename Atomic> inline void futexWakeAll(Atomic &futex)
|
||||
{
|
||||
_q_futex(addr(&futex), FUTEX_WAKE, INT_MAX);
|
||||
}
|
||||
template <typename Atomic> inline
|
||||
void futexWakeOp(Atomic &futex1, int wake1, int wake2, Atomic &futex2, quint32 op)
|
||||
{
|
||||
_q_futex(addr(&futex1), FUTEX_WAKE_OP, wake1, wake2, addr(&futex2), op);
|
||||
}
|
||||
}
|
||||
namespace QtFutex = QtLinuxFutex;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#elif defined(Q_OS_WIN)
|
||||
# include "qfutex_win_p.h"
|
||||
# include <qt_windows.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace QtWindowsFutex {
|
||||
//#define QT_ALWAYS_USE_FUTEX
|
||||
constexpr inline bool futexAvailable() { return true; }
|
||||
|
||||
template <typename Atomic>
|
||||
inline void futexWait(Atomic &futex, typename Atomic::Type expectedValue)
|
||||
{
|
||||
QtTsan::futexRelease(&futex);
|
||||
//WaitOnAddress(&futex, &expectedValue, sizeof(expectedValue), INFINITE);
|
||||
QtTsan::futexAcquire(&futex);
|
||||
}
|
||||
template <typename Atomic>
|
||||
inline bool futexWait(Atomic &futex, typename Atomic::Type expectedValue, qint64 nstimeout)
|
||||
{
|
||||
return false;
|
||||
//BOOL r = WaitOnAddress(&futex, &expectedValue, sizeof(expectedValue), DWORD(nstimeout / 1000 / 1000));
|
||||
//return r || GetLastError() != ERROR_TIMEOUT;
|
||||
}
|
||||
template <typename Atomic> inline void futexWakeAll(Atomic &futex)
|
||||
{
|
||||
//WakeByAddressAll(&futex);
|
||||
}
|
||||
template <typename Atomic> inline void futexWakeOne(Atomic &futex)
|
||||
{
|
||||
//WakeByAddressSingle(&futex);
|
||||
}
|
||||
}
|
||||
namespace QtFutex = QtWindowsFutex;
|
||||
QT_END_NAMESPACE
|
||||
#else
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace QtFutex = QtDummyFutex;
|
||||
QT_END_NAMESPACE
|
||||
|
@ -34,7 +34,7 @@ static QColor qt_mix_colors(QColor a, QColor b)
|
||||
*/
|
||||
static void qt_placeholder_from_text(QPalette &pal, int alpha = 50)
|
||||
{
|
||||
if (alpha < 0 or alpha > 100)
|
||||
if (alpha < 0 || alpha > 100)
|
||||
return;
|
||||
|
||||
for (int cg = 0; cg < int(QPalette::NColorGroups); ++cg) {
|
||||
|
@ -153,10 +153,19 @@ inline Int aligned(Int v, Int byteAlign)
|
||||
return (v + byteAlign - 1) & ~(byteAlign - 1);
|
||||
}
|
||||
|
||||
typedef HRESULT (__stdcall * Annoying_f)(UINT Flags, REFIID riid, void **ppFactory) ;
|
||||
|
||||
static IDXGIFactory1 *createDXGIFactory2()
|
||||
{
|
||||
IDXGIFactory1 *result = nullptr;
|
||||
const HRESULT hr = CreateDXGIFactory2(0, __uuidof(IDXGIFactory2), reinterpret_cast<void **>(&result));
|
||||
|
||||
auto hDXGI = LoadLibraryW(L"DXGI.dll");
|
||||
auto pCreateDXGIFactory2 = reinterpret_cast<Annoying_f>(GetProcAddress(hDXGI, "CreateDXGIFactory2"));
|
||||
if (!pCreateDXGIFactory2) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const HRESULT hr = pCreateDXGIFactory2(0, __uuidof(IDXGIFactory2), reinterpret_cast<void **>(&result));
|
||||
if (FAILED(hr)) {
|
||||
qWarning("CreateDXGIFactory2() failed to create DXGI factory: %s",
|
||||
qPrintable(QSystemError::windowsComString(hr)));
|
||||
|
Loading…
Reference in New Issue
Block a user