hwc: Handle validateAndSet failures in AD prepare call
When validateAndSet fails we must reset the mDoable flag to false and
close the fb device. This will prevent making a draw call using
invalid resource references and prevent any fd leaks.
Additionally, we should only turn AD on if there are no configuration
errors during prepare call. This will prevent toggling AD between
on/off state in the face of continuous failures.
Change-Id: I15502dbf64c6203092aa13e001bab5d27b0e17ec
diff --git a/libhwcomposer/hwc_ad.h b/libhwcomposer/hwc_ad.h
index 3bfde17..0be5f5d 100644
--- a/libhwcomposer/hwc_ad.h
+++ b/libhwcomposer/hwc_ad.h
@@ -50,17 +50,16 @@
mDest = overlay::utils::OV_INVALID;
}
bool isDoable() const { return mDoable; }
- bool isModeOn() const { return (mWbFd >= 0); }
int getDstFd() const;
uint32_t getDstOffset() const;
private:
- //State of feature turned on and off
- int mWbFd;
bool mDoable;
+ bool mTurnedOff;
//State of feature existence on certain devices and configs.
bool mFeatureEnabled;
overlay::utils::eDest mDest;
+ void turnOffAD();
};
}