diff --git a/hwc/tulip/hwc.cpp b/hwc/tulip/hwc.cpp index 4b2e704..243bec5 100755 --- a/hwc/tulip/hwc.cpp +++ b/hwc/tulip/hwc.cpp @@ -17,6 +17,7 @@ #include "hwc.h" #include "cutils/properties.h" +#include static int Framecount = 0; @@ -265,11 +266,44 @@ static int hwc_getDisplayAttributes(struct hwc_composer_device_1 *dev, static int hwc_device_close(struct hw_device_t *dev) { HWC_UNREFERENCED_PARAMETER(dev); - + hwc_destroy_device(); return 0; } +#define TYPE_BUILT_IN 1 +#define TYPE_HDMI 2 + +static void hwc_sysprop_changed() +{ + int disp = 0; + + ALOGI("hwc_sysprop_changed"); + + _hwc_device_set_3d_mode(TYPE_BUILT_IN, + (__display_3d_mode) + property_get_int32("persist.sys.disp.3d_mode", 0)); + + _hwc_device_set_backlight(TYPE_BUILT_IN, + property_get_int32("persist.sys.disp.backlight", 0), 0); + + _hwc_device_set_backlight(TYPE_BUILT_IN, + property_get_int32("persist.sys.disp.backlight_demo", 0), 1); + + _hwc_device_set_enhancemode(TYPE_BUILT_IN, + property_get_int32("persist.sys.disp.enhancemode", 0), 0); + + _hwc_device_set_enhancemode(TYPE_BUILT_IN, + property_get_int32("persist.sys.disp.enhancemode_demo", 0), 1); + + _hwc_device_set_output_mode(TYPE_HDMI, DISP_OUTPUT_TYPE_HDMI, + property_get_int32("persist.sys.hdmi.output_mode", DISP_TV_MOD_1080P_60HZ)); + + _hwc_set_persent(TYPE_HDMI, + property_get_int32("persist.sys.hdmi.percent_x", 0), + property_get_int32("persist.sys.hdmi.percent_y", 0)); +} + /*****************************************************************************/ static int hwc_device_open(const struct hw_module_t* module, const char* name, @@ -321,7 +355,8 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name, hwc_create_device(); + android::add_sysprop_change_callback(hwc_sysprop_changed, 1000); + hwc_sysprop_changed(); + return err; } - -