129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* 26c43ebed229c5d1e00c6d41638cd2f8e3cb979b7Arun Kumar K.R * Copyright (C) 2012-2013, The Linux Foundation. All rights reserved. 36c43ebed229c5d1e00c6d41638cd2f8e3cb979b7Arun Kumar K.R * 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. 136c43ebed229c5d1e00c6d41638cd2f8e3cb979b7Arun Kumar K.R * * Neither the name of The Linux Foundation or 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 INCLUDE_LIBQCOM_COMPTYPES 3129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#define INCLUDE_LIBQCOM_COMPTYPES 3229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 3329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include <stdint.h> 3429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include <utils/Singleton.h> 3529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include <cutils/properties.h> 3629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 3729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedusing namespace android; 38a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmednamespace qdutils { 3929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed// Enum containing the supported composition types 4029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedenum { 4129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed COMPOSITION_TYPE_GPU = 0, 4229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed COMPOSITION_TYPE_MDP = 0x1, 4329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed COMPOSITION_TYPE_C2D = 0x2, 4429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed COMPOSITION_TYPE_CPU = 0x4, 4529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed COMPOSITION_TYPE_DYN = 0x8 4629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}; 4729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 4829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* This class caches the composition type 4929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed */ 5029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedclass QCCompositionType : public Singleton <QCCompositionType> 5129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed{ 5229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed public: 5329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed QCCompositionType(); 5429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed ~QCCompositionType() { } 5529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed int getCompositionType() {return mCompositionType;} 5629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed private: 5729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed int mCompositionType; 5829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 5929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}; 6029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed 6129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline QCCompositionType::QCCompositionType() 6229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed{ 6329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed char property[PROPERTY_VALUE_MAX]; 646cb6c2d28041a6d2b87a567961d86e9e8148f571Naseer Ahmed mCompositionType = COMPOSITION_TYPE_GPU; 656cb6c2d28041a6d2b87a567961d86e9e8148f571Naseer Ahmed if (property_get("debug.composition.type", property, "gpu") > 0) { 666cb6c2d28041a6d2b87a567961d86e9e8148f571Naseer Ahmed if ((strncmp(property, "mdp", 3)) == 0) { 676cb6c2d28041a6d2b87a567961d86e9e8148f571Naseer Ahmed mCompositionType = COMPOSITION_TYPE_MDP; 686cb6c2d28041a6d2b87a567961d86e9e8148f571Naseer Ahmed } else if ((strncmp(property, "c2d", 3)) == 0) { 696cb6c2d28041a6d2b87a567961d86e9e8148f571Naseer Ahmed mCompositionType = COMPOSITION_TYPE_C2D; 706cb6c2d28041a6d2b87a567961d86e9e8148f571Naseer Ahmed } else if ((strncmp(property, "dyn", 3)) == 0) { 7129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#ifdef USE_MDP3 726cb6c2d28041a6d2b87a567961d86e9e8148f571Naseer Ahmed mCompositionType = COMPOSITION_TYPE_DYN | COMPOSITION_TYPE_MDP; 7329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#else 746cb6c2d28041a6d2b87a567961d86e9e8148f571Naseer Ahmed mCompositionType = COMPOSITION_TYPE_DYN | COMPOSITION_TYPE_C2D; 7529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#endif 7629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 7729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed } 7829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} 796cb6c2d28041a6d2b87a567961d86e9e8148f571Naseer Ahmed 80a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed}; //namespace qdutils 8129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#endif //INCLUDE_LIBQCOM_COMPTYPES 82