Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
a2c3d34fb2 | |||
36a90a297d | |||
54a7b7dc73 | |||
75d6d24d2f | |||
67c3f96ae6 |
2
.github/release-nest-v3
vendored
2
.github/release-nest-v3
vendored
@ -1 +1 @@
|
|||||||
3
|
1
|
@ -1,4 +1,10 @@
|
|||||||
falcond (1.0.9-101pika1) pika; urgency=low
|
falcond (1.1.0-101pika1) pika; urgency=low
|
||||||
|
|
||||||
|
* Fix memory leak on error, fix power ppd being required for falcond to launch.
|
||||||
|
|
||||||
|
-- ferreo <ferreo@pika-os.com> Sun, 12 Jan 2025 13:48:00 +0300
|
||||||
|
|
||||||
|
falcond (1.0.9-101pika2) pika; urgency=low
|
||||||
|
|
||||||
* Config parsing fixes
|
* Config parsing fixes
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ pub const PowerProfiles = struct {
|
|||||||
original_profile: ?[]const u8,
|
original_profile: ?[]const u8,
|
||||||
has_performance: bool,
|
has_performance: bool,
|
||||||
|
|
||||||
pub fn init(allocator: std.mem.Allocator, config: Config) !*PowerProfiles {
|
pub fn init(allocator: std.mem.Allocator, config: Config) !?*PowerProfiles {
|
||||||
var self = try allocator.create(PowerProfiles);
|
var self = try allocator.create(PowerProfiles);
|
||||||
errdefer allocator.destroy(self);
|
errdefer allocator.destroy(self);
|
||||||
|
|
||||||
@ -37,7 +37,11 @@ pub const PowerProfiles = struct {
|
|||||||
.has_performance = false,
|
.has_performance = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const profiles = try self.getAvailableProfiles(allocator);
|
const profiles = self.getAvailableProfiles(allocator) catch |err| {
|
||||||
|
std.log.err("Failed to get power profiles: {}, power profiles will be disabled", .{err});
|
||||||
|
allocator.destroy(self);
|
||||||
|
return null;
|
||||||
|
};
|
||||||
defer {
|
defer {
|
||||||
for (profiles) |profile| {
|
for (profiles) |profile| {
|
||||||
allocator.free(profile);
|
allocator.free(profile);
|
||||||
|
@ -15,7 +15,7 @@ pub const Daemon = struct {
|
|||||||
profile_manager: ProfileManager,
|
profile_manager: ProfileManager,
|
||||||
oneshot: bool,
|
oneshot: bool,
|
||||||
known_pids: ?std.AutoHashMap(u32, *const Profile),
|
known_pids: ?std.AutoHashMap(u32, *const Profile),
|
||||||
power_profiles: *PowerProfiles,
|
power_profiles: ?*PowerProfiles,
|
||||||
performance_mode: bool,
|
performance_mode: bool,
|
||||||
last_profiles_check: i128,
|
last_profiles_check: i128,
|
||||||
last_config_check: i128,
|
last_config_check: i128,
|
||||||
@ -30,13 +30,17 @@ pub const Daemon = struct {
|
|||||||
const system_conf_path_owned = try allocator.dupe(u8, system_conf_path);
|
const system_conf_path_owned = try allocator.dupe(u8, system_conf_path);
|
||||||
errdefer allocator.free(system_conf_path_owned);
|
errdefer allocator.free(system_conf_path_owned);
|
||||||
|
|
||||||
const config = try Config.load(allocator, config_path, system_conf_path);
|
var config = try Config.load(allocator, config_path, system_conf_path);
|
||||||
const power_profiles = try PowerProfiles.init(allocator, config);
|
errdefer config.deinit();
|
||||||
errdefer power_profiles.deinit();
|
|
||||||
|
|
||||||
const performance_mode = power_profiles.isPerformanceAvailable();
|
const power_profiles = try PowerProfiles.init(allocator, config);
|
||||||
if (performance_mode) {
|
var performance_mode = false;
|
||||||
std.log.info("Performance profile available - power profile management enabled", .{});
|
|
||||||
|
if (power_profiles) |pp| {
|
||||||
|
performance_mode = pp.isPerformanceAvailable();
|
||||||
|
if (performance_mode) {
|
||||||
|
std.log.info("Performance profile available - power profile management enabled", .{});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var profile_manager = ProfileManager.init(allocator, power_profiles, config);
|
var profile_manager = ProfileManager.init(allocator, power_profiles, config);
|
||||||
@ -66,7 +70,9 @@ pub const Daemon = struct {
|
|||||||
pub fn deinit(self: *Self) void {
|
pub fn deinit(self: *Self) void {
|
||||||
scx_scheds.deinit();
|
scx_scheds.deinit();
|
||||||
self.profile_manager.deinit();
|
self.profile_manager.deinit();
|
||||||
self.power_profiles.deinit();
|
if (self.power_profiles) |pp| {
|
||||||
|
pp.*.deinit();
|
||||||
|
}
|
||||||
if (self.known_pids) |*map| {
|
if (self.known_pids) |*map| {
|
||||||
map.deinit();
|
map.deinit();
|
||||||
}
|
}
|
||||||
@ -86,7 +92,9 @@ pub const Daemon = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.profile_manager.deinit();
|
self.profile_manager.deinit();
|
||||||
self.power_profiles.deinit();
|
if (self.power_profiles) |pp| {
|
||||||
|
pp.*.deinit();
|
||||||
|
}
|
||||||
self.config.deinit();
|
self.config.deinit();
|
||||||
|
|
||||||
const config = try Config.load(self.allocator, self.config_path, self.system_conf_path);
|
const config = try Config.load(self.allocator, self.config_path, self.system_conf_path);
|
||||||
@ -96,7 +104,7 @@ pub const Daemon = struct {
|
|||||||
|
|
||||||
self.config = config;
|
self.config = config;
|
||||||
self.power_profiles = power_profiles;
|
self.power_profiles = power_profiles;
|
||||||
self.performance_mode = self.power_profiles.isPerformanceAvailable();
|
self.performance_mode = if (power_profiles) |pp| pp.isPerformanceAvailable() else false;
|
||||||
self.profile_manager = profile_manager;
|
self.profile_manager = profile_manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,10 +14,10 @@ pub const ProfileManager = struct {
|
|||||||
proton_profile: ?*const Profile,
|
proton_profile: ?*const Profile,
|
||||||
active_profile: ?*const Profile = null,
|
active_profile: ?*const Profile = null,
|
||||||
queued_profiles: std.ArrayList(*const Profile),
|
queued_profiles: std.ArrayList(*const Profile),
|
||||||
power_profiles: *PowerProfiles,
|
power_profiles: ?*PowerProfiles,
|
||||||
config: Config,
|
config: Config,
|
||||||
|
|
||||||
pub fn init(allocator: std.mem.Allocator, power_profiles: *PowerProfiles, config: Config) ProfileManager {
|
pub fn init(allocator: std.mem.Allocator, power_profiles: ?*PowerProfiles, config: Config) ProfileManager {
|
||||||
return .{
|
return .{
|
||||||
.allocator = allocator,
|
.allocator = allocator,
|
||||||
.profiles = std.ArrayList(Profile).init(allocator),
|
.profiles = std.ArrayList(Profile).init(allocator),
|
||||||
@ -47,9 +47,9 @@ pub const ProfileManager = struct {
|
|||||||
std.log.info("Activating profile: {s}", .{profile.name});
|
std.log.info("Activating profile: {s}", .{profile.name});
|
||||||
self.active_profile = profile;
|
self.active_profile = profile;
|
||||||
|
|
||||||
if (profile.performance_mode and self.power_profiles.isPerformanceAvailable()) {
|
if (profile.performance_mode and self.power_profiles != null and self.power_profiles.?.isPerformanceAvailable()) {
|
||||||
std.log.info("Enabling performance mode for profile: {s}", .{profile.name});
|
std.log.info("Enabling performance mode for profile: {s}", .{profile.name});
|
||||||
self.power_profiles.enablePerformanceMode();
|
self.power_profiles.?.enablePerformanceMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
const effective_mode = if (self.config.vcache_mode != .none)
|
const effective_mode = if (self.config.vcache_mode != .none)
|
||||||
@ -80,9 +80,9 @@ pub const ProfileManager = struct {
|
|||||||
if (active == profile) {
|
if (active == profile) {
|
||||||
std.log.info("Deactivating profile: {s}", .{profile.name});
|
std.log.info("Deactivating profile: {s}", .{profile.name});
|
||||||
|
|
||||||
if (profile.performance_mode and self.power_profiles.isPerformanceAvailable()) {
|
if (profile.performance_mode and self.power_profiles != null and self.power_profiles.?.isPerformanceAvailable()) {
|
||||||
std.log.info("Disabling performance mode for profile: {s}", .{profile.name});
|
std.log.info("Disabling performance mode for profile: {s}", .{profile.name});
|
||||||
self.power_profiles.disablePerformanceMode();
|
self.power_profiles.?.disablePerformanceMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
vcache_setting.applyVCacheMode(.none);
|
vcache_setting.applyVCacheMode(.none);
|
||||||
@ -102,9 +102,9 @@ pub const ProfileManager = struct {
|
|||||||
if (active == profile) {
|
if (active == profile) {
|
||||||
std.log.info("Unloading profile: {s}", .{profile.name});
|
std.log.info("Unloading profile: {s}", .{profile.name});
|
||||||
|
|
||||||
if (profile.performance_mode and self.power_profiles.isPerformanceAvailable()) {
|
if (profile.performance_mode and self.power_profiles != null and self.power_profiles.?.isPerformanceAvailable()) {
|
||||||
std.log.info("Disabling performance mode for profile: {s}", .{profile.name});
|
std.log.info("Disabling performance mode for profile: {s}", .{profile.name});
|
||||||
self.power_profiles.disablePerformanceMode();
|
self.power_profiles.?.disablePerformanceMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
vcache_setting.applyVCacheMode(.none);
|
vcache_setting.applyVCacheMode(.none);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user