power: Simplify display_hint_sent
Check for whether the display hint has been sent at the start of the set_interactive() function in the common powerHAL. This gets rid of the need to replicate the same variable in every target-specific powerHAL that implements the set_interactive_override() function. Change-Id: If7dd11fcb578211f4f83847f9257232c4138ce53
This commit is contained in:
committed by
Michael Bestas
parent
f87f9daa0c
commit
ba1c2a36fc
@@ -51,7 +51,6 @@
|
||||
|
||||
#define MIN_VAL(X, Y) ((X > Y) ? (Y) : (X))
|
||||
|
||||
static int display_hint_sent;
|
||||
static int video_encode_hint_sent;
|
||||
|
||||
static void process_video_encode_hint(void* metadata);
|
||||
@@ -134,17 +133,13 @@ int set_interactive_override(int on) {
|
||||
memcpy(resource_values, res, MIN_VAL(sizeof(resource_values), sizeof(res)));
|
||||
num_resources = sizeof(res) / sizeof(res[0]);
|
||||
}
|
||||
if (!display_hint_sent) {
|
||||
perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values, num_resources);
|
||||
display_hint_sent = 1;
|
||||
}
|
||||
perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values, num_resources);
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Display on. */
|
||||
if (is_interactive_governor(governor)) {
|
||||
undo_hint_action(DISPLAY_STATE_HINT_ID);
|
||||
display_hint_sent = 0;
|
||||
}
|
||||
}
|
||||
return HINT_HANDLED;
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
|
||||
#define MIN_VAL(X, Y) ((X > Y) ? (Y) : (X))
|
||||
|
||||
static int display_hint_sent;
|
||||
static int video_encode_hint_sent;
|
||||
static void process_video_encode_hint(void* metadata);
|
||||
|
||||
@@ -108,18 +107,14 @@ int set_interactive_override(int on) {
|
||||
INT_OP_CLUSTER1_TIMER_RATE, BIG_LITTLE_TR_MS_50,
|
||||
INT_OP_NOTIFY_ON_MIGRATE, 0x00};
|
||||
|
||||
if (!display_hint_sent) {
|
||||
perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
|
||||
sizeof(resource_values) / sizeof(resource_values[0]));
|
||||
display_hint_sent = 1;
|
||||
}
|
||||
perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
|
||||
sizeof(resource_values) / sizeof(resource_values[0]));
|
||||
} /* Perf time rate set for CORE0,CORE4 8952 target*/
|
||||
|
||||
} else {
|
||||
/* Display on. */
|
||||
if (is_interactive_governor(governor)) {
|
||||
undo_hint_action(DISPLAY_STATE_HINT_ID);
|
||||
display_hint_sent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
|
||||
#define MIN_VAL(X, Y) ((X > Y) ? (Y) : (X))
|
||||
|
||||
static int display_hint_sent;
|
||||
static int video_encode_hint_sent;
|
||||
|
||||
static void process_video_encode_hint(void* metadata);
|
||||
@@ -110,18 +109,14 @@ int set_interactive_override(int on) {
|
||||
0x41424000,
|
||||
0x28,
|
||||
};
|
||||
if (!display_hint_sent) {
|
||||
perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
|
||||
sizeof(resource_values) / sizeof(resource_values[0]));
|
||||
display_hint_sent = 1;
|
||||
}
|
||||
perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
|
||||
sizeof(resource_values) / sizeof(resource_values[0]));
|
||||
} /* Perf time rate set for CORE0,CORE4 8952 target*/
|
||||
|
||||
} else {
|
||||
/* Display on. */
|
||||
if (is_interactive_governor(governor)) {
|
||||
undo_hint_action(DISPLAY_STATE_HINT_ID);
|
||||
display_hint_sent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,8 @@ extern void power_set_interactive_ext(int on);
|
||||
#endif
|
||||
|
||||
void set_interactive(int on) {
|
||||
static int display_hint_sent;
|
||||
|
||||
if (!on) {
|
||||
/* Send Display OFF hint to perf HAL */
|
||||
perf_hint_enable(VENDOR_HINT_DISPLAY_OFF, 0);
|
||||
@@ -136,6 +138,14 @@ void set_interactive(int on) {
|
||||
perf_hint_enable(VENDOR_HINT_DISPLAY_ON, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignore consecutive display-off hints
|
||||
* Consecutive display-on hints are already handled
|
||||
*/
|
||||
if (display_hint_sent && !on) return;
|
||||
|
||||
display_hint_sent = !on;
|
||||
|
||||
#ifdef SET_INTERACTIVE_EXT
|
||||
power_set_interactive_ext(on);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user