hwc: Sync for rotator
Implement sync for rotator.
If a buffer is rotated, it can be used by producer soon after
rotation (and it wont have to wait until vsync).
Mdp waits for the rotator buffer's release fence to signal
to start display.
Hwc waits for previous access to rotator buffer by MDP to finish
before using it
Change-Id: I5664806a17c44d58af62a2825ce454089fcd31cf
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 916a59d..4146787 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -121,6 +121,36 @@
HWC_COPYBIT = 0x00000002,
};
+class LayerRotMap {
+public:
+ LayerRotMap() { reset(); }
+ enum { MAX_SESS = 3 };
+ void add(hwc_layer_1_t* layer, overlay::Rotator *rot);
+ void reset();
+ uint32_t getCount() const;
+ hwc_layer_1_t* getLayer(uint32_t index) const;
+ overlay::Rotator* getRot(uint32_t index) const;
+ void setReleaseFd(const int& fence);
+private:
+ hwc_layer_1_t* mLayer[MAX_SESS];
+ overlay::Rotator* mRot[MAX_SESS];
+ uint32_t mCount;
+};
+
+inline uint32_t LayerRotMap::getCount() const {
+ return mCount;
+}
+
+inline hwc_layer_1_t* LayerRotMap::getLayer(uint32_t index) const {
+ if(index >= mCount) return NULL;
+ return mLayer[index];
+}
+
+inline overlay::Rotator* LayerRotMap::getRot(uint32_t index) const {
+ if(index >= mCount) return NULL;
+ return mRot[index];
+}
+
// -----------------------------------------------------------------------------
// Utility functions - implemented in hwc_utils.cpp
void dumpLayer(hwc_layer_1_t const* l);
@@ -301,7 +331,6 @@
hwc_rect_t mPrevCropVideo;
hwc_rect_t mPrevDestVideo;
int mPrevTransformVideo;
-
//Securing in progress indicator
bool mSecuring;
//External Display configuring progress indicator
@@ -318,6 +347,7 @@
int mExtOrientation;
//Flags the transition of a video session
bool mVideoTransFlag;
+ qhwc::LayerRotMap *mLayerRotMap[MAX_DISPLAYS];
};
namespace qhwc {