Files
android_hardware_qcom_display/liboverlay/pipes/overlayBypassPipe.h
Saurabh Shah dca07219a9 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.

Change-Id: I28d87179c7ec9c0b97721a9ff17f1526da98b714
2012-07-12 15:22:56 -07:00

176 lines
6.0 KiB
C++

/*
* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OVERLAY_BYPASS_PIPE_H
#define OVERLAY_BYPASS_PIPE_H
#include "overlayGenPipe.h"
#include "overlayUtils.h"
#include "overlayCtrlData.h"
#include "overlayMdp.h"
#include "overlayRotator.h"
namespace overlay {
/* A specific impl of GenericPipe
* Whenever needed to have a pass through - we do it.
* If there is a special need for a different behavior - do it here
* PipeType = 0 (RGB), 1 (VG) */
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
class BypassPipe : utils::NoCopy {
public:
/* Please look at overlayGenPipe.h for info */
explicit BypassPipe();
~BypassPipe();
bool init(RotatorBase* rot);
bool close();
bool commit();
bool queueBuffer(int fd, uint32_t offset);
bool waitForVsync();
bool setCrop(const utils::Dim& dim);
bool setPosition(const utils::Dim& dim);
bool setTransform(const utils::eTransform& param);
bool setSource(const utils::PipeArgs& args);
utils::eOverlayPipeType getOvPipeType() const;
void dump() const;
private:
overlay::GenericPipe<ovutils::PRIMARY> mBypass;
};
//------------------Inlines and Templates---------------------
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline BypassPipe<PipeType, IsFg, Wait, Zorder>::BypassPipe() {}
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline BypassPipe<PipeType, IsFg, Wait, Zorder>::~BypassPipe() {
close();
}
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::init(RotatorBase* rot) {
ALOGE_IF(DEBUG_OVERLAY, "BypassPipe init");
return mBypass.init(rot);
}
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::close() {
return mBypass.close();
}
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::commit() {
return mBypass.commit();
}
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::queueBuffer(int fd,
uint32_t offset) {
return mBypass.queueBuffer(fd, offset);
}
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::waitForVsync() {
return mBypass.waitForVsync();
}
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::setCrop(
const utils::Dim& dim) {
return mBypass.setCrop(dim);
}
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::setPosition(
const utils::Dim& dim) {
return mBypass.setPosition(dim);
}
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::setTransform(
const utils::eTransform& param) {
return mBypass.setTransform(param);
}
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::setSource(
const utils::PipeArgs& args) {
utils::PipeArgs arg(args);
// Stride aligned to 32
arg.whf.w = utils::align(arg.whf.w, 32);
arg.whf.h = utils::align(arg.whf.h, 32);
// VG or RG pipe
if (PipeType == utils::OV_MDP_PIPE_VG) {
setMdpFlags(arg.mdpFlags, utils::OV_MDP_PIPE_SHARE);
}
// Set is_fg flag
arg.isFg = IsFg;
// Wait or no wait
arg.wait = Wait;
// Z-order
arg.zorder = Zorder;
return mBypass.setSource(arg);
}
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline utils::eOverlayPipeType BypassPipe<PipeType, IsFg, Wait,
Zorder>::getOvPipeType() const {
return utils::OV_PIPE_TYPE_BYPASS;
}
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
utils::eZorder Zorder>
inline void BypassPipe<PipeType, IsFg, Wait, Zorder>::dump() const {
ALOGE("Bypass VG Pipe");
mBypass.dump();
}
} // overlay
#endif // OVERLAY_BYPASS_PIPE_H