liboverlay: Refactor, bug-fixes, upgrade.
* Fix memory leak during copying pipe objects.
* Remove unused / unnecessary code.
* setMemoryId API is merged with queueBuffer.
* setParameter API is setTransform now.
* Rotator upgraded to:
--Allow different rotator hardware types.
--Remove dependency on MDP code.
--Allocate memory only during first playback,
close when the associated pipe is closed.
* Have single commit implementation.
* Include new format types.
* Remove WAIT and CHANNEL enums and usage. Replace BypassPipe with
GenericPipe. Client expected to set alignments and parameters.
Add transform combination enums.
* Allow APIs to be called in any order. Do transform calcs in commit.
Move ext type setter and getter functions.
* Add calculations for 180 transform.
* Add secure session support in rotator
* Implement all rotations in terms of H flip, V flip and 90 rotation.
Change-Id: I34a9a2a0f1255b3467a0abbaa254d0b584e901ce
diff --git a/liboverlay/overlayState.h b/liboverlay/overlayState.h
index 1d13a2e..ea6860f 100644
--- a/liboverlay/overlayState.h
+++ b/liboverlay/overlayState.h
@@ -34,22 +34,16 @@
#include "overlayImpl.h"
#include "overlayRotator.h"
#include "pipes/overlayGenPipe.h"
-#include "pipes/overlayBypassPipe.h"
-#include "pipes/overlayHdmiPipe.h"
+#include "pipes/overlayVideoExtPipe.h"
#include "pipes/overlayUIMirrorPipe.h"
#include "pipes/overlay3DPipe.h"
-// FIXME make int to be uint32 whenever possible
-
namespace overlay {
/*
* Used by Overlay class. Invokes each event
* */
-/* TODO case of RGBx will call mOv open with diff
-* params customized for RGBx pipes */
-
class OverlayState : utils::NoCopy {
public:
/**/
@@ -153,11 +147,11 @@
template <> struct StateTraits<utils::OV_2D_VIDEO_ON_PANEL_TV>
{
typedef overlay::GenericPipe<utils::PRIMARY> pipe0;
- typedef overlay::HdmiPipe pipe1;
+ typedef overlay::VideoExtPipe pipe1;
typedef overlay::NullPipe pipe2; // place holder
typedef Rotator rot0;
- typedef NullRotator rot1;
+ typedef Rotator rot1;
typedef NullRotator rot2;
typedef overlay::OverlayImpl<pipe0, pipe1> ovimpl;
@@ -231,11 +225,11 @@
template <> struct StateTraits<utils::OV_2D_TRUE_UI_MIRROR>
{
typedef overlay::GenericPipe<utils::PRIMARY> pipe0;
- typedef overlay::HdmiPipe pipe1;
+ typedef overlay::VideoExtPipe pipe1;
typedef overlay::UIMirrorPipe pipe2;
typedef Rotator rot0;
- typedef NullRotator rot1;
+ typedef Rotator rot1;
typedef Rotator rot2;
typedef overlay::OverlayImpl<pipe0, pipe1, pipe2> ovimpl;
@@ -243,7 +237,7 @@
template <> struct StateTraits<utils::OV_BYPASS_1_LAYER>
{
- typedef overlay::BypassPipe<utils::OV_MDP_PIPE_VG, utils::IS_FG_SET, utils::WAIT, utils::ZORDER_0> pipe0;
+ typedef overlay::GenericPipe<utils::PRIMARY> pipe0;
typedef overlay::NullPipe pipe1; // place holder
typedef overlay::NullPipe pipe2; // place holder
@@ -256,8 +250,8 @@
template <> struct StateTraits<utils::OV_BYPASS_2_LAYER>
{
- typedef overlay::BypassPipe<utils::OV_MDP_PIPE_VG, utils::IS_FG_SET, utils::NO_WAIT, utils::ZORDER_0> pipe0;
- typedef overlay::BypassPipe<utils::OV_MDP_PIPE_VG, utils::IS_FG_OFF, utils::WAIT, utils::ZORDER_1> pipe1;
+ typedef overlay::GenericPipe<utils::PRIMARY> pipe0;
+ typedef overlay::GenericPipe<utils::PRIMARY> pipe1;
typedef overlay::NullPipe pipe2; // place holder
typedef NullRotator rot0;
@@ -269,9 +263,9 @@
template <> struct StateTraits<utils::OV_BYPASS_3_LAYER>
{
- typedef overlay::BypassPipe<utils::OV_MDP_PIPE_VG, utils::IS_FG_SET, utils::NO_WAIT, utils::ZORDER_0> pipe0;
- typedef overlay::BypassPipe<utils::OV_MDP_PIPE_VG, utils::IS_FG_OFF, utils::NO_WAIT, utils::ZORDER_1> pipe1;
- typedef overlay::BypassPipe<utils::OV_MDP_PIPE_RGB, utils::IS_FG_OFF, utils::WAIT, utils::ZORDER_2> pipe2;
+ typedef overlay::GenericPipe<utils::PRIMARY> pipe0;
+ typedef overlay::GenericPipe<utils::PRIMARY> pipe1;
+ typedef overlay::GenericPipe<utils::PRIMARY> pipe2;
typedef NullRotator rot0;
typedef NullRotator rot1;
@@ -310,8 +304,8 @@
RotatorBase* rot0 = new typename StateTraits<STATE>::rot0;
RotatorBase* rot1 = new typename StateTraits<STATE>::rot1;
RotatorBase* rot2 = new typename StateTraits<STATE>::rot2;
- if(!ov->open(rot0, rot1, rot2)) {
- ALOGE("Overlay failed to open in state %d", STATE);
+ if(!ov->init(rot0, rot1, rot2)) {
+ ALOGE("Overlay failed to init in state %d", STATE);
return 0;
}
return ov;
@@ -329,7 +323,7 @@
return 0;
}
-/* Hard transitions from any state to any state will close and then open */
+/* Hard transitions from any state to any state will close and then init */
template <int STATE>
inline OverlayImplBase* handle_xxx_to_xxx(OverlayImplBase* ov)
{
@@ -392,6 +386,7 @@
// FIXME, how to communicate bad transition?
// Should we have bool returned from transition func?
+ // This is also a very good interview question.
return newov;
}