From abf9dfd5c20f97585ce267b2688969c5d8701590 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <slouken@libsdl.org>
Date: Mon, 9 Nov 2020 10:11:38 -0800
Subject: [PATCH] Fix MakeThreadRealtime DBus method call on Linux, type
 mismatch due to copy paste.

Nov 02 20:34:15 redcore rtkit-daemon[2825]: Failed to parse MakeThreadRealtime() method call: Argument 1 is specified to be of type "uint32", but is actually of type "int32"
Nov 02 20:34:15 redcore rtkit-daemon[2825]: Failed to parse MakeThreadRealtime() method call: Argument 1 is specified to be of type "uint32", but is actually of type "int32"

Docs:

http://git.0pointer.net/rtkit.git/tree/README

CLIENTS:
        To be able to make use of realtime scheduling clients may
        request so with a small D-Bus interface that is accessible on
        the interface org.freedesktop.RealtimeKit1 as object
        /org/freedesktop/RealtimeKit1 on the service
        org.freedesktop.RealtimeKit1:

                void MakeThreadRealtime(u64 thread_id, u32 priority);

                void MakeThreadHighPriority(u64 thread_id, s32 priority);
---
 Xcode/SDL/SDL.xcodeproj/project.pbxproj | 0
 src/core/linux/SDL_threadprio.c         | 8 ++++----
 2 files changed, 4 insertions(+), 4 deletions(-)
 mode change 100644 => 100755 Xcode/SDL/SDL.xcodeproj/project.pbxproj

diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
old mode 100644
new mode 100755
diff --git a/src/core/linux/SDL_threadprio.c b/src/core/linux/SDL_threadprio.c
index 67be27a4a..937c376a3 100644
--- a/src/core/linux/SDL_threadprio.c
+++ b/src/core/linux/SDL_threadprio.c
@@ -162,13 +162,13 @@ static SDL_bool
 rtkit_setpriority_realtime(pid_t thread, int rt_priority)
 {
     Uint64 ui64 = (Uint64)thread;
-    Sint32 si32 = (Sint32)rt_priority;
+    Uint32 ui32 = (Uint32)rt_priority;
     SDL_DBusContext *dbus = SDL_DBus_GetContext();
 
     pthread_once(&rtkit_initialize_once, rtkit_initialize);
 
-    if (si32 > rtkit_max_realtime_priority)
-        si32 = rtkit_max_realtime_priority;
+    if (ui32 > rtkit_max_realtime_priority)
+        ui32 = rtkit_max_realtime_priority;
 
     // We always perform the thread state changes necessary for rtkit.
     // This wastes some system calls if the state is already set but
@@ -180,7 +180,7 @@ rtkit_setpriority_realtime(pid_t thread, int rt_priority)
 
     if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn,
             RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MakeThreadRealtime",
-            DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_INT32, &si32, DBUS_TYPE_INVALID,
+            DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_UINT32, &ui32, DBUS_TYPE_INVALID,
             DBUS_TYPE_INVALID)) {
         return SDL_FALSE;
     }