mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 06:30:55 +00:00
Avoid using LFS64 interfaces with Musl
This commit is contained in:
+3
-3
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
// Qt's DRM master FD grabbed by our hook
|
// Qt's DRM master FD grabbed by our hook
|
||||||
int g_QtDrmMasterFd = -1;
|
int g_QtDrmMasterFd = -1;
|
||||||
struct stat64 g_DrmMasterStat;
|
struct stat g_DrmMasterStat;
|
||||||
|
|
||||||
// The DRM master FD created for SDL
|
// The DRM master FD created for SDL
|
||||||
int g_SdlDrmMasterFd = -1;
|
int g_SdlDrmMasterFd = -1;
|
||||||
@@ -55,7 +55,7 @@ int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
|
|||||||
// EGLFS backend's DRM FD, on which we will call drmDropMaster() later.
|
// EGLFS backend's DRM FD, on which we will call drmDropMaster() later.
|
||||||
if (g_QtDrmMasterFd == -1 && drmIsMaster(fd)) {
|
if (g_QtDrmMasterFd == -1 && drmIsMaster(fd)) {
|
||||||
g_QtDrmMasterFd = fd;
|
g_QtDrmMasterFd = fd;
|
||||||
fstat64(g_QtDrmMasterFd, &g_DrmMasterStat);
|
fstat(g_QtDrmMasterFd, &g_DrmMasterStat);
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Captured Qt EGLFS DRM master fd (legacy): %d",
|
"Captured Qt EGLFS DRM master fd (legacy): %d",
|
||||||
g_QtDrmMasterFd);
|
g_QtDrmMasterFd);
|
||||||
@@ -73,7 +73,7 @@ int drmModeAtomicCommit(int fd, drmModeAtomicReqPtr req,
|
|||||||
// EGLFS backend's DRM FD, on which we will call drmDropMaster() later.
|
// EGLFS backend's DRM FD, on which we will call drmDropMaster() later.
|
||||||
if (g_QtDrmMasterFd == -1 && drmIsMaster(fd)) {
|
if (g_QtDrmMasterFd == -1 && drmIsMaster(fd)) {
|
||||||
g_QtDrmMasterFd = fd;
|
g_QtDrmMasterFd = fd;
|
||||||
fstat64(g_QtDrmMasterFd, &g_DrmMasterStat);
|
fstat(g_QtDrmMasterFd, &g_DrmMasterStat);
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Captured Qt EGLFS DRM master fd (atomic): %d",
|
"Captured Qt EGLFS DRM master fd (atomic): %d",
|
||||||
g_QtDrmMasterFd);
|
g_QtDrmMasterFd);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#if SDL_VERSION_ATLEAST(2, 0, 15)
|
#if SDL_VERSION_ATLEAST(2, 0, 15)
|
||||||
|
|
||||||
extern int g_QtDrmMasterFd;
|
extern int g_QtDrmMasterFd;
|
||||||
extern struct stat64 g_DrmMasterStat;
|
extern struct stat g_DrmMasterStat;
|
||||||
extern int g_SdlDrmMasterFd;
|
extern int g_SdlDrmMasterFd;
|
||||||
|
|
||||||
int openHook(const char *funcname, const char *pathname, int flags, va_list va)
|
int openHook(const char *funcname, const char *pathname, int flags, va_list va)
|
||||||
@@ -50,9 +50,9 @@ int openHook(const char *funcname, const char *pathname, int flags, va_list va)
|
|||||||
if (fd >= 0 && g_QtDrmMasterFd != -1) {
|
if (fd >= 0 && g_QtDrmMasterFd != -1) {
|
||||||
if (strncmp(pathname, "/dev/dri/card", 13) == 0) {
|
if (strncmp(pathname, "/dev/dri/card", 13) == 0) {
|
||||||
// It's a DRM device, but is it _our_ DRM device?
|
// It's a DRM device, but is it _our_ DRM device?
|
||||||
struct stat64 fdstat;
|
struct stat fdstat;
|
||||||
|
|
||||||
fstat64(fd, &fdstat);
|
fstat(fd, &fdstat);
|
||||||
if (g_DrmMasterStat.st_dev == fdstat.st_dev &&
|
if (g_DrmMasterStat.st_dev == fdstat.st_dev &&
|
||||||
g_DrmMasterStat.st_ino == fdstat.st_ino) {
|
g_DrmMasterStat.st_ino == fdstat.st_ino) {
|
||||||
// It is our device. Time to do the magic!
|
// It is our device. Time to do the magic!
|
||||||
|
|||||||
@@ -746,7 +746,11 @@ bool DrmRenderer::mapSoftwareFrame(AVFrame *frame, AVDRMFrameDescriptor *mappedF
|
|||||||
// This leads to issues when DRM_IOCTL_MODE_MAP_DUMB returns a > 4GB offset. The high bits are
|
// This leads to issues when DRM_IOCTL_MODE_MAP_DUMB returns a > 4GB offset. The high bits are
|
||||||
// chopped off when passed via the normal mmap() call using 32-bit off_t. We avoid this issue
|
// chopped off when passed via the normal mmap() call using 32-bit off_t. We avoid this issue
|
||||||
// by explicitly calling mmap64() to ensure the 64-bit offset is never truncated.
|
// by explicitly calling mmap64() to ensure the 64-bit offset is never truncated.
|
||||||
|
#if defined(__GLIBC__) && QT_POINTER_SIZE == 4
|
||||||
drmFrame->mapping = (uint8_t*)mmap64(nullptr, drmFrame->size, PROT_WRITE, MAP_SHARED, m_DrmFd, mapBuf.offset);
|
drmFrame->mapping = (uint8_t*)mmap64(nullptr, drmFrame->size, PROT_WRITE, MAP_SHARED, m_DrmFd, mapBuf.offset);
|
||||||
|
#else
|
||||||
|
drmFrame->mapping = (uint8_t*)mmap(nullptr, drmFrame->size, PROT_WRITE, MAP_SHARED, m_DrmFd, mapBuf.offset);
|
||||||
|
#endif
|
||||||
if (drmFrame->mapping == MAP_FAILED) {
|
if (drmFrame->mapping == MAP_FAILED) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"mmap() failed for dumb buffer: %d",
|
"mmap() failed for dumb buffer: %d",
|
||||||
|
|||||||
Reference in New Issue
Block a user