core: use pthread_setschedparam across the board

I think I was trying to avoid introducing pthread as a dependency, but
now we are using pthread for SGI_video_sync thread anyway. Let's remove
the ifdefs.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-02-10 20:29:39 +00:00
parent 709f0168d9
commit dff77aae27
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
2 changed files with 4 additions and 20 deletions

View File

@ -23,7 +23,7 @@ required_xcb_packages = [
# Some XCB packages are here because their versioning differs (see check below). # Some XCB packages are here because their versioning differs (see check below).
required_packages = [ required_packages = [
'pixman-1', 'x11', 'x11-xcb', 'xcb-image', 'xcb-renderutil', 'xcb-util', 'pixman-1', 'x11', 'x11-xcb', 'xcb-image', 'xcb-renderutil', 'xcb-util',
'xext' 'xext', 'threads',
] ]
foreach i : required_packages foreach i : required_packages
@ -59,7 +59,7 @@ endif
if get_option('opengl') if get_option('opengl')
cflags += ['-DCONFIG_OPENGL', '-DGL_GLEXT_PROTOTYPES'] cflags += ['-DCONFIG_OPENGL', '-DGL_GLEXT_PROTOTYPES']
deps += [dependency('gl', required: true), dependency('egl', required: true), dependency('threads', required:true)] deps += [dependency('gl', required: true), dependency('egl', required: true)]
srcs += [ 'opengl.c' ] srcs += [ 'opengl.c' ]
endif endif
@ -86,10 +86,6 @@ elif (host_system == 'freebsd' or host_system == 'netbsd' or
cflags += ['-DHAS_KQUEUE'] cflags += ['-DHAS_KQUEUE']
endif endif
if host_system == 'openbsd'
deps += [dependency('threads', required: true)]
endif
subdir('backend') subdir('backend')
picom = executable('picom', srcs, c_args: cflags, picom = executable('picom', srcs, c_args: cflags,

View File

@ -19,6 +19,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <inttypes.h> #include <inttypes.h>
#include <math.h> #include <math.h>
#include <pthread.h>
#include <sched.h> #include <sched.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
@ -35,9 +36,6 @@
#include <xcb/render.h> #include <xcb/render.h>
#include <xcb/sync.h> #include <xcb/sync.h>
#include <xcb/xfixes.h> #include <xcb/xfixes.h>
#ifdef __OpenBSD__
#include <pthread.h>
#endif
#include <ev.h> #include <ev.h>
#include <test.h> #include <test.h>
@ -2590,14 +2588,8 @@ void set_rr_scheduling(void) {
int ret; int ret;
struct sched_param param; struct sched_param param;
#ifndef __OpenBSD__
ret = sched_getparam(0, &param);
#else
int old_policy; int old_policy;
ret = pthread_getschedparam(pthread_self(), &old_policy, &param); ret = pthread_getschedparam(pthread_self(), &old_policy, &param);
#endif
if (ret != 0) { if (ret != 0) {
log_debug("Failed to get old scheduling priority"); log_debug("Failed to get old scheduling priority");
return; return;
@ -2605,12 +2597,7 @@ void set_rr_scheduling(void) {
param.sched_priority = priority; param.sched_priority = priority;
#ifndef __OpenBSD__
ret = sched_setscheduler(0, SCHED_RR, &param);
#else
ret = pthread_setschedparam(pthread_self(), SCHED_RR, &param); ret = pthread_setschedparam(pthread_self(), SCHED_RR, &param);
#endif
if (ret != 0) { if (ret != 0) {
log_info("Failed to set real-time scheduling priority to %d. Consider " log_info("Failed to set real-time scheduling priority to %d. Consider "
"giving picom the CAP_SYS_NICE capability or equivalent " "giving picom the CAP_SYS_NICE capability or equivalent "
@ -2618,6 +2605,7 @@ void set_rr_scheduling(void) {
priority); priority);
return; return;
} }
log_info("Set real-time scheduling priority to %d", priority); log_info("Set real-time scheduling priority to %d", priority);
} }