129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* 2e33e6a894950f7d258d79bc48441575e2b0981dbRaj kamal* Copyright (c) 2012-2013, 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_CTRLDATA_H 3129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#define OVERLAY_CTRLDATA_H 3229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 3329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include "overlayUtils.h" 3429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include "overlayMdp.h" 3529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include "gralloc_priv.h" // INTERLACE_MASK 3629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 3729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmednamespace ovutils = overlay::utils; 3829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 3929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmednamespace overlay { 4029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 4129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* 4229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* Sequence to use: 43f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed* init 4429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* start 4529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* setXXX 4629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* close 4729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* */ 4829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedclass Ctrl : utils::NoCopy { 4929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedpublic: 5029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 5129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* ctor */ 5229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed explicit Ctrl(); 5329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* dtor close */ 5429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ~Ctrl(); 55f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* init fd etc*/ 56f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool init(uint32_t fbnum); 5729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* close underlying mdp */ 5829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool close(); 5929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 6029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* set source using whf, orient and wait flag */ 6136963690317abceae79621f14ba41ff62b3ff489Saurabh Shah void setSource(const utils::PipeArgs& args); 6229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* set crop info and pass it down to mdp */ 6336963690317abceae79621f14ba41ff62b3ff489Saurabh Shah void setCrop(const utils::Dim& d); 64f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* set orientation */ 6536963690317abceae79621f14ba41ff62b3ff489Saurabh Shah void setTransform(const utils::eTransform& p); 66f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* set mdp position using dim */ 6736963690317abceae79621f14ba41ff62b3ff489Saurabh Shah void setPosition(const utils::Dim& dim); 68e2b94da0a7de2a5cad9ecb90ed3eee5dca219863Saurabh Shah /* set mdp visual params using metadata */ 69e2b94da0a7de2a5cad9ecb90ed3eee5dca219863Saurabh Shah bool setVisualParams(const MetaData_t &metadata); 7029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* mdp set overlay/commit changes */ 7129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool commit(); 7229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 7329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* ctrl id */ 74f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed int getPipeId() const; 7529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* ctrl fd */ 7629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed int getFd() const; 7736963690317abceae79621f14ba41ff62b3ff489Saurabh Shah /* retrieve crop data */ 7829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed utils::Dim getCrop() const; 7936963690317abceae79621f14ba41ff62b3ff489Saurabh Shah utils::Dim getPosition() const; 8036963690317abceae79621f14ba41ff62b3ff489Saurabh Shah /* Set downscale */ 8136963690317abceae79621f14ba41ff62b3ff489Saurabh Shah void setDownscale(int dscale_factor); 8236963690317abceae79621f14ba41ff62b3ff489Saurabh Shah /* Update the src format based on rotator's dest */ 8336963690317abceae79621f14ba41ff62b3ff489Saurabh Shah void updateSrcFormat(const uint32_t& rotDstFormat); 84f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah /* dump the state of the object */ 85f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah void dump() const; 86f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah /* Return the dump in the specified buffer */ 87f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah void getDump(char *buf, size_t len); 88f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah 8929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedprivate: 9029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // mdp ctrl struct(info e.g.) 9129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed MdpCtrl mMdp; 9229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}; 9329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 9429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 9529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedclass Data : utils::NoCopy { 9629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedpublic: 9729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* init, reset */ 9829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed explicit Data(); 9929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* calls close */ 10029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ~Data(); 101f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* init fd etc */ 102f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool init(uint32_t fbnum); 10329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* calls underlying mdp close */ 10429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed bool close(); 105f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed /* set overlay pipe id in the mdp struct */ 106f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed void setPipeId(int id); 10729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* get overlay id in the mdp struct */ 108f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed int getPipeId() const; 10929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* queue buffer to the overlay */ 110f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed bool queueBuffer(int fd, uint32_t offset); 11129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed /* sump the state of the obj */ 11229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed void dump() const; 113f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah /* Return the dump in the specified buffer */ 114f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah void getDump(char *buf, size_t len); 115f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah 116f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedprivate: 11729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed // mdp data struct 11829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed MdpData mMdp; 11929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}; 12029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 12129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* This class just creates a Ctrl Data pair to be used by a pipe. 12229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Although this was legacy design, this separation still makes sense, since we 12329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * need to use the Ctrl channel in hwc_prepare (i.e config stage) and Data 12429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * channel in hwc_set (i.e draw stage) 12529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed */ 12629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedstruct CtrlData { 12729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed Ctrl ctrl; 12829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed Data data; 12929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}; 13029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 13129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed//-------------Inlines------------------------------- 13229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 133f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline Ctrl::Ctrl() { 13429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mMdp.reset(); 13529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 13629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 13729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline Ctrl::~Ctrl() { 13829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed close(); 13929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 14029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 14129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool Ctrl::close() { 14229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed if(!mMdp.close()) 14329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return false; 14429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return true; 14529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 14629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 14736963690317abceae79621f14ba41ff62b3ff489Saurabh Shahinline bool Ctrl::init(uint32_t fbnum) { 14836963690317abceae79621f14ba41ff62b3ff489Saurabh Shah // MDP/FD init 14936963690317abceae79621f14ba41ff62b3ff489Saurabh Shah if(!mMdp.init(fbnum)) { 15036963690317abceae79621f14ba41ff62b3ff489Saurabh Shah ALOGE("Ctrl failed to init fbnum=%d", fbnum); 15129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return false; 15229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 15329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return true; 15429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 15529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 15636963690317abceae79621f14ba41ff62b3ff489Saurabh Shahinline void Ctrl::setSource(const utils::PipeArgs& args) 15736963690317abceae79621f14ba41ff62b3ff489Saurabh Shah{ 15836963690317abceae79621f14ba41ff62b3ff489Saurabh Shah mMdp.setSource(args); 15936963690317abceae79621f14ba41ff62b3ff489Saurabh Shah} 16036963690317abceae79621f14ba41ff62b3ff489Saurabh Shah 16136963690317abceae79621f14ba41ff62b3ff489Saurabh Shahinline void Ctrl::setPosition(const utils::Dim& dim) 16236963690317abceae79621f14ba41ff62b3ff489Saurabh Shah{ 16336963690317abceae79621f14ba41ff62b3ff489Saurabh Shah mMdp.setPosition(dim); 16436963690317abceae79621f14ba41ff62b3ff489Saurabh Shah} 16536963690317abceae79621f14ba41ff62b3ff489Saurabh Shah 16636963690317abceae79621f14ba41ff62b3ff489Saurabh Shahinline void Ctrl::setTransform(const utils::eTransform& orient) 16736963690317abceae79621f14ba41ff62b3ff489Saurabh Shah{ 16836963690317abceae79621f14ba41ff62b3ff489Saurabh Shah mMdp.setTransform(orient); 16936963690317abceae79621f14ba41ff62b3ff489Saurabh Shah} 17036963690317abceae79621f14ba41ff62b3ff489Saurabh Shah 17136963690317abceae79621f14ba41ff62b3ff489Saurabh Shahinline void Ctrl::setCrop(const utils::Dim& d) 17236963690317abceae79621f14ba41ff62b3ff489Saurabh Shah{ 17336963690317abceae79621f14ba41ff62b3ff489Saurabh Shah mMdp.setCrop(d); 17436963690317abceae79621f14ba41ff62b3ff489Saurabh Shah} 17536963690317abceae79621f14ba41ff62b3ff489Saurabh Shah 176e2b94da0a7de2a5cad9ecb90ed3eee5dca219863Saurabh Shahinline bool Ctrl::setVisualParams(const MetaData_t &metadata) 177e2b94da0a7de2a5cad9ecb90ed3eee5dca219863Saurabh Shah{ 178e2b94da0a7de2a5cad9ecb90ed3eee5dca219863Saurabh Shah if (!mMdp.setVisualParams(metadata)) { 179e2b94da0a7de2a5cad9ecb90ed3eee5dca219863Saurabh Shah ALOGE("Ctrl setVisualParams failed in MDP setVisualParams"); 180e2b94da0a7de2a5cad9ecb90ed3eee5dca219863Saurabh Shah return false; 181e2b94da0a7de2a5cad9ecb90ed3eee5dca219863Saurabh Shah } 182e2b94da0a7de2a5cad9ecb90ed3eee5dca219863Saurabh Shah return true; 183e2b94da0a7de2a5cad9ecb90ed3eee5dca219863Saurabh Shah} 184e2b94da0a7de2a5cad9ecb90ed3eee5dca219863Saurabh Shah 18536963690317abceae79621f14ba41ff62b3ff489Saurabh Shahinline void Ctrl::dump() const { 18636963690317abceae79621f14ba41ff62b3ff489Saurabh Shah ALOGE("== Dump Ctrl start =="); 18736963690317abceae79621f14ba41ff62b3ff489Saurabh Shah mMdp.dump(); 18836963690317abceae79621f14ba41ff62b3ff489Saurabh Shah ALOGE("== Dump Ctrl end =="); 18936963690317abceae79621f14ba41ff62b3ff489Saurabh Shah} 19036963690317abceae79621f14ba41ff62b3ff489Saurabh Shah 19136963690317abceae79621f14ba41ff62b3ff489Saurabh Shahinline bool Ctrl::commit() { 19236963690317abceae79621f14ba41ff62b3ff489Saurabh Shah if(!mMdp.set()) { 19336963690317abceae79621f14ba41ff62b3ff489Saurabh Shah ALOGE("Ctrl commit failed set overlay"); 19429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return false; 19529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 19629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return true; 19729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 19829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 199f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline int Ctrl::getPipeId() const { 200f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mMdp.getPipeId(); 20129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 20229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 20329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline int Ctrl::getFd() const { 20429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return mMdp.getFd(); 20529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 20629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 20736963690317abceae79621f14ba41ff62b3ff489Saurabh Shahinline void Ctrl::updateSrcFormat(const uint32_t& rotDstFmt) { 20836963690317abceae79621f14ba41ff62b3ff489Saurabh Shah mMdp.updateSrcFormat(rotDstFmt); 20929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 21029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 21129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline utils::Dim Ctrl::getCrop() const { 212f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mMdp.getSrcRectDim(); 21329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 21429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 21536963690317abceae79621f14ba41ff62b3ff489Saurabh Shahinline utils::Dim Ctrl::getPosition() const { 21636963690317abceae79621f14ba41ff62b3ff489Saurabh Shah return mMdp.getDstRectDim(); 217d82ce1da8ebdba46e6d0119fac1aa8d4b9b033b7Ramkumar Radhakrishnan} 218d82ce1da8ebdba46e6d0119fac1aa8d4b9b033b7Ramkumar Radhakrishnan 21936963690317abceae79621f14ba41ff62b3ff489Saurabh Shahinline void Ctrl::setDownscale(int dscale_factor) { 22036963690317abceae79621f14ba41ff62b3ff489Saurabh Shah mMdp.setDownscale(dscale_factor); 221d82ce1da8ebdba46e6d0119fac1aa8d4b9b033b7Ramkumar Radhakrishnan} 222d82ce1da8ebdba46e6d0119fac1aa8d4b9b033b7Ramkumar Radhakrishnan 223f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shahinline void Ctrl::getDump(char *buf, size_t len) { 224f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah mMdp.getDump(buf, len); 225f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah} 226f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah 227f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline Data::Data() { 22829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mMdp.reset(); 22929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 23029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 23129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline Data::~Data() { close(); } 23229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 233f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline void Data::setPipeId(int id) { mMdp.setPipeId(id); } 23429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 235f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline int Data::getPipeId() const { return mMdp.getPipeId(); } 23629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 237f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool Data::init(uint32_t fbnum) { 238f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed if(!mMdp.init(fbnum)) { 239f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed ALOGE("Data cannot init mdp"); 24029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return false; 24129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 24229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return true; 24329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 24429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 24529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool Data::close() { 24629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed if(!mMdp.close()) { 24729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("Data close failed"); 24829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return false; 24929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 25029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed return true; 25129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 25229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 253f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmedinline bool Data::queueBuffer(int fd, uint32_t offset) { 254f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed return mMdp.play(fd, offset); 25529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 25629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 25729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void Data::dump() const { 25829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("== Dump Data MDP start =="); 25929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed mMdp.dump(); 26029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ALOGE("== Dump Data MDP end =="); 26129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 26229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 263f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shahinline void Data::getDump(char *buf, size_t len) { 264f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah mMdp.getDump(buf, len); 265f48c59032a351cda58b2057423b2646423acd7c7Saurabh Shah} 26629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 26729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} // overlay 26829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 26929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#endif 270