Merge a76131a3c1 on remote branch
Change-Id: I66d01dad2d7f2f1f425287857516592090f36d57
This commit is contained in:
@@ -96,6 +96,12 @@ ndk::ScopedAStatus Power::isModeSupported(Mode type, bool* _aidl_return) {
|
||||
|
||||
switch(type){
|
||||
case Mode::EXPENSIVE_RENDERING:
|
||||
if (is_expensive_rendering_supported()) {
|
||||
*_aidl_return = true;
|
||||
} else {
|
||||
*_aidl_return = false;
|
||||
}
|
||||
break;
|
||||
case Mode::INTERACTIVE:
|
||||
case Mode::SUSTAINED_PERFORMANCE:
|
||||
case Mode::FIXED_PERFORMANCE:
|
||||
|
||||
@@ -116,6 +116,13 @@ void power_hint(power_hint_t hint, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
bool is_expensive_rendering_supported() {
|
||||
char property[PROPERTY_VALUE_MAX];
|
||||
strlcpy(property, perf_get_property("vendor.perf.expensive_rendering", "0").value,
|
||||
PROPERTY_VALUE_MAX);
|
||||
return atoi(property) == 1 ? true : false;
|
||||
}
|
||||
|
||||
void set_expensive_rendering(bool enabled)
|
||||
{
|
||||
if (enabled) {
|
||||
|
||||
@@ -62,6 +62,7 @@ enum CPU_GOV_CHECK {
|
||||
|
||||
void power_init(void);
|
||||
void power_hint(power_hint_t hint, void *data);
|
||||
bool is_expensive_rendering_supported();
|
||||
void set_expensive_rendering(bool enabled);
|
||||
void set_interactive(int on);
|
||||
|
||||
|
||||
16
utils.c
16
utils.c
@@ -56,6 +56,7 @@ static int (*perf_lock_acq)(int handle, int duration,
|
||||
int list[], int numArgs);
|
||||
static int (*perf_lock_rel)(int handle);
|
||||
static int (*perf_hint)(int, const char *, int, int);
|
||||
static PropVal (*perf_get_prop)(const char *prop , const char *def_val);
|
||||
static struct list_node active_hint_list_head;
|
||||
const char *pkg = "QTI PowerHAL";
|
||||
|
||||
@@ -102,6 +103,11 @@ static void __attribute__ ((constructor)) initialize(void)
|
||||
if (!perf_hint) {
|
||||
ALOGE("Unable to get perf_hint function handle.\n");
|
||||
}
|
||||
|
||||
perf_get_prop = dlsym(qcopt_handle, "perf_get_prop");
|
||||
if (!perf_get_prop) {
|
||||
ALOGE("Unable to get perf_get_prop function handle.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,6 +216,16 @@ int is_interactive_governor(char* governor) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
PropVal perf_get_property(const char *prop , const char *def_val) {
|
||||
PropVal retVal;
|
||||
if (qcopt_handle && perf_get_prop) {
|
||||
retVal = perf_get_prop(prop, def_val);
|
||||
} else {
|
||||
strlcpy(retVal.value, def_val, PROPERTY_VALUE_MAX);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void interaction(int duration, int num_args, int opt_list[])
|
||||
{
|
||||
#ifdef INTERACTION_BOOST
|
||||
|
||||
5
utils.h
5
utils.h
@@ -29,6 +29,10 @@
|
||||
|
||||
#include <cutils/properties.h>
|
||||
|
||||
typedef struct {
|
||||
char value[PROP_VALUE_MAX];
|
||||
} PropVal;
|
||||
|
||||
int sysfs_read(char *path, char *s, int num_bytes);
|
||||
int sysfs_write(char *path, char *s);
|
||||
int get_scaling_governor(char governor[], int size);
|
||||
@@ -45,3 +49,4 @@ void undo_hint_action(int hint_id);
|
||||
void release_request(int lock_handle);
|
||||
int interaction_with_handle(int lock_handle, int duration, int num_args, int opt_list[]);
|
||||
int perf_hint_enable(int hint_id, int duration);
|
||||
PropVal perf_get_property(const char *prop , const char *def_val);
|
||||
|
||||
Reference in New Issue
Block a user