overlayGenPipe.h revision 36963690317abceae79621f14ba41ff62b3ff489
129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* 2d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. 329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* 429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* Redistribution and use in source and binary forms, with or without 529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* modification, are permitted provided that the following conditions are 629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* met: 729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* * Redistributions of source code must retain the above copyright 829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* notice, this list of conditions and the following disclaimer. 929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* * Redistributions in binary form must reproduce the above 1029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* copyright notice, this list of conditions and the following 1129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* disclaimer in the documentation and/or other materials provided 1229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* with the distribution. 13d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed* * Neither the name of The Linux Foundation nor the names of its 1429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* contributors may be used to endorse or promote products derived 1529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* from this software without specific prior written permission. 1629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* 1729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 1829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 2029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 2129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 2429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 2629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 2729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed*/ 2929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 3029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#ifndef OVERLAY_GENERIC_PIPE_H 3129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#define OVERLAY_GENERIC_PIPE_H 3229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 3329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include "overlayUtils.h" 3429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include "overlayRotator.h" 3529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include "overlayCtrlData.h" 3629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 3729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmednamespace overlay { 3829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 39d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed 4029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedclass GenericPipe : utils::NoCopy { 4129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedpublic: 42f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* ctor */ 43d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed explicit GenericPipe(int dpy); 44f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* dtor */ 4529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ~GenericPipe(); 46d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed bool init(); 4729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool close(); 48f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* Control APIs */ 49f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* set source using whf, orient and wait flag */ 5036963690317abceae79621f14ba41ff62b3ff489Saurabh Shah void setSource(const utils::PipeArgs& args); 51f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* set crop a.k.a the region of interest */ 5236963690317abceae79621f14ba41ff62b3ff489Saurabh Shah void setCrop(const utils::Dim& d); 53f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* set orientation*/ 5436963690317abceae79621f14ba41ff62b3ff489Saurabh Shah void setTransform(const utils::eTransform& param); 55f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* set mdp posision using dim */ 5636963690317abceae79621f14ba41ff62b3ff489Saurabh Shah void setPosition(const utils::Dim& dim); 5729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* commit changes to the overlay "set"*/ 5829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool commit(); 59f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* Data APIs */ 6029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* queue buffer to the overlay */ 61f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool queueBuffer(int fd, uint32_t offset); 6229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* return cached startup args */ 6329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed const utils::PipeArgs& getArgs() const; 6429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* retrieve cached crop data */ 6529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Dim getCrop() const; 6629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* is closed */ 6729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool isClosed() const; 6829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* is open */ 6929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool isOpen() const; 7029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* return Ctrl fd. Used for S3D */ 7129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed int getCtrlFd() const; 7229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* dump the state of the object */ 7329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed void dump() const; 74f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah /* Return the dump in the specified buffer */ 75f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah void getDump(char *buf, size_t len); 76f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah 7729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedprivate: 78f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* set Closed pipe */ 7929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setClosed(); 8029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 81d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed int mFbNum; 8229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* Ctrl/Data aggregator */ 8329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed CtrlData mCtrlData; 84d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed Rotator* mRot; 85f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed //Whether rotator is used for 0-rot or otherwise 86f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool mRotUsed; 87d82ce1da8ebdba46e6d0119fac1aa8d4b9b033b7Ramkumar Radhakrishnan //Whether we will do downscale opt. This is just a request. If the frame is 88d82ce1da8ebdba46e6d0119fac1aa8d4b9b033b7Ramkumar Radhakrishnan //not a candidate, we might not do it. 89d82ce1da8ebdba46e6d0119fac1aa8d4b9b033b7Ramkumar Radhakrishnan bool mRotDownscaleOpt; 9036963690317abceae79621f14ba41ff62b3ff489Saurabh Shah //Whether the source is prerotated. 9136963690317abceae79621f14ba41ff62b3ff489Saurabh Shah bool mPreRotated; 92f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* Pipe open or closed */ 93f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed enum ePipeState { 94f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed CLOSED, 95f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed OPEN 96f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed }; 97f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed ePipeState pipeState; 9829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}; 9929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 10029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} //namespace overlay 10129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 10229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#endif // OVERLAY_GENERIC_PIPE_H 103