hwc: vd: Add support for Dynamic Resolution Change (DRC)
1. Add support for Dynamic Resolution Change We add support for DRC on virtual displays. This is achieved by reading the width and height attributes that are set as part of the buffer handle metadata. For the WFD use cases, the WFD MultiMedia framework will update the width and height during DRC by using setMetaData API with UPDATE_BUFFER_GEOMETRY. We then proceed to configure WB with the new resolution for subsequent frames. 2. Update WB dump with output buffer format and resolution Update WB dump with output buffer format and resolution. This is helpful for debugging purposes. Change-Id: I537277499041bffc7bfc5c6e3d024b67f80fce44
This commit is contained in:
@@ -581,14 +581,14 @@ void ExternalDisplay::setAttributes() {
|
|||||||
// Always set dpyAttr res to mVInfo res
|
// Always set dpyAttr res to mVInfo res
|
||||||
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = width;
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = width;
|
||||||
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres = height;
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres = height;
|
||||||
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mDownScaleMode = false;
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mMDPScalingMode = false;
|
||||||
if(mHwcContext->mOverlay->isUIScalingOnExternalSupported()
|
if(mHwcContext->mOverlay->isUIScalingOnExternalSupported()
|
||||||
&& mHwcContext->mMDPDownscaleEnabled) {
|
&& mHwcContext->mMDPDownscaleEnabled) {
|
||||||
int priW = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
|
int priW = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
|
||||||
int priH = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].yres;
|
int priH = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].yres;
|
||||||
// if primary resolution is more than the hdmi resolution
|
// if primary resolution is more than the hdmi resolution
|
||||||
// configure dpy attr to primary resolution and set
|
// configure dpy attr to primary resolution and set MDP
|
||||||
// downscale mode
|
// scaling mode.
|
||||||
// Restrict this upto 1080p resolution max, if target does not
|
// Restrict this upto 1080p resolution max, if target does not
|
||||||
// support source split feature.
|
// support source split feature.
|
||||||
if((priW * priH) > (width * height) &&
|
if((priW * priH) > (width * height) &&
|
||||||
@@ -632,16 +632,17 @@ void ExternalDisplay::setAttributes() {
|
|||||||
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = alignedExtW;
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = alignedExtW;
|
||||||
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres = alignedExtH;
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres = alignedExtH;
|
||||||
// Set External Display MDP Downscale mode indicator
|
// Set External Display MDP Downscale mode indicator
|
||||||
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mDownScaleMode =true;
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mMDPScalingMode
|
||||||
|
= true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ALOGD_IF(DEBUG_MDPDOWNSCALE, "Selected external resolution [%d X %d] "
|
ALOGD_IF(DEBUG_MDPDOWNSCALE, "Selected external resolution [%d X %d] "
|
||||||
"maxMDPDownScale %d MDPDownScaleMode %d srcSplitEnabled %d "
|
"maxMDPDownScale %d mMDPScalingMode %d srcSplitEnabled %d "
|
||||||
"MDPDownscale feature %d",
|
"MDPDownscale feature %d",
|
||||||
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres,
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres,
|
||||||
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres,
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres,
|
||||||
qdutils::MDPVersion::getInstance().getMaxMDPDownscale(),
|
qdutils::MDPVersion::getInstance().getMaxMDPDownscale(),
|
||||||
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mDownScaleMode,
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mMDPScalingMode,
|
||||||
qdutils::MDPVersion::getInstance().isSrcSplit(),
|
qdutils::MDPVersion::getInstance().isSrcSplit(),
|
||||||
mHwcContext->mMDPDownscaleEnabled);
|
mHwcContext->mMDPDownscaleEnabled);
|
||||||
//Initialize the display viewFrame info
|
//Initialize the display viewFrame info
|
||||||
|
|||||||
@@ -182,11 +182,11 @@ bool FBUpdateNonSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *lis
|
|||||||
// Do not use getNonWormholeRegion() function to calculate the
|
// Do not use getNonWormholeRegion() function to calculate the
|
||||||
// sourceCrop during animation on external display and
|
// sourceCrop during animation on external display and
|
||||||
// Dont do wormhole calculation when extorientation is set on External
|
// Dont do wormhole calculation when extorientation is set on External
|
||||||
// Dont do wormhole calculation when extDownscale is enabled on External
|
// Dont do wormhole calculation when scaling mode is set on External
|
||||||
if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) {
|
if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) {
|
||||||
sourceCrop = layer->displayFrame;
|
sourceCrop = layer->displayFrame;
|
||||||
} else if((mDpy && !extOrient
|
} else if((mDpy && !extOrient
|
||||||
&& !ctx->dpyAttr[mDpy].mDownScaleMode)) {
|
&& !ctx->dpyAttr[mDpy].mMDPScalingMode)) {
|
||||||
if(ctx->mOverlay->isUIScalingOnExternalSupported() &&
|
if(ctx->mOverlay->isUIScalingOnExternalSupported() &&
|
||||||
!ctx->dpyAttr[mDpy].customFBSize) {
|
!ctx->dpyAttr[mDpy].customFBSize) {
|
||||||
getNonWormholeRegion(list, sourceCrop);
|
getNonWormholeRegion(list, sourceCrop);
|
||||||
@@ -307,11 +307,11 @@ bool FBUpdateSplit::configure(hwc_context_t *ctx,
|
|||||||
// Do not use getNonWormholeRegion() function to calculate the
|
// Do not use getNonWormholeRegion() function to calculate the
|
||||||
// sourceCrop during animation on external display and
|
// sourceCrop during animation on external display and
|
||||||
// Dont do wormhole calculation when extorientation is set on External
|
// Dont do wormhole calculation when extorientation is set on External
|
||||||
// Dont do wormhole calculation when extDownscale is enabled on External
|
// Dont do wormhole calculation when scaling mode is set on External
|
||||||
if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) {
|
if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) {
|
||||||
sourceCrop = layer->displayFrame;
|
sourceCrop = layer->displayFrame;
|
||||||
} else if((mDpy && !extOrient
|
} else if((mDpy && !extOrient
|
||||||
&& !ctx->dpyAttr[mDpy].mDownScaleMode)) {
|
&& !ctx->dpyAttr[mDpy].mMDPScalingMode)) {
|
||||||
if(!qdutils::MDPVersion::getInstance().is8x26() &&
|
if(!qdutils::MDPVersion::getInstance().is8x26() &&
|
||||||
!ctx->dpyAttr[mDpy].customFBSize) {
|
!ctx->dpyAttr[mDpy].customFBSize) {
|
||||||
getNonWormholeRegion(list, sourceCrop);
|
getNonWormholeRegion(list, sourceCrop);
|
||||||
@@ -473,11 +473,11 @@ bool FBSrcSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *list,
|
|||||||
// Do not use getNonWormholeRegion() function to calculate the
|
// Do not use getNonWormholeRegion() function to calculate the
|
||||||
// sourceCrop during animation on external display and
|
// sourceCrop during animation on external display and
|
||||||
// Dont do wormhole calculation when extorientation is set on External
|
// Dont do wormhole calculation when extorientation is set on External
|
||||||
// Dont do wormhole calculation when extDownscale is enabled on External
|
// Dont do wormhole calculation when scaling mode is set on External
|
||||||
if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) {
|
if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) {
|
||||||
sourceCrop = layer->displayFrame;
|
sourceCrop = layer->displayFrame;
|
||||||
} else if((mDpy && !extOrient
|
} else if((mDpy && !extOrient
|
||||||
&& !ctx->dpyAttr[mDpy].mDownScaleMode)) {
|
&& !ctx->dpyAttr[mDpy].mMDPScalingMode)) {
|
||||||
if(!qdutils::MDPVersion::getInstance().is8x26() &&
|
if(!qdutils::MDPVersion::getInstance().is8x26() &&
|
||||||
!ctx->dpyAttr[mDpy].customFBSize) {
|
!ctx->dpyAttr[mDpy].customFBSize) {
|
||||||
getNonWormholeRegion(list, sourceCrop);
|
getNonWormholeRegion(list, sourceCrop);
|
||||||
|
|||||||
@@ -704,9 +704,9 @@ bool MDPComp::tryFullFrame(hwc_context_t *ctx,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for action safe flag and downscale mode which requires scaling.
|
// check for action safe flag and MDP scaling mode which requires scaling.
|
||||||
if(ctx->dpyAttr[mDpy].mActionSafePresent
|
if(ctx->dpyAttr[mDpy].mActionSafePresent
|
||||||
|| ctx->dpyAttr[mDpy].mDownScaleMode) {
|
|| ctx->dpyAttr[mDpy].mMDPScalingMode) {
|
||||||
ALOGD_IF(isDebug(), "%s: Scaling needed for this frame",__FUNCTION__);
|
ALOGD_IF(isDebug(), "%s: Scaling needed for this frame",__FUNCTION__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,9 +223,9 @@ void initContext(hwc_context_t *ctx)
|
|||||||
ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].connected = false;
|
ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].connected = false;
|
||||||
ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].isActive = false;
|
ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].isActive = false;
|
||||||
ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].connected = false;
|
ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].connected = false;
|
||||||
ctx->dpyAttr[HWC_DISPLAY_PRIMARY].mDownScaleMode= false;
|
ctx->dpyAttr[HWC_DISPLAY_PRIMARY].mMDPScalingMode= false;
|
||||||
ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].mDownScaleMode = false;
|
ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].mMDPScalingMode = false;
|
||||||
ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].mDownScaleMode = false;
|
ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].mMDPScalingMode = false;
|
||||||
|
|
||||||
ctx->mMDPComp[HWC_DISPLAY_PRIMARY] =
|
ctx->mMDPComp[HWC_DISPLAY_PRIMARY] =
|
||||||
MDPComp::getObject(ctx, HWC_DISPLAY_PRIMARY);
|
MDPComp::getObject(ctx, HWC_DISPLAY_PRIMARY);
|
||||||
@@ -398,8 +398,8 @@ void getActionSafePosition(hwc_context_t *ctx, int dpy, hwc_rect_t& rect) {
|
|||||||
|
|
||||||
int fbWidth = ctx->dpyAttr[dpy].xres;
|
int fbWidth = ctx->dpyAttr[dpy].xres;
|
||||||
int fbHeight = ctx->dpyAttr[dpy].yres;
|
int fbHeight = ctx->dpyAttr[dpy].yres;
|
||||||
if(ctx->dpyAttr[dpy].mDownScaleMode) {
|
if(ctx->dpyAttr[dpy].mMDPScalingMode) {
|
||||||
// if downscale Mode is enabled for external, need to query
|
// if MDP scaling mode is enabled for external, need to query
|
||||||
// the actual width and height, as that is the physical w & h
|
// the actual width and height, as that is the physical w & h
|
||||||
ctx->mExtDisplay->getAttributes(fbWidth, fbHeight);
|
ctx->mExtDisplay->getAttributes(fbWidth, fbHeight);
|
||||||
}
|
}
|
||||||
@@ -530,9 +530,17 @@ void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation,
|
|||||||
outPos.x, outPos.y,
|
outPos.x, outPos.y,
|
||||||
outPos.w, outPos.h);
|
outPos.w, outPos.h);
|
||||||
}
|
}
|
||||||
if(ctx->dpyAttr[dpy].mDownScaleMode) {
|
if(ctx->dpyAttr[dpy].mMDPScalingMode) {
|
||||||
int extW, extH;
|
int extW = 0, extH = 0;
|
||||||
ctx->mExtDisplay->getAttributes(extW, extH);
|
if(dpy == HWC_DISPLAY_EXTERNAL) {
|
||||||
|
ctx->mExtDisplay->getAttributes(extW, extH);
|
||||||
|
} else if(dpy == HWC_DISPLAY_VIRTUAL) {
|
||||||
|
extW = ctx->mHWCVirtual->getScalingWidth();
|
||||||
|
extH = ctx->mHWCVirtual->getScalingHeight();
|
||||||
|
}
|
||||||
|
ALOGD_IF(HWC_UTILS_DEBUG, "%s: Scaling mode extW=%d extH=%d",
|
||||||
|
__FUNCTION__, extW, extH);
|
||||||
|
|
||||||
fbWidth = (float)ctx->dpyAttr[dpy].xres;
|
fbWidth = (float)ctx->dpyAttr[dpy].xres;
|
||||||
fbHeight = (float)ctx->dpyAttr[dpy].yres;
|
fbHeight = (float)ctx->dpyAttr[dpy].yres;
|
||||||
//Calculate the position...
|
//Calculate the position...
|
||||||
@@ -603,14 +611,22 @@ void calcExtDisplayPosition(hwc_context_t *ctx,
|
|||||||
displayFrame.bottom = dstHeight;
|
displayFrame.bottom = dstHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ctx->dpyAttr[dpy].mDownScaleMode) {
|
if(ctx->dpyAttr[dpy].mMDPScalingMode) {
|
||||||
int extW, extH;
|
int extW = 0, extH = 0;
|
||||||
// if downscale is enabled, map the co-ordinates to new
|
// if MDP scaling mode is enabled, map the co-ordinates to new
|
||||||
// domain(downscaled)
|
// domain(downscaled)
|
||||||
float fbWidth = (float)ctx->dpyAttr[dpy].xres;
|
float fbWidth = (float)ctx->dpyAttr[dpy].xres;
|
||||||
float fbHeight = (float)ctx->dpyAttr[dpy].yres;
|
float fbHeight = (float)ctx->dpyAttr[dpy].yres;
|
||||||
// query MDP configured attributes
|
// query MDP configured attributes
|
||||||
ctx->mExtDisplay->getAttributes(extW, extH);
|
if(dpy == HWC_DISPLAY_EXTERNAL) {
|
||||||
|
ctx->mExtDisplay->getAttributes(extW, extH);
|
||||||
|
} else if(dpy == HWC_DISPLAY_VIRTUAL) {
|
||||||
|
extW = ctx->mHWCVirtual->getScalingWidth();
|
||||||
|
extH = ctx->mHWCVirtual->getScalingHeight();
|
||||||
|
}
|
||||||
|
ALOGD_IF(HWC_UTILS_DEBUG, "%s: Scaling mode extW=%d extH=%d",
|
||||||
|
__FUNCTION__, extW, extH);
|
||||||
|
|
||||||
//Calculate the ratio...
|
//Calculate the ratio...
|
||||||
float wRatio = ((float)extW)/fbWidth;
|
float wRatio = ((float)extW)/fbWidth;
|
||||||
float hRatio = ((float)extH)/fbHeight;
|
float hRatio = ((float)extH)/fbHeight;
|
||||||
@@ -626,7 +642,7 @@ void calcExtDisplayPosition(hwc_context_t *ctx,
|
|||||||
displayFrame.right, displayFrame.bottom);
|
displayFrame.right, displayFrame.bottom);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if(extOrient || ctx->dpyAttr[dpy].mDownScaleMode) {
|
if(extOrient || ctx->dpyAttr[dpy].mMDPScalingMode) {
|
||||||
getAspectRatioPosition(ctx, dpy, extOrient,
|
getAspectRatioPosition(ctx, dpy, extOrient,
|
||||||
displayFrame, displayFrame);
|
displayFrame, displayFrame);
|
||||||
}
|
}
|
||||||
@@ -1791,7 +1807,7 @@ int configureSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
|||||||
whf.format = getMdpFormat(HAL_PIXEL_FORMAT_BGRX_8888);
|
whf.format = getMdpFormat(HAL_PIXEL_FORMAT_BGRX_8888);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the external display position based on MDP downscale,
|
/* Calculate the external display position based on MDP scaling mode,
|
||||||
ActionSafe, and extorientation features. */
|
ActionSafe, and extorientation features. */
|
||||||
calcExtDisplayPosition(ctx, hnd, dpy, crop, dst, transform, orient);
|
calcExtDisplayPosition(ctx, hnd, dpy, crop, dst, transform, orient);
|
||||||
int downscale = getRotDownscale(ctx, layer);
|
int downscale = getRotDownscale(ctx, layer);
|
||||||
@@ -2085,13 +2101,19 @@ void dumpBuffer(private_handle_t *ohnd, char *bufferName) {
|
|||||||
if (ohnd != NULL && ohnd->base) {
|
if (ohnd != NULL && ohnd->base) {
|
||||||
char dumpFilename[PATH_MAX];
|
char dumpFilename[PATH_MAX];
|
||||||
bool bResult = false;
|
bool bResult = false;
|
||||||
|
int width = getWidth(ohnd);
|
||||||
|
int height = getHeight(ohnd);
|
||||||
|
int format = ohnd->format;
|
||||||
|
//dummy aligned w & h.
|
||||||
|
int alW = 0, alH = 0;
|
||||||
|
int size = getBufferSizeAndDimensions(width, height, format, alW, alH);
|
||||||
snprintf(dumpFilename, sizeof(dumpFilename), "/data/%s.%s.%dx%d.raw",
|
snprintf(dumpFilename, sizeof(dumpFilename), "/data/%s.%s.%dx%d.raw",
|
||||||
bufferName,
|
bufferName,
|
||||||
overlay::utils::getFormatString(utils::getMdpFormat(ohnd->format)),
|
overlay::utils::getFormatString(utils::getMdpFormat(format)),
|
||||||
getWidth(ohnd), getHeight(ohnd));
|
width, height);
|
||||||
FILE* fp = fopen(dumpFilename, "w+");
|
FILE* fp = fopen(dumpFilename, "w+");
|
||||||
if (NULL != fp) {
|
if (NULL != fp) {
|
||||||
bResult = (bool) fwrite((void*)ohnd->base, ohnd->size, 1, fp);
|
bResult = (bool) fwrite((void*)ohnd->base, size, 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
ALOGD("Buffer[%s] Dump to %s: %s",
|
ALOGD("Buffer[%s] Dump to %s: %s",
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ struct DisplayAttributes {
|
|||||||
// To trigger padding round to clean up mdp
|
// To trigger padding round to clean up mdp
|
||||||
// pipes
|
// pipes
|
||||||
bool isConfiguring;
|
bool isConfiguring;
|
||||||
// External Display is in MDP Downscale mode indicator
|
// Indicates whether external/virtual display is in MDP scaling mode
|
||||||
bool mDownScaleMode;
|
bool mMDPScalingMode;
|
||||||
// Ext dst Rect
|
// Ext dst Rect
|
||||||
hwc_rect_t mDstRect;
|
hwc_rect_t mDstRect;
|
||||||
//Action safe attributes
|
//Action safe attributes
|
||||||
@@ -445,21 +445,17 @@ static inline bool isSecureDisplayBuffer(const private_handle_t* hnd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline int getWidth(const private_handle_t* hnd) {
|
static inline int getWidth(const private_handle_t* hnd) {
|
||||||
if(isYuvBuffer(hnd)) {
|
MetaData_t *metadata = reinterpret_cast<MetaData_t*>(hnd->base_metadata);
|
||||||
MetaData_t *metadata = reinterpret_cast<MetaData_t*>(hnd->base_metadata);
|
if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
|
||||||
if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
|
return metadata->bufferDim.sliceWidth;
|
||||||
return metadata->bufferDim.sliceWidth;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return hnd->width;
|
return hnd->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int getHeight(const private_handle_t* hnd) {
|
static inline int getHeight(const private_handle_t* hnd) {
|
||||||
if(isYuvBuffer(hnd)) {
|
MetaData_t *metadata = reinterpret_cast<MetaData_t*>(hnd->base_metadata);
|
||||||
MetaData_t *metadata = reinterpret_cast<MetaData_t*>(hnd->base_metadata);
|
if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
|
||||||
if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
|
return metadata->bufferDim.sliceHeight;
|
||||||
return metadata->bufferDim.sliceHeight;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return hnd->height;
|
return hnd->height;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ bool HWCVirtualVDS::sVDDumpEnabled = false;
|
|||||||
|
|
||||||
void HWCVirtualVDS::init(hwc_context_t *ctx) {
|
void HWCVirtualVDS::init(hwc_context_t *ctx) {
|
||||||
const int dpy = HWC_DISPLAY_VIRTUAL;
|
const int dpy = HWC_DISPLAY_VIRTUAL;
|
||||||
|
mScalingWidth = 0, mScalingHeight = 0;
|
||||||
ctx->mFBUpdate[dpy] =
|
ctx->mFBUpdate[dpy] =
|
||||||
IFBUpdate::getObject(ctx, dpy);
|
IFBUpdate::getObject(ctx, dpy);
|
||||||
ctx->mMDPComp[dpy] = MDPComp::getObject(ctx, dpy);
|
ctx->mMDPComp[dpy] = MDPComp::getObject(ctx, dpy);
|
||||||
@@ -106,8 +107,14 @@ int HWCVirtualVDS::prepare(hwc_composer_device_1 *dev,
|
|||||||
ctx->dpyAttr[dpy].isConfiguring = false;
|
ctx->dpyAttr[dpy].isConfiguring = false;
|
||||||
ctx->dpyAttr[dpy].fd = Writeback::getInstance()->getFbFd();
|
ctx->dpyAttr[dpy].fd = Writeback::getInstance()->getFbFd();
|
||||||
private_handle_t *ohnd = (private_handle_t *)list->outbuf;
|
private_handle_t *ohnd = (private_handle_t *)list->outbuf;
|
||||||
Writeback::getInstance()->configureDpyInfo(ohnd->width,
|
|
||||||
ohnd->height);
|
setMDPScalingMode(ctx, ohnd, dpy);
|
||||||
|
|
||||||
|
mScalingWidth = getWidth(ohnd);
|
||||||
|
mScalingHeight = getHeight(ohnd);
|
||||||
|
|
||||||
|
Writeback::getInstance()->configureDpyInfo(mScalingWidth,
|
||||||
|
mScalingHeight);
|
||||||
setListStats(ctx, list, dpy);
|
setListStats(ctx, list, dpy);
|
||||||
|
|
||||||
if(ctx->mMDPComp[dpy]->prepare(ctx, list) < 0) {
|
if(ctx->mMDPComp[dpy]->prepare(ctx, list) < 0) {
|
||||||
@@ -258,3 +265,20 @@ void HWCVirtualVDS::resume(hwc_context_t* ctx, int dpy) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We set scaling mode on the VD if the output handle width and height
|
||||||
|
differs from the virtual frame buffer width and height. */
|
||||||
|
void HWCVirtualVDS::setMDPScalingMode(hwc_context_t* ctx,
|
||||||
|
private_handle_t* ohnd, int dpy) {
|
||||||
|
bool scalingMode = false;
|
||||||
|
int fbWidth = ctx->dpyAttr[dpy].xres;
|
||||||
|
int fbHeight = ctx->dpyAttr[dpy].yres;
|
||||||
|
if((getWidth(ohnd) != fbWidth) || (getHeight(ohnd) != fbHeight)) {
|
||||||
|
scalingMode = true;
|
||||||
|
}
|
||||||
|
ctx->dpyAttr[dpy].mMDPScalingMode = scalingMode;
|
||||||
|
|
||||||
|
ALOGD_IF(HWCVIRTUAL_LOG, "%s fb(%dx%d) outputBuffer(%dx%d) scalingMode=%d",
|
||||||
|
__FUNCTION__, fbWidth, fbHeight,
|
||||||
|
getWidth(ohnd), getHeight(ohnd), scalingMode);
|
||||||
|
}
|
||||||
|
|||||||
@@ -45,12 +45,21 @@ public:
|
|||||||
hwc_display_contents_1_t** displays);
|
hwc_display_contents_1_t** displays);
|
||||||
void pause(hwc_context_t* ctx, int dpy);
|
void pause(hwc_context_t* ctx, int dpy);
|
||||||
void resume(hwc_context_t* ctx, int dpy);
|
void resume(hwc_context_t* ctx, int dpy);
|
||||||
|
int getScalingHeight() const { return mScalingHeight; };
|
||||||
|
int getScalingWidth() const { return mScalingWidth; };
|
||||||
// We can dump the frame buffer and WB
|
// We can dump the frame buffer and WB
|
||||||
// output buffer by dynamically enabling
|
// output buffer by dynamically enabling
|
||||||
// dumping via a binder call:
|
// dumping via a binder call:
|
||||||
// adb shell service call display.qservice 15 i32 3 i32 1
|
// adb shell service call display.qservice 15 i32 3 i32 1
|
||||||
static bool sVDDumpEnabled;
|
static bool sVDDumpEnabled;
|
||||||
static void dynamicDebug(bool enable) {sVDDumpEnabled = enable;};
|
static void dynamicDebug(bool enable) {sVDDumpEnabled = enable;};
|
||||||
|
|
||||||
|
private:
|
||||||
|
// These variables store the resolution that WB is being configured to
|
||||||
|
// in the current draw cycle.
|
||||||
|
int mScalingWidth, mScalingHeight;
|
||||||
|
void setMDPScalingMode(hwc_context_t* ctx,
|
||||||
|
private_handle_t* ohnd, int dpy);
|
||||||
};
|
};
|
||||||
|
|
||||||
}; //namespace
|
}; //namespace
|
||||||
|
|||||||
@@ -263,9 +263,12 @@ void Writeback::clear() {
|
|||||||
bool Writeback::getDump(char *buf, size_t len) {
|
bool Writeback::getDump(char *buf, size_t len) {
|
||||||
if(sWb) {
|
if(sWb) {
|
||||||
utils::getDump(buf, len, "WBData", sWb->mFbData);
|
utils::getDump(buf, len, "WBData", sWb->mFbData);
|
||||||
char str[4] = {'\0'};
|
char outputBufferInfo[256];
|
||||||
snprintf(str, 4, "\n");
|
snprintf(outputBufferInfo, sizeof(outputBufferInfo),
|
||||||
strlcat(buf, str, len);
|
"OutputBuffer xres=%d yres=%d format=%s\n\n",
|
||||||
|
sWb->getWidth(), sWb->getHeight(),
|
||||||
|
utils::getFormatString(sWb->getOutputFormat()));
|
||||||
|
strlcat(buf, outputBufferInfo, len);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ public:
|
|||||||
bool queueBuffer(int opFd, uint32_t opOffset);
|
bool queueBuffer(int opFd, uint32_t opOffset);
|
||||||
uint32_t getOffset() const { return mWbMem.getOffset(); }
|
uint32_t getOffset() const { return mWbMem.getOffset(); }
|
||||||
int getDstFd() const { return mWbMem.getDstFd(); }
|
int getDstFd() const { return mWbMem.getDstFd(); }
|
||||||
|
int getWidth() const { return mXres; }
|
||||||
|
int getHeight() const { return mYres; }
|
||||||
/* Subject to GC if writeback isnt used for a drawing round.
|
/* Subject to GC if writeback isnt used for a drawing round.
|
||||||
* Get always if caching the value.
|
* Get always if caching the value.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user