1 /* 2 * Copyright 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include <renderengine/RenderEngine.h> 18 19 #include <cutils/properties.h> 20 #include <log/log.h> 21 #include <private/gui/SyncFeatures.h> 22 #include "gl/GLESRenderEngine.h" 23 24 namespace android { 25 namespace renderengine { 26 create(const RenderEngineCreationArgs & args)27std::unique_ptr<impl::RenderEngine> RenderEngine::create(const RenderEngineCreationArgs& args) { 28 char prop[PROPERTY_VALUE_MAX]; 29 property_get(PROPERTY_DEBUG_RENDERENGINE_BACKEND, prop, "gles"); 30 if (strcmp(prop, "gles") == 0) { 31 ALOGD("RenderEngine GLES Backend"); 32 return renderengine::gl::GLESRenderEngine::create(args); 33 } 34 ALOGE("UNKNOWN BackendType: %s, create GLES RenderEngine.", prop); 35 return renderengine::gl::GLESRenderEngine::create(args); 36 } 37 38 RenderEngine::~RenderEngine() = default; 39 40 namespace impl { 41 RenderEngine(const RenderEngineCreationArgs & args)42RenderEngine::RenderEngine(const RenderEngineCreationArgs& args) : mArgs(args) {} 43 44 RenderEngine::~RenderEngine() = default; 45 useNativeFenceSync() const46bool RenderEngine::useNativeFenceSync() const { 47 return SyncFeatures::getInstance().useNativeFenceSync(); 48 } 49 useWaitSync() const50bool RenderEngine::useWaitSync() const { 51 return SyncFeatures::getInstance().useWaitSync(); 52 } 53 54 } // namespace impl 55 } // namespace renderengine 56 } // namespace android 57