Disable ananicy-cpp when scx sched is used, reneabled when one is disabled

This commit is contained in:
ferreo 2025-01-15 13:36:05 +00:00
parent 5a628d9dc3
commit b49a6afe13
5 changed files with 34 additions and 3 deletions

View File

@ -1 +1 @@
2
3

View File

@ -1,3 +1,9 @@
falcond (1.0.3-101pika1) pika; urgency=low
* Disable ananicy-cpp when scx sched is used, reneable when one is disabled
-- ferreo <ferreo@pika-os.com> Sun, 12 Jan 2025 13:48:00 +0300
falcond (1.0.2-101pika1) pika; urgency=low
* Minor fix for race condition during profile reloadings

View File

@ -193,6 +193,10 @@ fn isSchedulerSupported(scheduler: ScxScheduler) bool {
}
pub fn activateScheduler(alloc: std.mem.Allocator, scheduler: ScxScheduler, mode: ?ScxSchedModes) ScxError!void {
if (scheduler != .none) {
runSystemCtl(alloc, "stop", "ananicy-cpp");
}
var dbus_conn = dbus.DBus.init(alloc, SCX_NAME, SCX_PATH, SCX_IFACE);
const mode_str = try std.fmt.allocPrint(alloc, "{d}", .{modeToInt(mode orelse .default)});
@ -236,9 +240,30 @@ pub fn applyScheduler(alloc: std.mem.Allocator, scheduler: ScxScheduler, mode: ?
};
}
fn runSystemCtl(alloc: std.mem.Allocator, command: []const u8, service: []const u8) void {
const argv = [_][]const u8{ "systemctl", command, service };
const max_output_size = 1024;
const result = std.process.Child.run(.{
.allocator = alloc,
.argv = &argv,
.max_output_bytes = max_output_size,
}) catch |err| {
std.log.warn("Failed to run systemctl {s} {s}: {}", .{ command, service, err });
return;
};
defer alloc.free(result.stderr);
defer alloc.free(result.stdout);
if (result.term.Exited != 0) {
std.log.warn("systemctl failed: {s}", .{result.stderr});
return;
}
}
pub fn deactivateScheduler(alloc: std.mem.Allocator) ScxError!void {
var dbus_conn = dbus.DBus.init(alloc, SCX_NAME, SCX_PATH, SCX_IFACE);
try dbus_conn.callMethod("StopScheduler", &[_][]const u8{});
runSystemCtl(alloc, "start", "ananicy-cpp");
}
pub fn restorePreviousState(alloc: std.mem.Allocator) void {

View File

@ -15,7 +15,7 @@ var previous_mode_buffer: [10]u8 = undefined;
pub fn applyVCacheMode(vcache_mode: VCacheMode) void {
const file = fs.openFileAbsolute(vcache_path, .{ .mode = .read_write }) catch |err| switch (err) {
error.FileNotFound => {
std.log.info("AMD 3D vcache support not detected", .{});
std.log.info("AMD dual CCD 3D vcache support not detected", .{});
return;
},
else => {

View File

@ -2,7 +2,7 @@
set -e
VERSION="1.0.2"
VERSION="1.0.3"
source ./pika-build-config.sh