mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-18 10:32:38 +00:00
Only use the VT rasterization workaround on Apple silicon
This commit is contained in:
parent
a58649fd10
commit
fcf7ed4faa
@ -10,6 +10,8 @@
|
|||||||
#include <streaming/session.h>
|
#include <streaming/session.h>
|
||||||
|
|
||||||
#include <mach/mach_time.h>
|
#include <mach/mach_time.h>
|
||||||
|
#include <mach/machine.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import <VideoToolbox/VideoToolbox.h>
|
#import <VideoToolbox/VideoToolbox.h>
|
||||||
#import <AVFoundation/AVFoundation.h>
|
#import <AVFoundation/AVFoundation.h>
|
||||||
@ -350,11 +352,21 @@ public:
|
|||||||
m_DisplayLayer.videoGravity = AVLayerVideoGravityResizeAspect;
|
m_DisplayLayer.videoGravity = AVLayerVideoGravityResizeAspect;
|
||||||
m_DisplayLayer.opaque = YES;
|
m_DisplayLayer.opaque = YES;
|
||||||
|
|
||||||
// This workaround prevents the image from going through processing that doesn't preserve
|
// This workaround prevents the image from going through processing that causes some
|
||||||
// the colorspace information properly in some cases. HDR seems to be okay without this,
|
// color artifacts in some cases. HDR seems to be okay without this, so we'll exclude
|
||||||
// so we'll exclude it out of caution.
|
// it out of caution. The artifacts seem to be far more significant on M1 Macs and
|
||||||
// See https://github.com/moonlight-stream/moonlight-qt/issues/493 for more details.
|
// the workaround can cause performance regressions on Intel Macs, so only use this
|
||||||
|
// on Apple silicon.
|
||||||
|
//
|
||||||
|
// https://github.com/moonlight-stream/moonlight-qt/issues/493
|
||||||
|
// https://github.com/moonlight-stream/moonlight-qt/issues/722
|
||||||
if (params->videoFormat != VIDEO_FORMAT_H265_MAIN10) {
|
if (params->videoFormat != VIDEO_FORMAT_H265_MAIN10) {
|
||||||
|
int err;
|
||||||
|
uint32_t cpuType;
|
||||||
|
size_t size = sizeof(cpuType);
|
||||||
|
|
||||||
|
err = sysctlbyname("hw.cputype", &cpuType, &size, NULL, 0);
|
||||||
|
if (err == 0 && cpuType == CPU_TYPE_ARM) {
|
||||||
if (info.info.cocoa.window.screen != nullptr) {
|
if (info.info.cocoa.window.screen != nullptr) {
|
||||||
m_DisplayLayer.shouldRasterize = YES;
|
m_DisplayLayer.shouldRasterize = YES;
|
||||||
m_DisplayLayer.rasterizationScale = info.info.cocoa.window.screen.backingScaleFactor;
|
m_DisplayLayer.rasterizationScale = info.info.cocoa.window.screen.backingScaleFactor;
|
||||||
@ -365,6 +377,11 @@ public:
|
|||||||
SDL_assert(false);
|
SDL_assert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (err != 0) {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"sysctlbyname(hw.cputype) failed: %d", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create a layer-hosted view by setting the layer before wantsLayer
|
// Create a layer-hosted view by setting the layer before wantsLayer
|
||||||
// This avoids us having to add our AVSampleBufferDisplayLayer as a
|
// This avoids us having to add our AVSampleBufferDisplayLayer as a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user