hwc: Refactor of allowing virtual displays to HWC

1. Since SF doesnt invoke blank for virtual display,
     handle pipe clean up as part of Primary display
     blank.
  2. Support virtual display to query display attributes.

This refactor is done to address Framework reboot issue.

Change-Id: I266a87228193fd85252a22242b66dd4af5f3033f
This commit is contained in:
Amara Venkata Mastan Manoj Kumar
2013-07-01 13:59:34 -07:00
parent e9efd8a487
commit 7fb132789d
3 changed files with 17 additions and 22 deletions

View File

@@ -88,7 +88,7 @@ static void hwc_registerProcs(struct hwc_composer_device_1* dev,
//Helper //Helper
static void reset(hwc_context_t *ctx, int numDisplays, static void reset(hwc_context_t *ctx, int numDisplays,
hwc_display_contents_1_t** displays) { hwc_display_contents_1_t** displays) {
for(int i = 0; i < MAX_DISPLAYS; i++) { for(int i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) {
hwc_display_contents_1_t *list = displays[i]; hwc_display_contents_1_t *list = displays[i];
// XXX:SurfaceFlinger no longer guarantees that this // XXX:SurfaceFlinger no longer guarantees that this
// value is reset on every prepare. However, for the layer // value is reset on every prepare. However, for the layer
@@ -105,8 +105,6 @@ static void reset(hwc_context_t *ctx, int numDisplays,
ctx->mFBUpdate[i]->reset(); ctx->mFBUpdate[i]->reset();
if(ctx->mCopyBit[i]) if(ctx->mCopyBit[i])
ctx->mCopyBit[i]->reset(); ctx->mCopyBit[i]->reset();
if(ctx->mLayerRotMap[i])
ctx->mLayerRotMap[i]->reset();
} }
} }
@@ -519,8 +517,9 @@ int hwc_getDisplayConfigs(struct hwc_composer_device_1* dev, int disp,
ret = 0; //NO_ERROR ret = 0; //NO_ERROR
break; break;
case HWC_DISPLAY_EXTERNAL: case HWC_DISPLAY_EXTERNAL:
case HWC_DISPLAY_VIRTUAL:
ret = -1; //Not connected ret = -1; //Not connected
if(ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].connected) { if(ctx->dpyAttr[disp].connected) {
ret = 0; //NO_ERROR ret = 0; //NO_ERROR
if(*numConfigs > 0) { if(*numConfigs > 0) {
configs[0] = 0; configs[0] = 0;
@@ -536,8 +535,8 @@ int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp,
uint32_t config, const uint32_t* attributes, int32_t* values) { uint32_t config, const uint32_t* attributes, int32_t* values) {
hwc_context_t* ctx = (hwc_context_t*)(dev); hwc_context_t* ctx = (hwc_context_t*)(dev);
//If hotpluggable displays are inactive return error //If hotpluggable displays(i.e, HDMI, WFD) are inactive return error
if(disp == HWC_DISPLAY_EXTERNAL && !ctx->dpyAttr[disp].connected) { if( (disp >= HWC_DISPLAY_EXTERNAL) && !ctx->dpyAttr[disp].connected) {
return -1; return -1;
} }
@@ -591,7 +590,7 @@ void hwc_dump(struct hwc_composer_device_1* dev, char *buff, int buff_len)
dumpsys_log(aBuf, "Qualcomm HWC state:\n"); dumpsys_log(aBuf, "Qualcomm HWC state:\n");
dumpsys_log(aBuf, " MDPVersion=%d\n", ctx->mMDP.version); dumpsys_log(aBuf, " MDPVersion=%d\n", ctx->mMDP.version);
dumpsys_log(aBuf, " DisplayPanel=%c\n", ctx->mMDP.panel); dumpsys_log(aBuf, " DisplayPanel=%c\n", ctx->mMDP.panel);
for(int dpy = 0; dpy < MAX_DISPLAYS; dpy++) { for(int dpy = 0; dpy < HWC_NUM_DISPLAY_TYPES; dpy++) {
if(ctx->mMDPComp[dpy]) if(ctx->mMDPComp[dpy])
ctx->mMDPComp[dpy]->dump(aBuf); ctx->mMDPComp[dpy]->dump(aBuf);
} }

View File

@@ -155,7 +155,7 @@ void initContext(hwc_context_t *ctx)
MDPComp::getObject(ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres, MDPComp::getObject(ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres,
rightSplit, HWC_DISPLAY_PRIMARY); rightSplit, HWC_DISPLAY_PRIMARY);
for (uint32_t i = 0; i < MAX_DISPLAYS; i++) { for (uint32_t i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) {
ctx->mHwcDebug[i] = new HwcDebug(i); ctx->mHwcDebug[i] = new HwcDebug(i);
ctx->mLayerRotMap[i] = new LayerRotMap(); ctx->mLayerRotMap[i] = new LayerRotMap();
} }
@@ -199,7 +199,7 @@ void closeContext(hwc_context_t *ctx)
ctx->mRotMgr = NULL; ctx->mRotMgr = NULL;
} }
for(int i = 0; i < MAX_DISPLAYS; i++) { for(int i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) {
if(ctx->mCopyBit[i]) { if(ctx->mCopyBit[i]) {
delete ctx->mCopyBit[i]; delete ctx->mCopyBit[i];
ctx->mCopyBit[i] = NULL; ctx->mCopyBit[i] = NULL;
@@ -216,7 +216,7 @@ void closeContext(hwc_context_t *ctx)
ctx->mExtDisplay = NULL; ctx->mExtDisplay = NULL;
} }
for(int i = 0; i < MAX_DISPLAYS; i++) { for(int i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) {
if(ctx->mFBUpdate[i]) { if(ctx->mFBUpdate[i]) {
delete ctx->mFBUpdate[i]; delete ctx->mFBUpdate[i];
ctx->mFBUpdate[i] = NULL; ctx->mFBUpdate[i] = NULL;

View File

@@ -35,10 +35,6 @@
#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false )) #define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false ))
#define MAX_NUM_APP_LAYERS 32 #define MAX_NUM_APP_LAYERS 32
// For support of virtual displays
#define HWC_DISPLAY_VIRTUAL (HWC_DISPLAY_EXTERNAL+1)
#define MAX_DISPLAYS (HWC_NUM_DISPLAY_TYPES+1)
//Fwrd decls //Fwrd decls
struct hwc_context_t; struct hwc_context_t;
@@ -305,7 +301,7 @@ struct hwc_context_t {
const hwc_procs_t* proc; const hwc_procs_t* proc;
//CopyBit objects //CopyBit objects
qhwc::CopyBit *mCopyBit[MAX_DISPLAYS]; qhwc::CopyBit *mCopyBit[HWC_NUM_DISPLAY_TYPES];
//Overlay object - NULL for non overlay devices //Overlay object - NULL for non overlay devices
overlay::Overlay *mOverlay; overlay::Overlay *mOverlay;
@@ -313,16 +309,16 @@ struct hwc_context_t {
overlay::RotMgr *mRotMgr; overlay::RotMgr *mRotMgr;
//Primary and external FB updater //Primary and external FB updater
qhwc::IFBUpdate *mFBUpdate[MAX_DISPLAYS]; qhwc::IFBUpdate *mFBUpdate[HWC_NUM_DISPLAY_TYPES];
// External display related information // External display related information
qhwc::ExternalDisplay *mExtDisplay; qhwc::ExternalDisplay *mExtDisplay;
qhwc::MDPInfo mMDP; qhwc::MDPInfo mMDP;
qhwc::VsyncState vstate; qhwc::VsyncState vstate;
qhwc::DisplayAttributes dpyAttr[MAX_DISPLAYS]; qhwc::DisplayAttributes dpyAttr[HWC_NUM_DISPLAY_TYPES];
qhwc::ListStats listStats[MAX_DISPLAYS]; qhwc::ListStats listStats[HWC_NUM_DISPLAY_TYPES];
qhwc::LayerProp *layerProp[MAX_DISPLAYS]; qhwc::LayerProp *layerProp[HWC_NUM_DISPLAY_TYPES];
qhwc::MDPComp *mMDPComp[MAX_DISPLAYS]; qhwc::MDPComp *mMDPComp[HWC_NUM_DISPLAY_TYPES];
qhwc::HwcDebug *mHwcDebug[MAX_DISPLAYS]; qhwc::HwcDebug *mHwcDebug[HWC_NUM_DISPLAY_TYPES];
// No animation on External display feature // No animation on External display feature
// Notifies hwcomposer about the device orientation before animation. // Notifies hwcomposer about the device orientation before animation.
@@ -347,7 +343,7 @@ struct hwc_context_t {
int mExtOrientation; int mExtOrientation;
//Flags the transition of a video session //Flags the transition of a video session
bool mVideoTransFlag; bool mVideoTransFlag;
qhwc::LayerRotMap *mLayerRotMap[MAX_DISPLAYS]; qhwc::LayerRotMap *mLayerRotMap[HWC_NUM_DISPLAY_TYPES];
}; };
namespace qhwc { namespace qhwc {