1 /*
2 * Copyright Samsung Electronics Co.,LTD.
3 * Copyright (C) 2016 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 #include <log/log.h>
19 #include <mali_gralloc_formats.h>
20 #include <exynos_format.h> // hardware/smasung_slsi/exynos/include
21
22 #include <cstring>
23
24 #include "acrylic_g2d.h"
25 #include "acrylic_internal.h"
26 #include "acrylic_capability.h"
27
createInstance(const char * spec)28 Acrylic *Acrylic::createInstance(const char *spec)
29 {
30 Acrylic *compositor = nullptr;
31
32 ALOGD_TEST("Creating a new Acrylic instance of '%s'", spec);
33 compositor = createAcrylicCompositorG2D(spec);
34 if (compositor) {
35 ALOGI("%s compositor added", spec);
36 }
37
38 ALOGE_IF(!compositor, "Failed to create HW2D compositor of '%s'", spec);
39
40 return compositor;
41 }
42
createCompositor()43 Acrylic *Acrylic::createCompositor()
44 {
45 return Acrylic::createInstance(LIBACRYL_DEFAULT_COMPOSITOR);
46 }
47
createScaler()48 Acrylic *Acrylic::createScaler()
49 {
50 return Acrylic::createInstance(LIBACRYL_DEFAULT_SCALER);
51 }
52
createBlter()53 Acrylic *Acrylic::createBlter()
54 {
55 return Acrylic::createInstance(LIBACRYL_DEFAULT_BLTER);
56 }
57
createAcrylic(const char * spec)58 Acrylic *AcrylicFactory::createAcrylic(const char *spec)
59 {
60 if (strcmp(spec, "default_compositor") == 0) {
61 spec = LIBACRYL_DEFAULT_COMPOSITOR;
62 } else if (strcmp(spec, "default_scaler") == 0) {
63 spec = LIBACRYL_DEFAULT_SCALER;
64 } else if (strcmp(spec, "default_blter") == 0) {
65 spec = LIBACRYL_DEFAULT_BLTER;
66 }
67
68 return Acrylic::createInstance(spec);
69 }
70