| Mathias Agopian | 875d8e1 | 2013-06-07 15:35:48 -0700 | [diff] [blame] | 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 |  | 
| Peiyong Lin | cbc184f | 2018-08-22 13:24:10 -0700 | [diff] [blame] | 17 | #include <renderengine/RenderEngine.h> | 
| Fabien Sanglard | c93afd5 | 2017-03-13 13:02:42 -0700 | [diff] [blame] | 18 |  | 
| Peiyong Lin | b491b3c | 2018-08-15 14:53:34 -0700 | [diff] [blame] | 19 | #include <cutils/properties.h> | 
| Peiyong Lin | cbc184f | 2018-08-22 13:24:10 -0700 | [diff] [blame] | 20 | #include <log/log.h> | 
| Lloyd Pique | 63f9dbf | 2018-06-21 13:13:07 -0700 | [diff] [blame] | 21 | #include <private/gui/SyncFeatures.h> | 
| Peiyong Lin | 7e219eb | 2018-12-03 05:40:42 -0800 | [diff] [blame] | 22 | #include "gl/GLESRenderEngine.h" | 
| Jesse Hall | 19e8729 | 2013-12-23 21:02:15 -0800 | [diff] [blame] | 23 |  | 
| Mathias Agopian | 875d8e1 | 2013-06-07 15:35:48 -0700 | [diff] [blame] | 24 | namespace android { | 
| Peiyong Lin | 833074a | 2018-08-28 11:53:54 -0700 | [diff] [blame] | 25 | namespace renderengine { | 
| Mathias Agopian | 875d8e1 | 2013-06-07 15:35:48 -0700 | [diff] [blame] | 26 |  | 
| Peiyong Lin | 4137a1d | 2019-10-09 10:39:09 -0700 | [diff] [blame] | 27 | std::unique_ptr<impl::RenderEngine> RenderEngine::create(const RenderEngineCreationArgs& args) { | 
| Peiyong Lin | b491b3c | 2018-08-15 14:53:34 -0700 | [diff] [blame] | 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"); | 
| Peiyong Lin | 4137a1d | 2019-10-09 10:39:09 -0700 | [diff] [blame] | 32 |         return renderengine::gl::GLESRenderEngine::create(args); | 
| Peiyong Lin | b491b3c | 2018-08-15 14:53:34 -0700 | [diff] [blame] | 33 |     } | 
 | 34 |     ALOGE("UNKNOWN BackendType: %s, create GLES RenderEngine.", prop); | 
| Peiyong Lin | 4137a1d | 2019-10-09 10:39:09 -0700 | [diff] [blame] | 35 |     return renderengine::gl::GLESRenderEngine::create(args); | 
| Peiyong Lin | f11f39b | 2018-09-05 14:37:41 -0700 | [diff] [blame] | 36 | } | 
 | 37 |  | 
| Lloyd Pique | 144e116 | 2017-12-20 16:44:52 -0800 | [diff] [blame] | 38 | RenderEngine::~RenderEngine() = default; | 
 | 39 |  | 
 | 40 | namespace impl { | 
 | 41 |  | 
| Peiyong Lin | 4137a1d | 2019-10-09 10:39:09 -0700 | [diff] [blame] | 42 | RenderEngine::RenderEngine(const RenderEngineCreationArgs& args) : mArgs(args) {} | 
| Mathias Agopian | 875d8e1 | 2013-06-07 15:35:48 -0700 | [diff] [blame] | 43 |  | 
| Peiyong Lin | f11f39b | 2018-09-05 14:37:41 -0700 | [diff] [blame] | 44 | RenderEngine::~RenderEngine() = default; | 
| Jesse Hall | 05f8c70 | 2013-12-23 20:44:38 -0800 | [diff] [blame] | 45 |  | 
| Lloyd Pique | 63f9dbf | 2018-06-21 13:13:07 -0700 | [diff] [blame] | 46 | bool RenderEngine::useNativeFenceSync() const { | 
 | 47 |     return SyncFeatures::getInstance().useNativeFenceSync(); | 
 | 48 | } | 
 | 49 |  | 
 | 50 | bool RenderEngine::useWaitSync() const { | 
 | 51 |     return SyncFeatures::getInstance().useWaitSync(); | 
 | 52 | } | 
 | 53 |  | 
| Peiyong Lin | 46080ef | 2018-10-26 18:43:14 -0700 | [diff] [blame] | 54 | } // namespace impl | 
 | 55 | } // namespace renderengine | 
 | 56 | } // namespace android |