Compare commits

...

16 Commits

Author SHA1 Message Date
hoholee12 866f91f0fc
Merge 4695e9c1f5 into 66eae05e75 2024-09-19 01:06:24 +02:00
capriots 66eae05e75 cellAtracXdec: fix FFmpeg warning 2024-09-18 07:57:10 +02:00
hoholee12 4695e9c1f5
Merge branch 'master' into master 2023-09-04 13:45:15 +09:00
hoholee12 328d73c1a9
Merge branch 'master' into master 2023-07-28 12:44:23 +09:00
hoholee12 0ce786cd78 fix 2023-07-25 20:21:16 +09:00
hoholee12 ca381b07e9 Merge branch 'master' of https://github.com/hoholee12/rpcs3 2023-07-25 18:05:34 +09:00
hoholee12 4300857108 remove nonroot 2023-07-25 18:03:45 +09:00
Elad Ashkenazi 37957530f9
Merge branch 'master' into master 2023-07-25 11:15:06 +03:00
hoholee12 b9257cf0a3 remove spaces 2023-07-25 15:55:46 +09:00
hoholee12 445bae198b Root user gets proper privilege 2023-07-25 15:53:40 +09:00
hoholee12 db4c960a3b Root user gets proper privilege 2023-07-25 15:52:59 +09:00
Elad Ashkenazi 45023d298b
Merge branch 'master' into master 2023-07-24 08:41:20 +03:00
hoholee12 3d1f527652 FIx Cirrus Linux build not compiling 2023-07-24 23:26:47 +09:00
hoholee12 cf785e2ad6 oops 2023-07-24 00:27:36 +09:00
hoholee12 e5c1fea20a oops 2023-07-24 00:26:13 +09:00
hoholee12 8163aaf7de Linux: fix thread priority 2023-07-23 22:52:23 +09:00
2 changed files with 21 additions and 0 deletions

View File

@ -53,6 +53,8 @@ DYNAMIC_IMPORT_RENAME("Kernel32.dll", SetThreadDescriptionImport, "SetThreadDesc
#include <sys/syscall.h>
#include <sys/timerfd.h>
#include <unistd.h>
#include <sys/syscall.h>
#define gettid() syscall(SYS_gettid)
#endif
#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
@ -3090,6 +3092,24 @@ void thread_ctrl::set_native_priority(int priority)
{
sig_log.error("SetThreadPriority() failed: %s", fmt::win_error{GetLastError(), nullptr});
}
#elif defined(__linux__)
// available niceness for root: -20~19
id_t threadpid = gettid();
uid_t euid = geteuid();
if (euid == 0)
{
int linuxprio = 0;
if (priority > 0)
linuxprio = -6;
else if (priority < 0)
linuxprio = 6;
if (int err = setpriority(PRIO_PROCESS, threadpid, linuxprio))
{
sig_log.error("setpriority(%d, %d) failed: %d", threadpid, linuxprio, err);
}
}
#else
int policy;
struct sched_param param;

View File

@ -121,6 +121,7 @@ void AtracXdecDecoder::alloc_avcodec()
// Allows FFmpeg to output directly into guest memory
ctx->opaque = this;
ctx->thread_type = FF_THREAD_SLICE; // Silences a warning by FFmpeg about requesting frame threading with a custom get_buffer2(). Default is FF_THREAD_FRAME & FF_THREAD_SLICE
ctx->get_buffer2 = [](AVCodecContext* s, AVFrame* frame, int /*flags*/) -> int
{
for (s32 i = 0; i < frame->ch_layout.nb_channels; i++)