daemon: Using mm-boosting api if cpu boosting is enabled. 10/295410/3 accepted/tizen/unified/20230713.014432
authorjungsup lee <jungsup4.lee@samsung.com>
Thu, 6 Jul 2023 12:21:34 +0000 (21:21 +0900)
committerjungsup lee <jungsup4.lee@samsung.com>
Fri, 7 Jul 2023 11:20:36 +0000 (20:20 +0900)
[Version] 15.0-21
[Issue Type] Performance

Change-Id: I0e7117fa6ce2609302f55a08ec52c58531d3609d

meson.build
packaging/pulseaudio.spec
src/meson.build
src/pulse/meson.build
src/pulse/util.c [changed mode: 0644->0755]

index 590c126..b053c92 100644 (file)
@@ -650,6 +650,9 @@ if lwipc_dep.found()
   cdata.set('TIZEN_TV_PROD_LWIPC', 1)
 endif
 
+boost_tv_dep = dependency('capi-boost-tv', required : get_option('cpu-boosting'))
+system_info_dep = dependency('capi-system-info', required : get_option('cpu-boosting'))
+
 if get_option('aec')
   cdata.set('TIZEN_AEC', 1)
 endif
@@ -1056,6 +1059,7 @@ summary = [
   '  aec:                         @0@'.format(get_option('aec')),
   '  prelink (for TV):            @0@'.format(get_option('prelink')),
   '  lwipc (for TV):              @0@'.format(get_option('lwipc')),
+  '  cpu-boosting (for TV):       @0@'.format(get_option('cpu-boosting')),
 ]
 
 message('\n    '.join(summary))
index 2b95125..6dd74de 100644 (file)
@@ -4,7 +4,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          15.0
-Release:          20
+Release:          21
 Group:            Multimedia/Audio
 License:          LGPL-2.1
 URL:              http://pulseaudio.org
@@ -36,6 +36,8 @@ BuildRequires:    libcap-devel
 BuildRequires:    doxygen
 %if "%{tizen_profile_name}" == "tv"
 BuildRequires:    pkgconfig(lwipc)
+BuildRequires:    pkgconfig(capi-boost-tv)
+BuildRequires:    pkgconfig(capi-system-info)
 %endif
 Requires:         udev
 Requires(post):   /sbin/ldconfig
index 895a24f..a4d1d90 100644 (file)
@@ -200,7 +200,8 @@ libpulsecommon = shared_library('pulsecommon-' + pa_version_major_minor,
     libm_dep, thread_dep, dl_dep, shm_dep, iconv_dep, sndfile_dep, dbus_dep,
     x11_dep, libsystemd_dep, glib_dep.partial_dependency(compile_args: true),
     gtk_dep.partial_dependency(compile_args: true), asyncns_dep, libintl_dep,
-    platform_dep, tcpwrap_dep, platform_socket_dep, execinfo_dep, dlog_dep
+    platform_dep, tcpwrap_dep, platform_socket_dep, execinfo_dep, dlog_dep,
+    boost_tv_dep, system_info_dep
   ],
   implicit_include_directories : false)
 
index c2128e0..dd2f998 100644 (file)
@@ -85,7 +85,7 @@ libpulse = shared_library('pulse',
   link_args : [nodelete_link_args, versioning_link_args],
   install : true,
   install_rpath : privlibdir,
-  dependencies : [libm_dep, thread_dep, libpulsecommon_dep, dbus_dep, dl_dep, iconv_dep, libintl_dep, platform_dep, platform_socket_dep],
+  dependencies : [libm_dep, thread_dep, libpulsecommon_dep, dbus_dep, dl_dep, iconv_dep, libintl_dep, platform_dep, platform_socket_dep, boost_tv_dep, system_info_dep],
   implicit_include_directories : false)
 
 libpulse_dep = declare_dependency(link_with: libpulse)
old mode 100644 (file)
new mode 100755 (executable)
index d1bb386..73cbfc1
@@ -99,6 +99,13 @@ static int _main() PA_GCC_WEAKREF(main);
 #include <pulsecore/rtkit.h>
 #endif
 
+#ifdef TIZEN_TV_PROD_CPU_BOOSTING
+#include <system_info.h>
+#include <boost-api.h>
+
+#define FMS_KEY_PROJECTOR_TYPE "com.samsung/featureconf/projector_feature_support"
+#endif
+
 char *pa_get_user_name(char *s, size_t l) {
     const char *p;
     char *name = NULL;
@@ -372,6 +379,43 @@ int pa_msleep(unsigned long t) {
 #endif
 }
 
+#ifdef TIZEN_TV_PROD_CPU_BOOSTING
+static int set_cpu_boosting(const char* feature_type) {
+    bool is_supported = false;
+    int boost_ret = 0;
+
+    if (system_info_get_custom_bool(feature_type, &is_supported))
+        pa_log_error("Get %s failed", feature_type);
+
+    pa_log_info("%s is %s", feature_type, is_supported ? "supported" : "not supported");
+
+    if (!is_supported)
+        return -1;
+
+    boost_mm_info_t mm_info;
+    pid_t process_id = getpid();
+    pid_t thread_id = gettid();
+
+    mm_info.parent.framework_type = BOOST_MM_FW;
+    mm_info.status = BOOST_MM_STATUS_REGISTER;
+    mm_info.type = BOOST_MM_TYPE_VIDEO;
+    mm_info.mmPid = process_id;
+
+    boost_ret = boost_request_by_tid(thread_id, (const boost_info_t *)&mm_info);
+    pa_log_info("boost_request_by_tid(), pid(%d), tid(%d) : %d", process_id, thread_id, boost_ret);
+
+    mm_info.parent.framework_type = BOOST_MM_FW;
+    mm_info.status = BOOST_MM_STATUS_START;
+    mm_info.type = BOOST_MM_TYPE_VIDEO;
+    mm_info.mmPid = process_id;
+
+    boost_ret = boost_request_by_pid(process_id, (const boost_info_t *)&mm_info);
+    pa_log_info("Feature is supported, using boost_request_by_pid() : %d", boost_ret);
+
+    return 0;
+}
+#endif
+
 #ifdef _POSIX_PRIORITY_SCHEDULING
 static int set_scheduler(int rtprio) {
 #ifdef HAVE_SCHED_H
@@ -387,6 +431,12 @@ static int set_scheduler(int rtprio) {
 
     dbus_error_init(&error);
 #endif
+#ifdef TIZEN_TV_PROD_CPU_BOOSTING
+    if (set_cpu_boosting(FMS_KEY_PROJECTOR_TYPE) == 0) {
+        pa_log_debug("set_cpu_boosting worked.");
+        return 0;
+    }
+#endif
 
     pa_zero(sp);
     sp.sched_priority = rtprio;