Name: mused
Summary: A multimedia daemon
-Version: 0.3.172
+Version: 0.3.173
Release: 0
Group: System/Libraries
License: Apache-2.0
BuildRequires: pkgconfig(libresourced)
BuildRequires: pkgconfig(lwipc)
BuildRequires: pkgconfig(ttrace)
+BuildRequires: pkgconfig(capi-system-resource)
%else
BuildRequires: pkgconfig(storage)
BuildRequires: pkgconfig(mm-resource-manager)
%endif
%if ("%{_vd_cfg_product_type}" == "AUDIO") || ("%{_vd_cfg_product_type}" == "TV") || ("%{_vd_cfg_product_type}" == "LFD") || ("%{_vd_cfg_product_type}" == "HTV") || ("%{_vd_cfg_product_type}" == "AV") || ("%{_vd_cfg_product_type}" == "IWB") || ("%{_vd_cfg_product_type}" == "WALL")
-%cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIBDIR=%{_libdir} -DTZ_SYS_DATA=%TZ_SYS_DATA -DMUSE_REGISTER_VIP=1 -DMUSE_TTRACE_ENABLE=1 -DMUSE_LWIPC_ENABLE=1
+%cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIBDIR=%{_libdir} -DTZ_SYS_DATA=%TZ_SYS_DATA -DMUSE_REGISTER_VIP=1 -DMUSE_TTRACE_ENABLE=1 -DMUSE_LWIPC_ENABLE=1 -DMUSE_BOOST_ENABLE=1
%else
export CFLAGS+=" -DMUSE_USE_POWER_OFF_STATE_CHANGE -DMUSE_USE_WATCHDOG"
%cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIBDIR=%{_libdir} -DTZ_SYS_DATA=%TZ_SYS_DATA -DMUSE_GTESTS_BUILD=%{?gtests:1}%{!?gtests:0} -DMUSE_STORAGE_ENABLE=1
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMUSE_USE_EXTERNAL_STORAGE_STATE_CHANGE")
ENDIF(${MUSE_STORAGE_ENABLE})
+IF(${MUSE_BOOST_ENABLE})
+SET(dependents ${dependents} " capi-system-resource")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMUSE_USE_BOOST")
+ENDIF(${MUSE_BOOST_ENABLE})
+
INCLUDE(FindPkgConfig)
pkg_check_modules(${MUSE_SERVER} REQUIRED ${dependents})
FOREACH(flag ${${MUSE_SERVER}_CFLAGS})
#include <malloc.h>
#include <tzplatform_config.h>
+#ifdef MUSE_USE_BOOST
+#include <cpu-boosting.h>
+#endif
+
#if !GLIB_CHECK_VERSION(2, 58, 0)
#define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void)) (f))
#endif
static void _ms_launch_foreground(void);
static void _ms_daemonize(void);
+#ifdef MUSE_USE_BOOST
+gboolean _ms_boosting_start(void)
+{
+ pid_t current_pid = getpid();
+ resource_pid_t res_pid = {
+ .pid = 0,
+ .tid = ¤t_pid,
+ .tid_count = 1,
+ };
+
+ // flags, timeout parameter is not working on VD
+ int ret = resource_set_cpu_boosting(res_pid, CPU_BOOSTING_LEVEL_STRONG, (cpu_boosting_flag_e)0, -1);
+ if (ret != 0) {
+ LOGE("resource_set_cpu_boosting() is failed. error %d", ret);
+ return FALSE;
+ }
+
+ LOGI("Leave");
+
+ return TRUE;
+}
+
+gboolean _ms_boosting_stop(void)
+{
+ pid_t current_pid = getpid();
+ resource_pid_t res_pid = {
+ .pid = 0,
+ .tid = ¤t_pid,
+ .tid_count = 1,
+ };
+
+ int ret = resource_clear_cpu_boosting(res_pid);
+ if (ret != 0) {
+ LOGE("resource_clear_cpu_boosting() is failed. error: %d", ret);
+ return FALSE;
+ }
+
+ LOGI("Leave");
+
+ return TRUE;
+}
+#endif
+
+void _ms_boosting_init(void)
+{
+ muse_server->boost.is_boosted = FALSE;
+
+#ifdef MUSE_USE_BOOST
+ muse_server->boost.start_func = _ms_boosting_start;
+ muse_server->boost.stop_func = _ms_boosting_stop;
+#endif
+}
+
#ifdef MUSE_USE_LWIPC
static void _ms_wait_event(void);
muse_server = g_new0(muse_server_t, 1);
+ _ms_boosting_init();
+
for (idx = 1; argv[idx] != NULL; idx++) {
if (strcmp(argv[idx], "-D") == 0) {
LOGI("enable daemonize");
else
_ms_launch_foreground();
+ if (muse_server->boost.start_func)
+ muse_server->boost.is_boosted = muse_server->boost.start_func();
+
#ifdef MUSE_VIP_REGISTERED
proc_stat_set_vip_process();
#endif
muse_core_setenv("GCOV_PREFIX", "/tmp", 1);
#endif
+ if (muse_server->boost.is_boosted)
+ muse_server->boost.is_boosted = !muse_server->boost.stop_func();
+
LOGW("Leave");
}