libQcomUI: handle WFD and HDMI concurrency.

- Add external_display_type to differentiate WFD and HDMI
- based on the display type, handle wifi display and HDMI
  concurrency

Change-Id: I2bf928dcd232f2ea39c4fa8dca812a26112076b2
(cherry picked from commit 8e7490026832d8df6758f4aa615039f91ac0f5ff)
(cherry picked from commit 7c6b7979bf2d7ab12ff528be75b5e008405acbda)
This commit is contained in:
Arun Kumar K.R 2012-03-16 19:23:11 -07:00 committed by Andrew Sutherland
parent 6d56f14dff
commit 17e503c9b1
4 changed files with 35 additions and 32 deletions

View File

@ -211,7 +211,7 @@ void inline ExtDispOnly::close() {
int ExtDispOnly::prepare(hwc_context_t *ctx, hwc_layer_t *layer, int index,
bool waitForVsync) {
#if defined (HDMI_DUAL_DISPLAY) && defined (USE_OVERLAY)
if(ctx->mHDMIEnabled == EXT_DISPLAY_OFF ||
if(ctx->mHDMIEnabled == EXT_TYPE_NONE ||
ctx->pendingHDMI == true)
return -1;
@ -280,7 +280,7 @@ inline void ExtDispOnly::stopDefaultMirror(hwc_context_t* ctx) {
reinterpret_cast<private_hwc_module_t*>(dev->common.module);
framebuffer_device_t *fbDev = hwcModule->fbDevice;
if (fbDev) {
fbDev->enableHDMIOutput(fbDev, EXT_DISPLAY_OFF);
fbDev->enableHDMIOutput(fbDev, EXT_TYPE_NONE);
}
#endif
}
@ -363,7 +363,7 @@ int ExtDispOnly::update(hwc_context_t* ctx, hwc_layer_list_t* list) {
}
//If External is not connected, dont setup pipes, just return
if(ctx->mHDMIEnabled == EXT_DISPLAY_OFF ||
if(ctx->mHDMIEnabled == EXT_TYPE_NONE ||
ctx->pendingHDMI == true) {
ExtDispOnly::close();
return -1;
@ -428,7 +428,7 @@ void ExtDispOnly::storeLockedHandles(hwc_layer_list_t* list) {
int ExtDispOnly::draw(hwc_context_t *ctx, hwc_layer_list_t *list) {
#if defined (HDMI_DUAL_DISPLAY) && defined (USE_OVERLAY)
LOGE_IF(EXTDEBUG, "%s", __func__);
if(ctx->mHDMIEnabled == EXT_DISPLAY_OFF ||
if(ctx->mHDMIEnabled == EXT_TYPE_NONE||
ctx->pendingHDMI == true) {
ExtDispOnly::close();
return -1;

View File

@ -93,7 +93,7 @@ struct hwc_context_t {
BypassState bypassState;
#endif
#if defined HDMI_DUAL_DISPLAY
external_display mHDMIEnabled; // Type of external display
external_display_type mHDMIEnabled; // Type of external display
bool pendingHDMI;
#endif
int previousLayerCount;
@ -853,7 +853,7 @@ static void hwc_enableHDMIOutput(hwc_composer_device_t *dev, int externaltype) {
handleHDMIStateChange(dev, 0);
}
// Store the external display
ctx->mHDMIEnabled = (external_display)externaltype;
ctx->mHDMIEnabled = (external_display_type)externaltype;
if(ctx->mHDMIEnabled) { //On connect, allow bypass to draw once to FB
ctx->pendingHDMI = true;
} else { //On disconnect, close immediately (there will be no bypass)
@ -1715,7 +1715,7 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
#endif
ExtDispOnly::init();
#if defined HDMI_DUAL_DISPLAY
dev->mHDMIEnabled = EXT_DISPLAY_OFF;
dev->mHDMIEnabled = EXT_TYPE_NONE;
dev->pendingHDMI = false;
#endif
dev->previousOverlayHandle = NULL;

View File

@ -509,35 +509,39 @@ int qcomuiClearRegion(Region region, EGLDisplay dpy, EGLSurface sur)
/*
* Handles the externalDisplay event
* HDMI has highest priority compared to WifiDisplay
* Based on the current and the new display event, decides the
* Based on the current and the new display type, decides the
* external display to be enabled
*
* @param: newEvent - new external event
* @param: currEvent - currently enabled external event
* @return: external display to be enabled
* @param: disp - external display type(wfd/hdmi)
* @param: value - external event(0/1)
* @param: currdispType - Current enabled external display Type
* @return: external display type to be enabled
*
*/
external_display handleEventHDMI(external_display newState, external_display
currState)
external_display_type handleEventHDMI(external_display_type disp, int value,
external_display_type currDispType)
{
external_display retState = currState;
switch(newState) {
case EXT_DISPLAY_HDMI:
retState = EXT_DISPLAY_HDMI;
external_display_type retDispType = currDispType;
switch(disp) {
case EXT_TYPE_HDMI:
if(value)
retDispType = EXT_TYPE_HDMI;
else
retDispType = EXT_TYPE_NONE;
break;
case EXT_DISPLAY_WIFI:
if(currState != EXT_DISPLAY_HDMI) {
retState = EXT_DISPLAY_WIFI;
case EXT_TYPE_WIFI:
if(currDispType != EXT_TYPE_HDMI) {
if(value)
retDispType = EXT_TYPE_WIFI;
else
retDispType = EXT_TYPE_NONE;
}
break;
case EXT_DISPLAY_OFF:
retState = EXT_DISPLAY_OFF;
break;
default:
LOGE("handleEventHDMI: unknown Event");
LOGE("%s: Unknown External Display Type!!");
break;
}
return retState;
return retDispType;
}
// Using global variables for layer dumping since "property_set("debug.sf.dump",

View File

@ -100,10 +100,10 @@ enum HWCCompositionType {
HWC_USE_COPYBIT // This layer is to be handled by copybit
};
enum external_display {
EXT_DISPLAY_OFF,
EXT_DISPLAY_HDMI,
EXT_DISPLAY_WIFI
enum external_display_type {
EXT_TYPE_NONE,
EXT_TYPE_HDMI,
EXT_TYPE_WIFI
};
/*
@ -295,9 +295,8 @@ int qcomuiClearRegion(Region region, EGLDisplay dpy, EGLSurface sur);
* @return: external display to be enabled
*
*/
external_display handleEventHDMI(external_display newEvent, external_display
currEvent);
external_display_type handleEventHDMI(external_display_type disp, int value,
external_display_type currDispType);
/*
* Checks if layers need to be dumped based on system property "debug.sf.dump"
* for raw dumps and "debug.sf.dump.png" for png dumps.