1ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson/* 2ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. 3ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* 4ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* Redistribution and use in source and binary forms, with or without 5ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* modification, are permitted provided that the following conditions are 6ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* met: 7ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* * Redistributions of source code must retain the above copyright 8ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* notice, this list of conditions and the following disclaimer. 9ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* * Redistributions in binary form must reproduce the above 10ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* copyright notice, this list of conditions and the following 11ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* disclaimer in the documentation and/or other materials provided 12ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* with the distribution. 13ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* * Neither the name of The Linux Foundation nor the names of its 14ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* contributors may be used to endorse or promote products derived 15ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* from this software without specific prior written permission. 16ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* 17ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson*/ 29ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 30ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#ifndef OVERLAY_GENERIC_PIPE_H 31ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define OVERLAY_GENERIC_PIPE_H 32ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 33ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#include "overlayUtils.h" 34ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#include "overlayCtrlData.h" 35ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 36ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonnamespace overlay { 37ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 38ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonclass GenericPipe : utils::NoCopy { 39ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonpublic: 40ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* ctor */ 41a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson explicit GenericPipe(const int& dpy); 42ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* dtor */ 43ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson ~GenericPipe(); 44ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* Control APIs */ 45ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* set source using whf, orient and wait flag */ 46ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void setSource(const utils::PipeArgs& args); 47ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* set crop a.k.a the region of interest */ 48ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void setCrop(const utils::Dim& d); 49a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* set color for mdp pipe */ 50a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson void setColor(const uint32_t color); 51ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* set orientation*/ 52ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void setTransform(const utils::eTransform& param); 53ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* set mdp posision using dim */ 54ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void setPosition(const utils::Dim& dim); 55ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* set visual param */ 56ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool setVisualParams(const MetaData_t &metadata); 57ab05b00fefd34a761dfaf1ccaf8ad14d325873f4radhakrishna /* set pipe type RGB/DMA/VG */ 58ab05b00fefd34a761dfaf1ccaf8ad14d325873f4radhakrishna void setPipeType(const utils::eMdpPipeType& pType); 59ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* commit changes to the overlay "set"*/ 60ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool commit(); 61ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* Data APIs */ 62ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* queue buffer to the overlay */ 63ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool queueBuffer(int fd, uint32_t offset); 64ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* return cached startup args */ 65ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson const utils::PipeArgs& getArgs() const; 66ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* retrieve cached crop data */ 67ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson utils::Dim getCrop() const; 680bc6186c13bed6530aadad53308916869871aa8cSaurabh Shah /* return pipe priority */ 690bc6186c13bed6530aadad53308916869871aa8cSaurabh Shah uint8_t getPriority() const; 70ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* dump the state of the object */ 71ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void dump() const; 72ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* Return the dump in the specified buffer */ 73ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void getDump(char *buf, size_t len); 74a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson int getPipeId(); 75ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 76a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson static bool validateAndSet(GenericPipe* pipeArray[], const int& count, 77a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson const int& fbFd); 78ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonprivate: 79ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson int mDpy; 80a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson Ctrl *mCtrl; 81a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson Data *mData; 82ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson}; 83ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 84ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson} //namespace overlay 85ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 86ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#endif // OVERLAY_GENERIC_PIPE_H 87