hwc: support WFD external display
Change-Id: I3d24ff1757e79c4b41ff6c6db17d0274cd665671
(cherry picked from commit f8942672226a7af26218aa8d325c1677ae2b83dd)
diff --git a/liboverlay/overlay.h b/liboverlay/overlay.h
index 523e3f7..2378889 100644
--- a/liboverlay/overlay.h
+++ b/liboverlay/overlay.h
@@ -31,6 +31,7 @@
#define OVERLAY_H
#include "overlayUtils.h"
+#include "utils/threads.h"
namespace overlay {
class GenericPipe;
@@ -72,6 +73,10 @@
static Overlay* getInstance();
/* Returns total of available ("unallocated") pipes */
static int availablePipes();
+ /* set the framebuffer index for external display */
+ void setExtFbNum(int fbNum);
+ /* Returns framebuffer index of the current external display */
+ int getExtFbNum();
private:
/* Ctor setup */
@@ -130,8 +135,11 @@
/* Dump string */
char mDumpStr[256];
+ mutable android::Mutex mOvExtFbLock;
+
/* Singleton Instance*/
static Overlay *sInstance;
+ static int sExtFbIndex;
};
inline void Overlay::validate(int index) {
@@ -145,6 +153,16 @@
return PipeBook::availablePipes();
}
+inline void Overlay::setExtFbNum(int fbNum) {
+ android::Mutex::Autolock lock(mOvExtFbLock);
+ sExtFbIndex = fbNum;
+}
+
+inline int Overlay::getExtFbNum() {
+ android::Mutex::Autolock lock(mOvExtFbLock);
+ return sExtFbIndex;
+}
+
inline int Overlay::PipeBook::availablePipes() {
int used = 0;
int bmp = sAllocatedBitmap;