hwc: Writeback for ad is needed only for split displays.
Writeback for assertive display feature is needed only for split displays and only if ro.qcom.ad is set to 2 by OEM. This patch removes the unnecessary code and adds the relevant conditional checks for split displays and property value Change-Id: Ic36f28441d1a6e93132316b33fe1cf98a6e1efe4
This commit is contained in:
@@ -124,14 +124,28 @@ static int adRead() {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
AssertiveDisplay::AssertiveDisplay() :mWbFd(-1), mDoable(false),
|
AssertiveDisplay::AssertiveDisplay(hwc_context_t *ctx) : mWbFd(-1),
|
||||||
mFeatureEnabled(false), mDest(overlay::utils::OV_INVALID) {
|
mDoable(false), mFeatureEnabled(false),
|
||||||
|
mDest(overlay::utils::OV_INVALID) {
|
||||||
int fd = openWbFb();
|
int fd = openWbFb();
|
||||||
if(fd >= 0) {
|
if(fd >= 0) {
|
||||||
|
//Values in ad node:
|
||||||
//-1 means feature is disabled on device
|
//-1 means feature is disabled on device
|
||||||
// 0 means feature exists but turned off, will be turned on by hwc
|
// 0 means feature exists but turned off, will be turned on by hwc
|
||||||
// 1 means feature is turned on by hwc
|
// 1 means feature is turned on by hwc
|
||||||
if(adRead() >= 0) {
|
// Plus, we do this feature only on split primary displays.
|
||||||
|
// Plus, we do this feature only if ro.qcom.ad=2
|
||||||
|
|
||||||
|
char property[PROPERTY_VALUE_MAX];
|
||||||
|
const int ENABLED = 2;
|
||||||
|
int val = 0;
|
||||||
|
|
||||||
|
if(property_get("ro.qcom.ad", property, "0") > 0) {
|
||||||
|
val = atoi(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(adRead() >= 0 && isDisplaySplit(ctx, HWC_DISPLAY_PRIMARY) &&
|
||||||
|
val == ENABLED) {
|
||||||
ALOGD_IF(DEBUG, "Assertive display feature supported");
|
ALOGD_IF(DEBUG, "Assertive display feature supported");
|
||||||
mFeatureEnabled = true;
|
mFeatureEnabled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace qhwc {
|
|||||||
|
|
||||||
class AssertiveDisplay {
|
class AssertiveDisplay {
|
||||||
public:
|
public:
|
||||||
AssertiveDisplay();
|
AssertiveDisplay(hwc_context_t *ctx);
|
||||||
void markDoable(hwc_context_t *ctx, const hwc_display_contents_1_t* list);
|
void markDoable(hwc_context_t *ctx, const hwc_display_contents_1_t* list);
|
||||||
bool prepare(hwc_context_t *ctx, const hwc_rect_t& crop,
|
bool prepare(hwc_context_t *ctx, const hwc_rect_t& crop,
|
||||||
const overlay::utils::Whf& whf,
|
const overlay::utils::Whf& whf,
|
||||||
|
|||||||
@@ -1057,13 +1057,6 @@ bool MDPCompNonSplit::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
|
|||||||
int fd = hnd->fd;
|
int fd = hnd->fd;
|
||||||
uint32_t offset = hnd->offset;
|
uint32_t offset = hnd->offset;
|
||||||
|
|
||||||
if(ctx->mAD->isModeOn()) {
|
|
||||||
if(ctx->mAD->draw(ctx, fd, offset)) {
|
|
||||||
fd = ctx->mAD->getDstFd(ctx);
|
|
||||||
offset = ctx->mAD->getDstOffset(ctx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rotator *rot = mCurrentFrame.mdpToLayer[mdpIndex].rot;
|
Rotator *rot = mCurrentFrame.mdpToLayer[mdpIndex].rot;
|
||||||
if(rot) {
|
if(rot) {
|
||||||
if(!rot->queueBuffer(fd, offset))
|
if(!rot->queueBuffer(fd, offset))
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ void initContext(hwc_context_t *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
MDPComp::init(ctx);
|
MDPComp::init(ctx);
|
||||||
ctx->mAD = new AssertiveDisplay();
|
ctx->mAD = new AssertiveDisplay(ctx);
|
||||||
|
|
||||||
ctx->vstate.enable = false;
|
ctx->vstate.enable = false;
|
||||||
ctx->vstate.fakevsync = false;
|
ctx->vstate.fakevsync = false;
|
||||||
@@ -1250,13 +1250,6 @@ int configureNonSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
|||||||
setMdpFlags(layer, mdpFlags, downscale, transform);
|
setMdpFlags(layer, mdpFlags, downscale, transform);
|
||||||
trimLayer(ctx, dpy, transform, crop, dst);
|
trimLayer(ctx, dpy, transform, crop, dst);
|
||||||
|
|
||||||
//Will do something only if feature enabled and conditions suitable
|
|
||||||
//hollow call otherwise
|
|
||||||
if(ctx->mAD->prepare(ctx, crop, whf, hnd)) {
|
|
||||||
overlay::Writeback *wb = overlay::Writeback::getInstance();
|
|
||||||
whf.format = wb->getOutputFormat();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isYuvBuffer(hnd) && //if 90 component or downscale, use rot
|
if(isYuvBuffer(hnd) && //if 90 component or downscale, use rot
|
||||||
((transform & HWC_TRANSFORM_ROT_90) || downscale)) {
|
((transform & HWC_TRANSFORM_ROT_90) || downscale)) {
|
||||||
*rot = ctx->mRotMgr->getNext();
|
*rot = ctx->mRotMgr->getNext();
|
||||||
|
|||||||
Reference in New Issue
Block a user