129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* 2a43fb8fce6d9be5577de1e0f49c99bd4fe2f6d44Duy Truong* 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. 13a43fb8fce6d9be5577de1e0f49c99bd4fe2f6d44Duy Truong* * 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_M3D_EXT_PIPE_H 3129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#define OVERLAY_M3D_EXT_PIPE_H 3229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 3329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include "overlayGenPipe.h" 3429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include "overlayUtils.h" 3529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 3629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmednamespace overlay { 3729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 3829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed///////////// M3DExt Pipe //////////////////////////// 3929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/** 4029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* A specific impl of GenericPipe for 3D. 4129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* Whenever needed to have a pass through - we do it. 4229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* If there is a special need for special/diff behavior 4329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* do it here 4429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* PANEL is always EXTERNAL for this pipe. 4529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* CHAN = 0,1 it's either Channel 1 or channel 2 needed for 4629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* 3D crop and position */ 4729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 4829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedclass M3DExtPipe : utils::NoCopy { 4929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedpublic: 5029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* Please look at overlayGenPipe.h for info */ 5129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed explicit M3DExtPipe(); 5229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ~M3DExtPipe(); 53f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool init(RotatorBase* rot); 5429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool close(); 5529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool commit(); 56f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool queueBuffer(int fd, uint32_t offset); 5729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setCrop(const utils::Dim& d); 5829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setPosition(const utils::Dim& dim); 59f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool setTransform(const utils::eTransform& param); 6029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setSource(const utils::PipeArgs& args); 6129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed void dump() const; 6229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedprivate: 6329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed overlay::GenericPipe<utils::EXTERNAL> mM3d; 6429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // Cache the M3D format 6529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed uint32_t mM3Dfmt; 6629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}; 6729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 6829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed///////////// M3DPrimary Pipe //////////////////////////// 6929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/** 7029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* A specific impl of GenericPipe for 3D. 7129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* Whenever needed to have a pass through - we do it. 7229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* If there is a special need for special/diff behavior 7329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* do it here 7429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* PANEL is always PRIMARY for this pipe. 7529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* CHAN = 0,1 it's either Channel 1 or channel 2 needed for 7629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* 3D crop and position */ 7729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 7829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedclass M3DPrimaryPipe : utils::NoCopy { 7929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedpublic: 8029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* Please look at overlayGenPipe.h for info */ 8129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed explicit M3DPrimaryPipe(); 8229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ~M3DPrimaryPipe(); 83f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool init(RotatorBase* rot); 8429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool close(); 8529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool commit(); 86f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool queueBuffer(int fd, uint32_t offset); 8729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setCrop(const utils::Dim& d); 8829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setPosition(const utils::Dim& dim); 89f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool setTransform(const utils::eTransform& param); 9029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setSource(const utils::PipeArgs& args); 9129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed void dump() const; 9229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedprivate: 9329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed overlay::GenericPipe<utils::PRIMARY> mM3d; 9429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // Cache the M3D format 9529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed uint32_t mM3Dfmt; 9629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}; 9729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 9829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed///////////// S3DExt Pipe //////////////////////////////// 9929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/** 10029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* A specific impl of GenericPipe for 3D. 10129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* Whenever needed to have a pass through - we do it. 10229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* If there is a special need for special/diff behavior 10329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* do it here. 10429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* PANEL is always EXTERNAL for this pipe. 10529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* CHAN = 0,1 it's either Channel 1 or channel 2 needed for 10629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* 3D crop and position */ 10729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 10829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedclass S3DExtPipe : utils::NoCopy { 10929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedpublic: 11029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* Please look at overlayGenPipe.h for info */ 11129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed explicit S3DExtPipe(); 11229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ~S3DExtPipe(); 113f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool init(RotatorBase* rot); 11429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool close(); 11529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool commit(); 116f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool queueBuffer(int fd, uint32_t offset); 11729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setCrop(const utils::Dim& d); 11829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setPosition(const utils::Dim& dim); 119f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool setTransform(const utils::eTransform& param); 12029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setSource(const utils::PipeArgs& args); 12129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed void dump() const; 12229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedprivate: 12329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed overlay::GenericPipe<utils::EXTERNAL> mS3d; 12429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // Cache the 3D format 12529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed uint32_t mS3Dfmt; 12629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}; 12729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 12829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed///////////// S3DPrimary Pipe //////////////////////////// 12929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/** 13029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* A specific impl of GenericPipe for 3D. 13129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* Whenever needed to have a pass through - we do it. 13229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* If there is a special need for special/diff behavior 13329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* do it here 13429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* PANEL is always PRIMARY for this pipe. 13529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* CHAN = 0,1 it's either Channel 1 or channel 2 needed for 13629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* 3D crop and position */ 13729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 13829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedclass S3DPrimaryPipe : utils::NoCopy { 13929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedpublic: 14029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* Please look at overlayGenPipe.h for info */ 14129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed explicit S3DPrimaryPipe(); 14229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ~S3DPrimaryPipe(); 143f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool init(RotatorBase* rot); 14429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool close(); 14529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool commit(); 146f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool queueBuffer(int fd, uint32_t offset); 14729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setCrop(const utils::Dim& d); 14829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setPosition(const utils::Dim& dim); 149f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool setTransform(const utils::eTransform& param); 15029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool setSource(const utils::PipeArgs& args); 15129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed void dump() const; 15229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedprivate: 15329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* needed for 3D related IOCTL */ 15429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed MdpCtrl3D mCtrl3D; 15529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed overlay::GenericPipe<utils::PRIMARY> mS3d; 15629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // Cache the 3D format 15729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed uint32_t mS3Dfmt; 15829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}; 15929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 16029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 16129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 16229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 16329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed//------------------------Inlines and Templates-------------------------- 16429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 16529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 16629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed///////////// M3DExt Pipe //////////////////////////// 16729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 16829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline M3DExtPipe<CHAN>::M3DExtPipe() : mM3Dfmt(0) {} 16929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 17029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline M3DExtPipe<CHAN>::~M3DExtPipe() { close(); } 17129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 172f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool M3DExtPipe<CHAN>::init(RotatorBase* rot) { 173f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed ALOGE_IF(DEBUG_OVERLAY, "M3DExtPipe init"); 174f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed if(!mM3d.init(rot)) { 175f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed ALOGE("3Dpipe failed to init"); 17629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return false; 17729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 17829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return true; 17929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 18029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 18129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool M3DExtPipe<CHAN>::close() { 18229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mM3d.close(); 18329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 18429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 18529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool M3DExtPipe<CHAN>::commit() { return mM3d.commit(); } 18629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 187f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool M3DExtPipe<CHAN>::queueBuffer(int fd, uint32_t offset) { 188f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mM3d.queueBuffer(fd, offset); 189f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed} 19029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 19129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool M3DExtPipe<CHAN>::setCrop(const utils::Dim& d) { 19229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Dim _dim; 19329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed if(!utils::getCropS3D<CHAN>(d, _dim, mM3Dfmt)){ 19429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("M3DExtPipe setCrop failed to getCropS3D"); 19529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed _dim = d; 19629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 19729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mM3d.setCrop(_dim); 19829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 199f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed 20029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 20129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool M3DExtPipe<CHAN>::setPosition(const utils::Dim& d) { 20229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Dim _dim; 20329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // original setPositionHandleState has getPositionS3D(...,true) 20429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // which means format is HAL_3D_OUT_SBS_MASK 20529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // HAL_3D_OUT_SBS_MASK is 0x1000 >> 12 == 0x1 as the orig 20629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // code suggets 20729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Whf _whf(mM3d.getScreenInfo().mFBWidth, 20829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mM3d.getScreenInfo().mFBHeight, 20929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mM3Dfmt); 21029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed if(!utils::getPositionS3D<CHAN>(_whf, _dim)) { 21129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("S3DPrimaryPipe setPosition err in getPositionS3D"); 21229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed _dim = d; 21329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 21429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mM3d.setPosition(_dim); 21529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 21629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 217f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool M3DExtPipe<CHAN>::setTransform(const utils::eTransform& param) { 218f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mM3d.setTransform(param); 21929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 22029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 22129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool M3DExtPipe<CHAN>::setSource(const utils::PipeArgs& args) 22229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed{ 22329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // extract 3D fmt 22429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mM3Dfmt = utils::format3DInput(utils::getS3DFormat(args.whf.format)) | 22529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::HAL_3D_OUT_MONOS_MASK; 22629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mM3d.setSource(args); 22729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 22829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 22929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void M3DExtPipe<CHAN>::dump() const { 23029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("M3DExtPipe Pipe fmt=%d", mM3Dfmt); 23129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mM3d.dump(); 23229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 23329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 23429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 23529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed///////////// M3DPrimary Pipe //////////////////////////// 23629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 23729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline M3DPrimaryPipe<CHAN>::M3DPrimaryPipe() : mM3Dfmt(0) {} 23829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 23929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline M3DPrimaryPipe<CHAN>::~M3DPrimaryPipe() { close(); } 24029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 241f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool M3DPrimaryPipe<CHAN>::init(RotatorBase* rot) { 242f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed ALOGE_IF(DEBUG_OVERLAY, "M3DPrimaryPipe init"); 243f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed if(!mM3d.init(rot)) { 244f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed ALOGE("3Dpipe failed to init"); 24529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return false; 24629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 24729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return true; 24829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 24929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 25029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool M3DPrimaryPipe<CHAN>::close() { 25129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mM3d.close(); 25229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 25329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 25429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool M3DPrimaryPipe<CHAN>::commit() { return mM3d.commit(); } 25529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 256f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool M3DPrimaryPipe<CHAN>::queueBuffer(int fd, uint32_t offset) { 257f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mM3d.queueBuffer(fd, offset); 258f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed} 25929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 26029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool M3DPrimaryPipe<CHAN>::setCrop(const utils::Dim& d) { 26129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Dim _dim; 26229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed if(!utils::getCropS3D<CHAN>(d, _dim, mM3Dfmt)){ 26329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("M3DPrimaryPipe setCrop failed to getCropS3D"); 26429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed _dim = d; 26529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 26629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mM3d.setCrop(_dim); 26729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 26829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 26929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool M3DPrimaryPipe<CHAN>::setPosition(const utils::Dim& d) { 27029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mM3d.setPosition(d); 27129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 27229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 273f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool M3DPrimaryPipe<CHAN>::setTransform(const utils::eTransform& param) { 274f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mM3d.setTransform(param); 27529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 27629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 27729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool M3DPrimaryPipe<CHAN>::setSource(const utils::PipeArgs& args) 27829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed{ 27929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // extract 3D fmt 28029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mM3Dfmt = utils::format3DInput(utils::getS3DFormat(args.whf.format)) | 28129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::HAL_3D_OUT_MONOS_MASK; 28229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mM3d.setSource(args); 28329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 28429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 28529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void M3DPrimaryPipe<CHAN>::dump() const { 28629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("M3DPrimaryPipe Pipe fmt=%d", mM3Dfmt); 28729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mM3d.dump(); 28829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 28929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 29029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed///////////// S3DExt Pipe //////////////////////////////// 29129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 29229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline S3DExtPipe<CHAN>::S3DExtPipe() : mS3Dfmt(0) {} 29329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 29429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline S3DExtPipe<CHAN>::~S3DExtPipe() { close(); } 29529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 296f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool S3DExtPipe<CHAN>::init(RotatorBase* rot) { 297f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed ALOGE_IF(DEBUG_OVERLAY, "S3DExtPipe init"); 298f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed if(!mS3d.init(rot)) { 299f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed ALOGE("3Dpipe failed to init"); 30029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return false; 30129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 30229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return true; 30329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 30429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 30529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool S3DExtPipe<CHAN>::close() { 30629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed if(!utils::send3DInfoPacket(0)) { 30729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("S3DExtPipe close failed send3D info packet"); 30829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 30929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mS3d.close(); 31029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 31129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 31229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool S3DExtPipe<CHAN>::commit() { return mS3d.commit(); } 31329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 314f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool S3DExtPipe<CHAN>::queueBuffer(int fd, uint32_t offset) { 315f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mS3d.queueBuffer(fd, offset); 316f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed} 31729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 31829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool S3DExtPipe<CHAN>::setCrop(const utils::Dim& d) { 31929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Dim _dim; 32029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed if(!utils::getCropS3D<CHAN>(d, _dim, mS3Dfmt)){ 32129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("S3DExtPipe setCrop failed to getCropS3D"); 32229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed _dim = d; 32329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 32429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mS3d.setCrop(_dim); 32529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 32629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 32729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool S3DExtPipe<CHAN>::setPosition(const utils::Dim& d) 32829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed{ 32929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Dim _dim; 33029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Whf _whf(mS3d.getScreenInfo().mFBWidth, 33129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mS3d.getScreenInfo().mFBHeight, 33229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mS3Dfmt); 33329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed if(!utils::getPositionS3D<CHAN>(_whf, _dim)) { 33429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("S3DExtPipe setPosition err in getPositionS3D"); 33529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed _dim = d; 33629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 33729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mS3d.setPosition(_dim); 33829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 33929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 340f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool S3DExtPipe<CHAN>::setTransform(const utils::eTransform& param) { 341f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mS3d.setTransform(param); 34229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 34329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 34429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool S3DExtPipe<CHAN>::setSource(const utils::PipeArgs& args) { 34529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mS3Dfmt = utils::getS3DFormat(args.whf.format); 34629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mS3d.setSource(args); 34729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 34829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 34929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void S3DExtPipe<CHAN>::dump() const { 35029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("S3DExtPipe Pipe fmt=%d", mS3Dfmt); 35129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mS3d.dump(); 35229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 35329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 35429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed///////////// S3DPrimary Pipe //////////////////////////// 35529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 35629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline S3DPrimaryPipe<CHAN>::S3DPrimaryPipe() : mS3Dfmt(0) {} 35729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 35829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline S3DPrimaryPipe<CHAN>::~S3DPrimaryPipe() { close(); } 35929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 360f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool S3DPrimaryPipe<CHAN>::init(RotatorBase* rot) { 361f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed ALOGE_IF(DEBUG_OVERLAY, "S3DPrimaryPipe init"); 362f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed if(!mS3d.init(rot)) { 363f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed ALOGE("3Dpipe failed to init"); 36429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return false; 36529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 36629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // set the ctrl fd 36729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mCtrl3D.setFd(mS3d.getCtrlFd()); 36829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return true; 36929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 37029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 37129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool S3DPrimaryPipe<CHAN>::close() { 37229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed if(!utils::enableBarrier(0)) { 37329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("S3DExtPipe close failed enable barrier"); 37429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 37529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mCtrl3D.close(); 37629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mS3d.close(); 37729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 378f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed 37929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 380f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool S3DPrimaryPipe<CHAN>::commit() { 381f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed uint32_t fmt = mS3Dfmt & utils::OUTPUT_3D_MASK; 382f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed if(!utils::send3DInfoPacket(fmt)){ 383f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed ALOGE("Error S3DExtPipe start error send3DInfoPacket %d", fmt); 384f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return false; 385f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed } 386f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mS3d.commit(); 387f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed} 38829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 389f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool S3DPrimaryPipe<CHAN>::queueBuffer(int fd, uint32_t offset) { 390f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mS3d.queueBuffer(fd, offset); 391f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed} 39229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 39329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool S3DPrimaryPipe<CHAN>::setCrop(const utils::Dim& d) { 39429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Dim _dim; 39529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed if(!utils::getCropS3D<CHAN>(d, _dim, mS3Dfmt)){ 39629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("S3DPrimaryPipe setCrop failed to getCropS3D"); 39729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed _dim = d; 39829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 39929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mS3d.setCrop(_dim); 40029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 40129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 40229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool S3DPrimaryPipe<CHAN>::setPosition(const utils::Dim& d) 40329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed{ 40429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Whf fbwhf(mS3d.getScreenInfo().mFBWidth, 40529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mS3d.getScreenInfo().mFBHeight, 40629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 0 /* fmt dont care*/); 40729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mCtrl3D.setWh(fbwhf); 40829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed if(!mCtrl3D.useVirtualFB()) { 40929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("Failed to use VFB on %d (non fatal)", utils::FB0); 41029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return false; 41129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 41229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Dim _dim; 41329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // original setPositionHandleState has getPositionS3D(...,true) 41429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // which means format is HAL_3D_OUT_SBS_MASK 41529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // HAL_3D_OUT_SBS_MASK is 0x1000 >> 12 == 0x1 as the orig 41629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // code suggets 41729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Whf _whf(d.w, d.h, utils::HAL_3D_OUT_SBS_MASK); 41829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed if(!utils::getPositionS3D<CHAN>(_whf, _dim)) { 41929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("S3DPrimaryPipe setPosition err in getPositionS3D"); 42029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed _dim = d; 42129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 42229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mS3d.setPosition(_dim); 42329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 42429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 42529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* for S3DPrimaryPipe, we need to have barriers once 42629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* So the easiest way to achieve it, is to make sure FB0 is having it before 42729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* setParam is running */ 42829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <> 429f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool S3DPrimaryPipe<utils::OV_PIPE0>::setTransform( 430f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed const utils::eTransform& param) { 431f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed uint32_t barrier=0; 432f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed switch(param) { 433f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed case utils::OVERLAY_TRANSFORM_ROT_90: 434f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed case utils::OVERLAY_TRANSFORM_ROT_270: 435f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed barrier = utils::BARRIER_LAND; 436f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed break; 437f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed default: 438f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed barrier = utils::BARRIER_PORT; 439f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed break; 440f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed } 441f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed if(!utils::enableBarrier(barrier)) { 442f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed ALOGE("S3DPrimaryPipe setTransform failed to enable barrier"); 44329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 444f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mS3d.setTransform(param); 44529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 44629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 44729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 448f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool S3DPrimaryPipe<CHAN>::setTransform(const utils::eTransform& param) { 449f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mS3d.setTransform(param); 45029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 45129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 45229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool S3DPrimaryPipe<CHAN>::setSource(const utils::PipeArgs& args) 45329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed{ 45429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mS3Dfmt = utils::getS3DFormat(args.whf.format); 45529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mS3d.setSource(args); 45629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 45729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedtemplate <int CHAN> 45829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void S3DPrimaryPipe<CHAN>::dump() const { 45929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("S3DPrimaryPipe Pipe fmt=%d", mS3Dfmt); 46029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mS3d.dump(); 46129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 46229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 46329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} // overlay 46429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 46529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#endif // OVERLAY_M3D_EXT_PIPE_H 466