mirror of
https://github.com/Evolution-X-Devices/device_google_wahoo
synced 2026-01-31 07:34:34 +00:00
Merge "Enable Encoder hint for camera powersaving" into oc-dr1-dev
am: b02fb17265
Change-Id: I98209d95ed47a8427d80a5a5039f48755db286be
This commit is contained in:
@@ -196,57 +196,26 @@ static int process_boost(int boost_handle, int duration)
|
||||
return boost_handle;
|
||||
}
|
||||
|
||||
static int process_video_encode_hint(void *metadata)
|
||||
static int process_video_encode_hint(void *data)
|
||||
{
|
||||
char governor[80];
|
||||
struct video_encode_metadata_t video_encode_metadata;
|
||||
static int boost_handle = -1;
|
||||
|
||||
if(!metadata)
|
||||
return HINT_NONE;
|
||||
|
||||
if (get_scaling_governor(governor, sizeof(governor)) == -1) {
|
||||
ALOGE("Can't obtain scaling governor.");
|
||||
|
||||
return HINT_NONE;
|
||||
}
|
||||
|
||||
/* Initialize encode metadata struct fields */
|
||||
memset(&video_encode_metadata, 0, sizeof(struct video_encode_metadata_t));
|
||||
video_encode_metadata.state = -1;
|
||||
video_encode_metadata.hint_id = DEFAULT_VIDEO_ENCODE_HINT_ID;
|
||||
|
||||
if (parse_video_encode_metadata((char *)metadata, &video_encode_metadata) ==
|
||||
-1) {
|
||||
ALOGE("Error occurred while parsing metadata.");
|
||||
return HINT_NONE;
|
||||
}
|
||||
|
||||
if (video_encode_metadata.state == 1) {
|
||||
int duration = 2000; // boosts 2s for starting encoding
|
||||
if (data) {
|
||||
// TODO: remove the launch boost based on camera launch time
|
||||
int duration = 1500; // boosts 1.5s for starting encoding
|
||||
boost_handle = process_boost(boost_handle, duration);
|
||||
ALOGD("LAUNCH ENCODER-ON: %d MS", duration);
|
||||
if (is_interactive_governor(governor)) {
|
||||
|
||||
int *resource_values;
|
||||
int resources;
|
||||
|
||||
/* extract perflock resources */
|
||||
resource_values = getPowerhint(video_encode_metadata.hint_id, &resources);
|
||||
|
||||
if (resource_values != NULL)
|
||||
perform_hint_action(video_encode_metadata.hint_id, resource_values, resources);
|
||||
ALOGI("Video Encode hint start");
|
||||
return HINT_HANDLED;
|
||||
} else {
|
||||
return HINT_HANDLED;
|
||||
}
|
||||
} else if (video_encode_metadata.state == 0) {
|
||||
if (is_interactive_governor(governor)) {
|
||||
undo_hint_action(video_encode_metadata.hint_id);
|
||||
ALOGI("Video Encode hint stop");
|
||||
return HINT_HANDLED;
|
||||
}
|
||||
int *resource_values = NULL;
|
||||
int resources = 0;
|
||||
resource_values = getPowerhint(DEFAULT_VIDEO_ENCODE_HINT_ID, &resources);
|
||||
if (resource_values != NULL)
|
||||
perform_hint_action(DEFAULT_VIDEO_ENCODE_HINT_ID, resource_values, resources);
|
||||
ALOGI("Video Encode hint start");
|
||||
return HINT_HANDLED;
|
||||
} else {
|
||||
undo_hint_action(DEFAULT_VIDEO_ENCODE_HINT_ID);
|
||||
ALOGI("Video Encode hint stop");
|
||||
return HINT_HANDLED;
|
||||
}
|
||||
return HINT_NONE;
|
||||
}
|
||||
|
||||
@@ -104,112 +104,6 @@ void power_init(void)
|
||||
ALOGI("QCOM power HAL initing.");
|
||||
}
|
||||
|
||||
static void process_video_decode_hint(void *metadata)
|
||||
{
|
||||
char governor[80];
|
||||
struct video_decode_metadata_t video_decode_metadata;
|
||||
|
||||
if (get_scaling_governor(governor, sizeof(governor)) == -1) {
|
||||
ALOGE("Can't obtain scaling governor.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (metadata) {
|
||||
ALOGI("Processing video decode hint. Metadata: %s", (char *)metadata);
|
||||
}
|
||||
|
||||
/* Initialize encode metadata struct fields. */
|
||||
memset(&video_decode_metadata, 0, sizeof(struct video_decode_metadata_t));
|
||||
video_decode_metadata.state = -1;
|
||||
video_decode_metadata.hint_id = DEFAULT_VIDEO_DECODE_HINT_ID;
|
||||
|
||||
if (metadata) {
|
||||
if (parse_video_decode_metadata((char *)metadata, &video_decode_metadata) ==
|
||||
-1) {
|
||||
ALOGE("Error occurred while parsing metadata.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (video_decode_metadata.state == 1) {
|
||||
if ((strncmp(governor, ONDEMAND_GOVERNOR, strlen(ONDEMAND_GOVERNOR)) == 0) &&
|
||||
(strlen(governor) == strlen(ONDEMAND_GOVERNOR))) {
|
||||
int resource_values[] = {THREAD_MIGRATION_SYNC_OFF};
|
||||
|
||||
perform_hint_action(video_decode_metadata.hint_id,
|
||||
resource_values, sizeof(resource_values)/sizeof(resource_values[0]));
|
||||
} else if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
|
||||
(strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
|
||||
int resource_values[] = {TR_MS_30, HISPEED_LOAD_90, HS_FREQ_1026, THREAD_MIGRATION_SYNC_OFF};
|
||||
|
||||
perform_hint_action(video_decode_metadata.hint_id,
|
||||
resource_values, sizeof(resource_values)/sizeof(resource_values[0]));
|
||||
}
|
||||
} else if (video_decode_metadata.state == 0) {
|
||||
if ((strncmp(governor, ONDEMAND_GOVERNOR, strlen(ONDEMAND_GOVERNOR)) == 0) &&
|
||||
(strlen(governor) == strlen(ONDEMAND_GOVERNOR))) {
|
||||
} else if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
|
||||
(strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
|
||||
undo_hint_action(video_decode_metadata.hint_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void process_video_encode_hint(void *metadata)
|
||||
{
|
||||
char governor[80];
|
||||
struct video_encode_metadata_t video_encode_metadata;
|
||||
|
||||
if (get_scaling_governor(governor, sizeof(governor)) == -1) {
|
||||
ALOGE("Can't obtain scaling governor.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize encode metadata struct fields. */
|
||||
memset(&video_encode_metadata, 0, sizeof(struct video_encode_metadata_t));
|
||||
video_encode_metadata.state = -1;
|
||||
video_encode_metadata.hint_id = DEFAULT_VIDEO_ENCODE_HINT_ID;
|
||||
|
||||
if (metadata) {
|
||||
if (parse_video_encode_metadata((char *)metadata, &video_encode_metadata) ==
|
||||
-1) {
|
||||
ALOGE("Error occurred while parsing metadata.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (video_encode_metadata.state == 1) {
|
||||
if ((strncmp(governor, ONDEMAND_GOVERNOR, strlen(ONDEMAND_GOVERNOR)) == 0) &&
|
||||
(strlen(governor) == strlen(ONDEMAND_GOVERNOR))) {
|
||||
int resource_values[] = {IO_BUSY_OFF, SAMPLING_DOWN_FACTOR_1, THREAD_MIGRATION_SYNC_OFF};
|
||||
|
||||
perform_hint_action(video_encode_metadata.hint_id,
|
||||
resource_values, sizeof(resource_values)/sizeof(resource_values[0]));
|
||||
} else if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
|
||||
(strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
|
||||
int resource_values[] = {TR_MS_30, HISPEED_LOAD_90, HS_FREQ_1026, THREAD_MIGRATION_SYNC_OFF,
|
||||
INTERACTIVE_IO_BUSY_OFF};
|
||||
|
||||
perform_hint_action(video_encode_metadata.hint_id,
|
||||
resource_values, sizeof(resource_values)/sizeof(resource_values[0]));
|
||||
}
|
||||
} else if (video_encode_metadata.state == 0) {
|
||||
if ((strncmp(governor, ONDEMAND_GOVERNOR, strlen(ONDEMAND_GOVERNOR)) == 0) &&
|
||||
(strlen(governor) == strlen(ONDEMAND_GOVERNOR))) {
|
||||
undo_hint_action(video_encode_metadata.hint_id);
|
||||
} else if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
|
||||
(strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
|
||||
undo_hint_action(video_encode_metadata.hint_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int __attribute__ ((weak)) power_hint_override(power_hint_t UNUSED(hint),
|
||||
void *UNUSED(data))
|
||||
{
|
||||
@@ -243,13 +137,7 @@ void power_hint(power_hint_t hint, void *data)
|
||||
|
||||
interaction(duration, sizeof(resources)/sizeof(resources[0]), resources);
|
||||
}
|
||||
break;
|
||||
case POWER_HINT_VIDEO_ENCODE:
|
||||
process_video_encode_hint(data);
|
||||
break;
|
||||
case POWER_HINT_VIDEO_DECODE:
|
||||
process_video_decode_hint(data);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -31,43 +31,8 @@
|
||||
-->
|
||||
|
||||
<Powerhint>
|
||||
<Hint type="0x0E00"> <!--preview-->
|
||||
<Resource opcode="0x41400000" value="0x4" /> <!-- B CPU - above_hispeed_delay of 40 ms -->
|
||||
<Resource opcode="0x41410000" value="0x5F" /> <!-- B CPU - go hispeed load 95 -->
|
||||
<Resource opcode="0x41414000" value="0x22C"/> <!-- B CPU - hispeed freq of 556 MHz -->
|
||||
<Resource opcode="0x41420000" value="0x5A" /> <!-- B CPU - target load of 90 -->
|
||||
<Resource opcode="0x41400100" value="0x4" /> <!-- L CPU - above_hispeed_delay of 40 ms -->
|
||||
<Resource opcode="0x41410100" value="0x5F" /> <!-- L CPU - go hispeed load 95 -->
|
||||
<Resource opcode="0x41414100" value="0x22C"/> <!-- L CPU - hispeed freq of 556 MHz- -->
|
||||
<Resource opcode="0x41420100" value="0x5A" /> <!-- L CPU - target load of 90 -->
|
||||
<Resource opcode="0x41810000" value="0x9C4"/> <!-- CPUBW low power ceil mpbs of 2500 -->
|
||||
<Resource opcode="0x41814000" value="0x32" /> <!-- CPUBW low power io percent of 50 -->
|
||||
</Hint>
|
||||
<Hint type="0x0A00"> <!--video encode 30 fps-->
|
||||
<Resource opcode="0x41400000" value="0x4" /> <!-- B CPU - above_hispeed_delay of 40 ms -->
|
||||
<Resource opcode="0x41410000" value="0x5F" /> <!-- B CPU - go hispeed load 95 -->
|
||||
<Resource opcode="0x41414000" value="0x326"/> <!-- B CPU - hispeed freq of 806 MHz -->
|
||||
<Resource opcode="0x41420000" value="0x5A" /> <!-- B CPU - target load of 90 -->
|
||||
<Resource opcode="0x41400100" value="0x4" /> <!-- L CPU - above_hispeed_delay of 40 ms -->
|
||||
<Resource opcode="0x41410100" value="0x5F" /> <!-- L CPU - go hispeed load 95 -->
|
||||
<Resource opcode="0x41414100" value="0x22C"/> <!-- L CPU - hispeed freq of 556 MHz- -->
|
||||
<Resource opcode="0x41420100" value="0x5A" /> <!-- L CPU - target load of 90 -->
|
||||
<Resource opcode="0x41810000" value="0x9C4"/> <!-- CPUBW low power ceil mpbs of 2500 -->
|
||||
<Resource opcode="0x41814000" value="0x32" /> <!-- CPUBW low power io percent of 50 -->
|
||||
<Resource opcode="0x4180C000" value="0x0" /> <!-- CPUBW disable hysteresis -->
|
||||
<Resource opcode="0x41820000" value="0xA" /> <!-- CPUBW sample_ms of 10ms -->
|
||||
<Resource opcode="0x41438100" value="0x0" /> <!-- L CPU - disable ignore_hispeed_notif -->
|
||||
<Resource opcode="0x41438000" value="0x0" /> <!-- B CPU - disable ignore_hispeed_notif -->
|
||||
</Hint>
|
||||
<Hint type="0x0B00"> <!--video decode-->
|
||||
<Resource opcode="0x41400100" value="0x4" /> <!-- L CPU - Above Hispeed Delay of 40ms -->
|
||||
<Resource opcode="0x41410100" value="0x5F" /> <!-- L CPU - Go Hispeed Delay of 95 -->
|
||||
<Resource opcode="0x41414100" value="0x2D9"/> <!-- L CPU - Hispeed Freq of 768 MHz -->
|
||||
<Resource opcode="0x41420100" value="0x5A" /> <!-- L CPU - Target Loads of 90 -->
|
||||
<Resource opcode="0x41400000" value="0x4" /> <!-- B CPU - Above Hispeed Delay of 40ms -->
|
||||
<Resource opcode="0x41410000" value="0x5F" /> <!-- B CPU - Go Hispeed Load of 95 -->
|
||||
<Resource opcode="0x41414000" value="0x2D9"/> <!-- B CPU - Hispeed Freq of 729 MHz -->
|
||||
<Resource opcode="0x41420000" value="0x5A" /> <!-- B CPU - Target Load of 90 -->
|
||||
<Resource opcode="0x40804000" value="0x7A6"/> <!-- B CPU - Cluster max freq ~1.958 Ghz -->
|
||||
</Hint>
|
||||
<Hint type="0x0F00"> <!--sustained performance-->
|
||||
<Resource opcode="0x40800000" value="0x0"/> <!-- B CPU - Cluster min freq uncapped -->
|
||||
|
||||
3
sepolicy/vendor/hal_camera_default.te
vendored
3
sepolicy/vendor/hal_camera_default.te
vendored
@@ -11,6 +11,9 @@ binder_call(hal_camera_default, hal_graphics_composer)
|
||||
binder_call(hal_camera_default, system_server)
|
||||
binder_call(hal_camera_default, hal_graphics_allocator)
|
||||
|
||||
# For interfacing with PowerHAL
|
||||
hal_client_domain(hal_camera_default, hal_power)
|
||||
|
||||
# For camera team debugging
|
||||
userdebug_or_eng(`
|
||||
allow hal_camera_default camera_vendor_data_file:dir create_dir_perms;
|
||||
|
||||
Reference in New Issue
Block a user