1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-11 13:51:02 -05:00

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).
required_packages = [
'pixman-1', 'x11', 'x11-xcb', 'xcb-image', 'xcb-renderutil', 'xcb-util',
'xext'
'xext', 'threads',
]
foreach i : required_packages
@ -59,7 +59,7 @@ endif
if get_option('opengl')
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' ]
endif
@ -86,10 +86,6 @@ elif (host_system == 'freebsd' or host_system == 'netbsd' or
cflags += ['-DHAS_KQUEUE']
endif
if host_system == 'openbsd'
deps += [dependency('threads', required: true)]
endif
subdir('backend')
picom = executable('picom', srcs, c_args: cflags,

View file

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