Add version of so files
[platform/core/multimedia/libmm-camcorder.git] / src / mm_camcorder_boost.c
1 /*
2  * libmm-camcorder
3  *
4  * Copyright (c) 2022 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: jaekyu shim <jae915@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22  /*=======================================================================================
23 |  INCLUDE FILES                                                                        |
24 ========================================================================================*/
25 #ifdef _MMCAMCORDER_CAMERA_BOOST_SUPPORT
26 #include <boost-api.h>
27 #include "mm_camcorder_internal.h"
28 #include "mm_camcorder_boost.h"
29
30
31 static void __apply_thread_boosting(const boost_generic_info_t *generic_info)
32 {
33         int ret = 0;
34         const char *thread_list[] = {
35                 "vsrc_q-src",
36                 "vsink_q-src",
37                 "vsrc_s-src"
38         };
39         const int thread_list_size = sizeof(thread_list) / sizeof(char *);
40
41         pid_t pid = getpid();
42
43         for (int i = 0 ; i < thread_list_size ; i++) {
44                 ret = boost_request_by_thread_name(pid, thread_list[i], (const boost_info_t *)generic_info);
45                 MMCAM_LOG_INFO("apply boosting thread[%11s], event[%d], sched[%d] : ret[%d]",
46                                 thread_list[i], generic_info->event, generic_info->sched, ret);
47         }
48 }
49
50 void _mmcamcorder_start_boosting(void)
51 {
52         boost_generic_info_t generic_info = {
53                 .parent.framework_type = BOOST_GENERIC,
54                 .event = BOOST_GENERIC_EVENT_START,
55                 .group = BOOST_CGROUP_END,
56                 .sched = BOOST_API_SCHED_RR,
57                 .boostingTimeMs = 0
58         };
59
60         __apply_thread_boosting(&generic_info);
61 }
62
63 void _mmcamcorder_stop_boosting(void)
64 {
65         boost_generic_info_t generic_info = {
66                 .parent.framework_type = BOOST_GENERIC,
67                 .event = BOOST_GENERIC_EVENT_STOP,
68                 .group = BOOST_CGROUP_END,
69                 .sched = BOOST_API_SCHED_OTHER,
70                 .boostingTimeMs = 0
71         };
72
73         __apply_thread_boosting(&generic_info);
74 }
75
76 #endif /* _MMCAMCORDER_CAMERA_BOOST_SUPPORT*/
77