blob: 166c267bc813ccc0f1a6380256e886c3d7ac98d0 [file] [log] [blame]
Mathias Agopian875d8e12013-06-07 15:35:48 -07001/*
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 Lincbc184f2018-08-22 13:24:10 -070017#include <renderengine/RenderEngine.h>
Fabien Sanglardc93afd52017-03-13 13:02:42 -070018
Peiyong Linb491b3c2018-08-15 14:53:34 -070019#include <cutils/properties.h>
Peiyong Lincbc184f2018-08-22 13:24:10 -070020#include <log/log.h>
Lloyd Pique63f9dbf2018-06-21 13:13:07 -070021#include <private/gui/SyncFeatures.h>
Peiyong Lin7e219eb2018-12-03 05:40:42 -080022#include "gl/GLESRenderEngine.h"
Jesse Hall19e87292013-12-23 21:02:15 -080023
Mathias Agopian875d8e12013-06-07 15:35:48 -070024namespace android {
Peiyong Lin833074a2018-08-28 11:53:54 -070025namespace renderengine {
Mathias Agopian875d8e12013-06-07 15:35:48 -070026
Alec Mourida4cf3b2019-02-12 15:33:01 -080027std::unique_ptr<impl::RenderEngine> RenderEngine::create(int hwcFormat, uint32_t featureFlags,
28 uint32_t imageCacheSize) {
Peiyong Linb491b3c2018-08-15 14:53:34 -070029 char prop[PROPERTY_VALUE_MAX];
30 property_get(PROPERTY_DEBUG_RENDERENGINE_BACKEND, prop, "gles");
31 if (strcmp(prop, "gles") == 0) {
32 ALOGD("RenderEngine GLES Backend");
Alec Mourida4cf3b2019-02-12 15:33:01 -080033 return renderengine::gl::GLESRenderEngine::create(hwcFormat, featureFlags, imageCacheSize);
Peiyong Linb491b3c2018-08-15 14:53:34 -070034 }
35 ALOGE("UNKNOWN BackendType: %s, create GLES RenderEngine.", prop);
Alec Mourida4cf3b2019-02-12 15:33:01 -080036 return renderengine::gl::GLESRenderEngine::create(hwcFormat, featureFlags, imageCacheSize);
Peiyong Linf11f39b2018-09-05 14:37:41 -070037}
38
Lloyd Pique144e1162017-12-20 16:44:52 -080039RenderEngine::~RenderEngine() = default;
40
41namespace impl {
42
Peiyong Lin46080ef2018-10-26 18:43:14 -070043RenderEngine::RenderEngine(uint32_t featureFlags) : mFeatureFlags(featureFlags) {}
Mathias Agopian875d8e12013-06-07 15:35:48 -070044
Peiyong Linf11f39b2018-09-05 14:37:41 -070045RenderEngine::~RenderEngine() = default;
Jesse Hall05f8c702013-12-23 20:44:38 -080046
Lloyd Pique63f9dbf2018-06-21 13:13:07 -070047bool RenderEngine::useNativeFenceSync() const {
48 return SyncFeatures::getInstance().useNativeFenceSync();
49}
50
51bool RenderEngine::useWaitSync() const {
52 return SyncFeatures::getInstance().useWaitSync();
53}
54
Peiyong Lin46080ef2018-10-26 18:43:14 -070055} // namespace impl
56} // namespace renderengine
57} // namespace android