Skip to content

Commit

Permalink
Merge branch 'jb46746_compositor_linger' into 'master'
Browse files Browse the repository at this point in the history
Add wait state to compositor switchover

See merge request mer-core/mce!127
  • Loading branch information
spiiroin committed Sep 12, 2019
2 parents 9d13b36 + e0d2362 commit c667184
Show file tree
Hide file tree
Showing 6 changed files with 361 additions and 52 deletions.
8 changes: 5 additions & 3 deletions Makefile
Expand Up @@ -467,6 +467,7 @@ install:: build
$(INSTALL_DTA) inifiles/mce.ini $(DESTDIR)$(CONFDIR)/$(CONFFILE)
$(INSTALL_DTA) inifiles/mce-radio-states.ini $(DESTDIR)$(CONFDIR)/$(RADIOSTATESCONFFILE)
$(INSTALL_DTA) inifiles/hybris-led.ini $(DESTDIR)$(CONFDIR)/20hybris-led.ini
$(INSTALL_DTA) inifiles/hybris-features.ini $(DESTDIR)$(CONFDIR)/20hybris-features.ini
$(INSTALL_DTA) inifiles/debug-led.ini $(DESTDIR)$(CONFDIR)/20debug-led.ini
$(INSTALL_DTA) inifiles/als-defaults.ini $(DESTDIR)$(CONFDIR)/20als-defaults.ini
$(INSTALL_DTA) inifiles/legacy.ini $(DESTDIR)$(CONFDIR)/11legacy.ini
Expand Down Expand Up @@ -684,13 +685,14 @@ endif
# DEVELOPMENT TIME PROTOTYPE SCANNING
# ----------------------------------------------------------------------------

.SUFFIXES: .q .p
.SUFFIXES: .q .p .g

%.q : %.c ; $(CC) -o $@ -E $< $(CPPFLAGS) $(MCE_CFLAGS)
%.p : %.q ; cproto -s < $< | sed -e 's/_Bool/bool/g' | prettyproto.py | tee $@
%.p : %.q ; cproto -s < $< | prettyproto.py | tee $@
%.g : %.q ; cproto < $< | prettyproto.py | tee $@

clean::
$(RM) -f *.[qp] modules/*.[qp] tools/*.[qp]
$(RM) -f *.[qpg] modules/*.[qpg] tools/*.[qpg]

# ----------------------------------------------------------------------------
# LOCAL RPMBUILD (copy mce.* from OBS to rpm subdir)
Expand Down
19 changes: 19 additions & 0 deletions inifiles/hybris-features.ini
@@ -0,0 +1,19 @@
# Configuration file for MCE - allow/mask features provided by hybris backend

[FeatureHybris]

# If no configuration file is provided, all functionality implemented in
# mce-plugin-libhybris is enabled by default. If some feature is causing
# problems for some device, it should be disabled in hw specific configuration
# file by overriding one of the values below.

FrameBuffer = true
BackLight = true
KeyPad = true
IndicatorLed = true

# Supporting sensors via hybris plugin is a vestigial feature. Masking via
# config solely for the sake of symmetry. Keep all of them disabled.

ProximitySensor = false
LightSensor = false
41 changes: 35 additions & 6 deletions mce-hybris.c
Expand Up @@ -45,6 +45,29 @@
#include <errno.h>
#include <dlfcn.h>

/* ========================================================================= *
* On some devices using in theory supported hybris functionality can lead
* to problems. As a solution mce side configuration files can be used to
* disable individual features.
* ========================================================================= */

#define MCE_CONF_FEATURE_HYBRIS_GROUP "FeatureHybris"

#define MCE_CONF_FEATURE_HYBRIS_FRAMEBUFFER "FrameBuffer"
#define MCE_CONF_FEATURE_HYBRIS_BACKLIGHT "BackLight"
#define MCE_CONF_FEATURE_HYBRIS_KEYPAD "KeyPad"
#define MCE_CONF_FEATURE_HYBRIS_INDICATOR_LED "IndicatorLed"
#define MCE_CONF_FEATURE_HYBRIS_PROXIMITY_SENSOR "ProximitySensor"
#define MCE_CONF_FEATURE_HYBRIS_LIGHT_SENSOR "LightSensor"

static bool
mce_hybris_feature_supported(const char *key)
{
bool res = mce_conf_get_bool(MCE_CONF_FEATURE_HYBRIS_GROUP, key, true);
mce_log(LL_WARN, "hybris feature %s is %s", key, res ? "allowed" : "denied");
return res;
}

static void mce_hybris_ps_set_hook(mce_hybris_ps_fn cb);
static void mce_hybris_als_set_hook(mce_hybris_als_fn cb);

Expand Down Expand Up @@ -403,7 +426,8 @@ void mce_hybris_quit(void)
bool mce_hybris_framebuffer_init(void)
{
static bool (*real)(void) = 0;
RESOLVE;
if( mce_hybris_feature_supported(MCE_CONF_FEATURE_HYBRIS_FRAMEBUFFER) )
RESOLVE;
return !real ? false : real();
}

Expand Down Expand Up @@ -440,7 +464,8 @@ bool mce_hybris_framebuffer_set_power(bool state)
bool mce_hybris_backlight_init(void)
{
static bool (*real)(void) = 0;
RESOLVE;
if( mce_hybris_feature_supported(MCE_CONF_FEATURE_HYBRIS_BACKLIGHT) )
RESOLVE;
return !real ? false : real();
}

Expand Down Expand Up @@ -477,7 +502,8 @@ bool mce_hybris_backlight_set_brightness(int level)
bool mce_hybris_keypad_init(void)
{
static bool (*real)(void) = 0;
RESOLVE;
if( mce_hybris_feature_supported(MCE_CONF_FEATURE_HYBRIS_KEYPAD) )
RESOLVE;
return !real ? false : real();
}

Expand Down Expand Up @@ -514,7 +540,8 @@ bool mce_hybris_keypad_set_brightness(int level)
bool mce_hybris_indicator_init(void)
{
static bool (*real)(void) = 0;
RESOLVE;
if( mce_hybris_feature_supported(MCE_CONF_FEATURE_HYBRIS_INDICATOR_LED) )
RESOLVE;
return !real ? false : real();
}

Expand Down Expand Up @@ -595,7 +622,8 @@ bool mce_hybris_indicator_set_brightness(int level)
bool mce_hybris_ps_init(void)
{
bool (*real)(void) = 0;
RESOLVE;
if( mce_hybris_feature_supported(MCE_CONF_FEATURE_HYBRIS_PROXIMITY_SENSOR) )
RESOLVE;
return !real ? false : real();
}

Expand Down Expand Up @@ -670,7 +698,8 @@ bool mce_hybris_ps_set_callback(mce_hybris_ps_fn cb)
bool mce_hybris_als_init(void)
{
bool (*real)(void) = 0;
RESOLVE;
if( mce_hybris_feature_supported(MCE_CONF_FEATURE_HYBRIS_LIGHT_SENSOR) )
RESOLVE;
return !real ? false : real();
}

Expand Down

0 comments on commit c667184

Please sign in to comment.