mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 14:40:56 +00:00
Don't use CAMetalDisplayLink on Intel Macs
When in Direct mode, skipping a frame will cause the display to flash black on Tahoe.
This commit is contained in:
@@ -9,6 +9,9 @@
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
#include <mach/machine.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
VTBaseRenderer::VTBaseRenderer(IFFmpegRenderer::RendererType type) :
|
||||
IFFmpegRenderer(type),
|
||||
m_HdrMetadataChanged(false),
|
||||
@@ -27,6 +30,23 @@ VTBaseRenderer::~VTBaseRenderer() {
|
||||
}
|
||||
}
|
||||
|
||||
bool VTBaseRenderer::isAppleSilicon() {
|
||||
static uint32_t cpuType = 0;
|
||||
if (cpuType == 0) {
|
||||
size_t size = sizeof(cpuType);
|
||||
int err = sysctlbyname("hw.cputype", &cpuType, &size, NULL, 0);
|
||||
if (err != 0) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"sysctlbyname(hw.cputype) failed: %d", err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Apple Silicon Macs have CPU_ARCH_ABI64 set, so we need to mask that off.
|
||||
// For some reason, 64-bit Intel Macs don't seem to have CPU_ARCH_ABI64 set.
|
||||
return (cpuType & ~CPU_ARCH_MASK) == CPU_TYPE_ARM;
|
||||
}
|
||||
|
||||
bool VTBaseRenderer::checkDecoderCapabilities(id<MTLDevice> device, PDECODER_PARAMETERS params) {
|
||||
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_H264)) {
|
||||
|
||||
Reference in New Issue
Block a user