/* * 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 class BypassPipe : utils::NoCopy { public: /* Please look at overlayGenPipe.h for info */ explicit BypassPipe(); ~BypassPipe(); bool open(RotatorBase* rot); bool close(); bool commit(); void setId(int id); void setMemoryId(int id); bool queueBuffer(uint32_t offset); bool dequeueBuffer(void*& buf); bool waitForVsync(); bool setCrop(const utils::Dim& dim); bool start(const utils::PipeArgs& args); bool setPosition(const utils::Dim& dim); bool setParameter(const utils::Params& param); bool setSource(const utils::PipeArgs& args); const utils::PipeArgs& getArgs() const; utils::eOverlayPipeType getOvPipeType() const; void dump() const; private: overlay::GenericPipe mBypass; }; //------------------Inlines and Templates--------------------- template inline BypassPipe::BypassPipe() {} template inline BypassPipe::~BypassPipe() { close(); } template inline bool BypassPipe::open(RotatorBase* rot) { ALOGE_IF(DEBUG_OVERLAY, "BypassPipe open"); return mBypass.open(rot); } template inline bool BypassPipe::close() { return mBypass.close(); } template inline bool BypassPipe::commit() { return mBypass.commit(); } template inline void BypassPipe::setId(int id) { mBypass.setId(id); } template inline void BypassPipe::setMemoryId(int id) { mBypass.setMemoryId(id); } template inline bool BypassPipe::queueBuffer( uint32_t offset) { return mBypass.queueBuffer(offset); } template inline bool BypassPipe::dequeueBuffer( void*& buf) { return mBypass.dequeueBuffer(buf); } template inline bool BypassPipe::waitForVsync() { return mBypass.waitForVsync(); } template inline bool BypassPipe::setCrop( const utils::Dim& dim) { return mBypass.setCrop(dim); } template inline bool BypassPipe::start( const utils::PipeArgs& args) { return mBypass.start(args); } template inline bool BypassPipe::setPosition( const utils::Dim& dim) { return mBypass.setPosition(dim); } template inline bool BypassPipe::setParameter( const utils::Params& param) { return mBypass.setParameter(param); } template inline bool BypassPipe::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 inline const utils::PipeArgs& BypassPipe::getArgs() const { return mBypass.getArgs(); } template inline utils::eOverlayPipeType BypassPipe::getOvPipeType() const { return utils::OV_PIPE_TYPE_BYPASS; } template inline void BypassPipe::dump() const { ALOGE("Bypass VG Pipe"); mBypass.dump(); } } // overlay #endif // OVERLAY_BYPASS_PIPE_H