hwc: Enable mdp downscale feature for 4k resolution
Enable MDP Downscale feature for primary resolution greater than 2048 only for the targets that supports source split. Change-Id: I21871b099f74543aa8c2416bac41e3a16d4ce72d
This commit is contained in:
@@ -589,9 +589,11 @@ void ExternalDisplay::setAttributes() {
|
|||||||
// 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
|
||||||
// downscale mode
|
// downscale mode
|
||||||
// Restrict this upto 1080p resolution max
|
// Restrict this upto 1080p resolution max, if target does not
|
||||||
if(((priW * priH) > (width * height)) &&
|
// support source split feature.
|
||||||
((priW * priH) <= SUPPORTED_DOWNSCALE_AREA)) {
|
if((priW * priH) > (width * height) &&
|
||||||
|
(((priW * priH) <= SUPPORTED_DOWNSCALE_AREA) ||
|
||||||
|
qdutils::MDPVersion::getInstance().isSrcSplit())) {
|
||||||
// tmpW and tmpH will hold the primary dimensions before we
|
// tmpW and tmpH will hold the primary dimensions before we
|
||||||
// update the aspect ratio if necessary.
|
// update the aspect ratio if necessary.
|
||||||
int tmpW = priW;
|
int tmpW = priW;
|
||||||
@@ -609,14 +611,39 @@ void ExternalDisplay::setAttributes() {
|
|||||||
// keeping aspect ratio intact.
|
// keeping aspect ratio intact.
|
||||||
hwc_rect r = {0, 0, 0, 0};
|
hwc_rect r = {0, 0, 0, 0};
|
||||||
qdutils::getAspectRatioPosition(tmpW, tmpH, width, height, r);
|
qdutils::getAspectRatioPosition(tmpW, tmpH, width, height, r);
|
||||||
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres =
|
int newExtW = r.right - r.left;
|
||||||
r.right - r.left;
|
int newExtH = r.bottom - r.top;
|
||||||
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres =
|
int alignedExtW;
|
||||||
r.bottom - r.top;
|
int alignedExtH;
|
||||||
|
// On 8994 and below targets MDP supports only 4X downscaling,
|
||||||
|
// Restricting selected external resolution to be exactly 4X
|
||||||
|
// greater resolution than actual external resolution
|
||||||
|
int maxMDPDownScale =
|
||||||
|
qdutils::MDPVersion::getInstance().getMaxMDPDownscale();
|
||||||
|
if((width * height * maxMDPDownScale) < (newExtW * newExtH)) {
|
||||||
|
float upScaleFactor = (float)maxMDPDownScale / 2.0f;
|
||||||
|
newExtW = (int)((float)width * upScaleFactor);
|
||||||
|
newExtH = (int)((float)height * upScaleFactor);
|
||||||
|
}
|
||||||
|
// Align it down so that the new aligned resolution does not
|
||||||
|
// exceed the maxMDPDownscale factor
|
||||||
|
alignedExtW = overlay::utils::aligndown(newExtW, 4);
|
||||||
|
alignedExtH = overlay::utils::aligndown(newExtH, 4);
|
||||||
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = alignedExtW;
|
||||||
|
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].mDownScaleMode =true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ALOGD_IF(DEBUG_MDPDOWNSCALE, "Selected external resolution [%d X %d] "
|
||||||
|
"maxMDPDownScale %d MDPDownScaleMode %d srcSplitEnabled %d "
|
||||||
|
"MDPDownscale feature %d",
|
||||||
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres,
|
||||||
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres,
|
||||||
|
qdutils::MDPVersion::getInstance().getMaxMDPDownscale(),
|
||||||
|
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mDownScaleMode,
|
||||||
|
qdutils::MDPVersion::getInstance().isSrcSplit(),
|
||||||
|
mHwcContext->mMDPDownscaleEnabled);
|
||||||
//Initialize the display viewFrame info
|
//Initialize the display viewFrame info
|
||||||
mHwcContext->mViewFrame[HWC_DISPLAY_EXTERNAL].left = 0;
|
mHwcContext->mViewFrame[HWC_DISPLAY_EXTERNAL].left = 0;
|
||||||
mHwcContext->mViewFrame[HWC_DISPLAY_EXTERNAL].top = 0;
|
mHwcContext->mViewFrame[HWC_DISPLAY_EXTERNAL].top = 0;
|
||||||
|
|||||||
@@ -2478,6 +2478,9 @@ int MDPCompSrcSplit::configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
|||||||
else if (hnd->format == HAL_PIXEL_FORMAT_RGBX_8888)
|
else if (hnd->format == HAL_PIXEL_FORMAT_RGBX_8888)
|
||||||
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,
|
||||||
|
ActionSafe, and extorientation features. */
|
||||||
|
calcExtDisplayPosition(ctx, hnd, mDpy, crop, dst, transform, orient);
|
||||||
|
|
||||||
int downscale = getRotDownscale(ctx, layer);
|
int downscale = getRotDownscale(ctx, layer);
|
||||||
eMdpFlags mdpFlags = OV_MDP_BACKEND_COMPOSITION;
|
eMdpFlags mdpFlags = OV_MDP_BACKEND_COMPOSITION;
|
||||||
|
|||||||
@@ -636,6 +636,10 @@ void calcExtDisplayPosition(hwc_context_t *ctx,
|
|||||||
displayFrame.top = int(hRatio*(float)displayFrame.top);
|
displayFrame.top = int(hRatio*(float)displayFrame.top);
|
||||||
displayFrame.right = int(wRatio*(float)displayFrame.right);
|
displayFrame.right = int(wRatio*(float)displayFrame.right);
|
||||||
displayFrame.bottom = int(hRatio*(float)displayFrame.bottom);
|
displayFrame.bottom = int(hRatio*(float)displayFrame.bottom);
|
||||||
|
ALOGD_IF(DEBUG_MDPDOWNSCALE, "Calculated external display frame"
|
||||||
|
" for MDPDownscale feature [%d %d %d %d]",
|
||||||
|
displayFrame.left, displayFrame.top,
|
||||||
|
displayFrame.right, displayFrame.bottom);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if(extOrient || ctx->dpyAttr[dpy].mDownScaleMode) {
|
if(extOrient || ctx->dpyAttr[dpy].mDownScaleMode) {
|
||||||
|
|||||||
@@ -21,7 +21,9 @@
|
|||||||
#ifndef HWC_UTILS_H
|
#ifndef HWC_UTILS_H
|
||||||
#define HWC_UTILS_H
|
#define HWC_UTILS_H
|
||||||
|
|
||||||
|
#define DEBUG_MDPDOWNSCALE 0
|
||||||
#define HWC_REMOVE_DEPRECATED_VERSIONS 1
|
#define HWC_REMOVE_DEPRECATED_VERSIONS 1
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <hardware/hwcomposer.h>
|
#include <hardware/hwcomposer.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user