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 | 833074a | 2018-08-28 11:53:54 -0700 | [diff] [blame] | 22 | #include "gl/GLES20RenderEngine.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 | f11f39b | 2018-09-05 14:37:41 -0700 | [diff] [blame] | 27 | std::unique_ptr<impl::RenderEngine> RenderEngine::create(int hwcFormat, uint32_t featureFlags) { |
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"); |
| 32 | return renderengine::gl::GLES20RenderEngine::create(hwcFormat, featureFlags); |
| 33 | } |
| 34 | ALOGE("UNKNOWN BackendType: %s, create GLES RenderEngine.", prop); |
Peiyong Lin | f11f39b | 2018-09-05 14:37:41 -0700 | [diff] [blame] | 35 | return renderengine::gl::GLES20RenderEngine::create(hwcFormat, featureFlags); |
| 36 | } |
| 37 | |
Lloyd Pique | 144e116 | 2017-12-20 16:44:52 -0800 | [diff] [blame] | 38 | RenderEngine::~RenderEngine() = default; |
| 39 | |
| 40 | namespace impl { |
| 41 | |
Chia-I Wu | 93e14df | 2018-06-04 10:10:17 -0700 | [diff] [blame] | 42 | RenderEngine::RenderEngine(uint32_t featureFlags) |
Peiyong Lin | f11f39b | 2018-09-05 14:37:41 -0700 | [diff] [blame] | 43 | : mFeatureFlags(featureFlags) {} |
Mathias Agopian | 875d8e1 | 2013-06-07 15:35:48 -0700 | [diff] [blame] | 44 | |
Peiyong Lin | f11f39b | 2018-09-05 14:37:41 -0700 | [diff] [blame] | 45 | RenderEngine::~RenderEngine() = default; |
Jesse Hall | 05f8c70 | 2013-12-23 20:44:38 -0800 | [diff] [blame] | 46 | |
Lloyd Pique | 63f9dbf | 2018-06-21 13:13:07 -0700 | [diff] [blame] | 47 | bool RenderEngine::useNativeFenceSync() const { |
| 48 | return SyncFeatures::getInstance().useNativeFenceSync(); |
| 49 | } |
| 50 | |
| 51 | bool RenderEngine::useWaitSync() const { |
| 52 | return SyncFeatures::getInstance().useWaitSync(); |
| 53 | } |
| 54 | |
Peiyong Lin | 833074a | 2018-08-28 11:53:54 -0700 | [diff] [blame] | 55 | } // namespace impl |
| 56 | } // namespace renderengine |
| 57 | } // namespace android |