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(int hwcFormat,uint32_t featureFlags,uint32_t imageCacheSize)27 std::unique_ptr<impl::RenderEngine> RenderEngine::create(int hwcFormat, uint32_t featureFlags,
28 uint32_t imageCacheSize) {
29 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");
33 return renderengine::gl::GLESRenderEngine::create(hwcFormat, featureFlags, imageCacheSize);
34 }
35 ALOGE("UNKNOWN BackendType: %s, create GLES RenderEngine.", prop);
36 return renderengine::gl::GLESRenderEngine::create(hwcFormat, featureFlags, imageCacheSize);
37 }
38
39 RenderEngine::~RenderEngine() = default;
40
41 namespace impl {
42
RenderEngine(uint32_t featureFlags)43 RenderEngine::RenderEngine(uint32_t featureFlags) : mFeatureFlags(featureFlags) {}
44
45 RenderEngine::~RenderEngine() = default;
46
useNativeFenceSync() const47 bool RenderEngine::useNativeFenceSync() const {
48 return SyncFeatures::getInstance().useNativeFenceSync();
49 }
50
useWaitSync() const51 bool RenderEngine::useWaitSync() const {
52 return SyncFeatures::getInstance().useWaitSync();
53 }
54
55 } // namespace impl
56 } // namespace renderengine
57 } // namespace android
58