blob: 3b54873b853a50fb4cd18f039b62bacca01af29a [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 Lin833074a2018-08-28 11:53:54 -070022#include "gl/GLES20RenderEngine.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
Peiyong Linf11f39b2018-09-05 14:37:41 -070027std::unique_ptr<impl::RenderEngine> RenderEngine::create(int hwcFormat, uint32_t featureFlags) {
Peiyong Linb491b3c2018-08-15 14:53:34 -070028 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 Linf11f39b2018-09-05 14:37:41 -070035 return renderengine::gl::GLES20RenderEngine::create(hwcFormat, featureFlags);
36}
37
Lloyd Pique144e1162017-12-20 16:44:52 -080038RenderEngine::~RenderEngine() = default;
39
40namespace impl {
41
Chia-I Wu93e14df2018-06-04 10:10:17 -070042RenderEngine::RenderEngine(uint32_t featureFlags)
Peiyong Linf11f39b2018-09-05 14:37:41 -070043 : 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 Lin833074a2018-08-28 11:53:54 -070055} // namespace impl
56} // namespace renderengine
57} // namespace android