1// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS.  PLEASE
2//     CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
3//     DEPENDING ON IT IN YOUR PROJECT. ***
4package {
5    default_team: "trendy_team_android_developer_tools",
6    // See: http://go/android-license-faq
7    // A large-scale-change added 'default_applicable_licenses' to import
8    // all of the 'license_kinds' from "hardware_google_gfxstream_license"
9    // to get the below license kinds:
10    //   SPDX-license-identifier-Apache-2.0
11    //   SPDX-license-identifier-BSD
12    //   SPDX-license-identifier-ISC
13    //   SPDX-license-identifier-MIT
14    //   legacy_by_exception_only (by exception only)
15    //   legacy_notice
16    //   legacy_unencumbered
17    default_applicable_licenses: ["hardware_google_gfxstream_license"],
18}
19
20gfxstream_backend_static_deps = [
21    "gfxstream_base",
22    "gfxstream_host_common",
23    "libgfxstream_common_utils",
24    "libgfxstream_host_features",
25    "libgfxstream_etc",
26    "libgfxstream_glestranslator_egl",
27    "libgfxstream_glestranslator_glescm",
28    "libgfxstream_glestranslator_glesv2",
29    "libgfxstream_host_apigen_codec_common",
30    "libgfxstream_host_compressedtextures",
31    "libgfxstream_host_dispatch",
32    "libgfxstream_host_gl_host_common",
33    "libgfxstream_host_gl_server",
34    "libgfxstream_host_gles1_dec",
35    "libgfxstream_host_gles2_dec",
36    "libgfxstream_host_glestranslator_glcommon",
37    "libgfxstream_host_glsnapshot",
38    "libgfxstream_host_rendercontrol_dec",
39    "libgfxstream_host_vulkan_cereal",
40    "libgfxstream_host_vulkan_emulatedtextures",
41    "libgfxstream_host_vulkan_server",
42    "libgfxstream_thirdparty_glm",
43]
44
45gfxstream_backend_magma_static_deps = [
46    "libgfxstream_host_magma_dec",
47    "libgfxstream_host_magma_server",
48]
49
50cc_defaults {
51    name: "libgfxstream_backend_defaults",
52    defaults: ["gfxstream_defaults"],
53    vendor_available: true,
54    cflags: [
55        "-Wno-unused-parameter",
56        "-Wno-unused-variable",
57        "-Wno-unused-function",
58        "-Wno-unreachable-code-loop-increment",
59    ],
60    header_libs: [
61        "gfxstream_opengl_headers",
62        "libgfxstream_host_vulkan_cereal_common",
63    ],
64    // When this lib is build as a static lib, these static dependencies have
65    // to be included as a whole, because otherwise they are dropped from the
66    // built archive.
67    static: {
68        whole_static_libs: gfxstream_backend_static_deps,
69    },
70    shared: {
71        static_libs: gfxstream_backend_static_deps,
72    },
73    export_static_lib_headers: [
74        "gfxstream_base",
75        "libgfxstream_host_features",
76        "libgfxstream_host_gl_host_common",
77        "libgfxstream_host_gles2_dec",
78        "libgfxstream_host_glsnapshot",
79        "libgfxstream_host_vulkan_cereal",
80    ],
81    shared_libs: [
82        "liblog", // gfxstream_base uses this via perfetto-libperfettobase
83    ],
84    export_include_dirs: [
85        "include",
86    ],
87    srcs: [
88        "Buffer.cpp",
89        "BlobManager.cpp",
90        "ChannelStream.cpp",
91        "ColorBuffer.cpp",
92        "DisplaySurface.cpp",
93        "DisplaySurfaceUser.cpp",
94        "Hwc2.cpp",
95        "PostWorker.cpp",
96        "PostWorkerGl.cpp",
97        "ReadBuffer.cpp",
98        "render_api.cpp",
99        "RenderChannelImpl.cpp",
100        "RenderThread.cpp",
101        "RenderThreadInfo.cpp",
102        "RenderThreadInfoGl.cpp",
103        "RingStream.cpp",
104        "SyncThread.cpp",
105        "RenderControl.cpp",
106        "RenderWindow.cpp",
107        "RenderLibImpl.cpp",
108        "RendererImpl.cpp",
109        "FrameBuffer.cpp",
110        "GfxStreamAgents.cpp",
111        "virtio-gpu-gfxstream-renderer.cpp",
112        "virtio-gpu-gfxstream-renderer-goldfish.cpp",
113        "VirtioGpuTimelines.cpp",
114        "VsyncThread.cpp",
115    ],
116    host_ldlibs: [
117        "-lpthread",
118    ],
119    target: {
120        host: {
121            srcs: ["NativeSubWindow_x11.cpp"],
122        },
123        android: {
124            srcs: ["NativeSubWindow_android.cpp"],
125        },
126    },
127}
128
129cc_library {
130    name: "libgfxstream_backend",
131    defaults: ["libgfxstream_backend_defaults"],
132}
133
134cc_library {
135    name: "libgfxstream_backend_magma",
136    defaults: ["libgfxstream_backend_defaults"],
137    static: {
138        whole_static_libs: gfxstream_backend_magma_static_deps,
139    },
140    shared: {
141        static_libs: gfxstream_backend_magma_static_deps,
142    },
143    export_static_lib_headers: gfxstream_backend_magma_static_deps,
144}
145
146cc_test_library {
147    name: "gfxstream_backend_test_support",
148    defaults: ["gfxstream_defaults"],
149    srcs: [
150        "tests/GLSnapshotTesting.cpp",
151        "tests/GLTestUtils.cpp",
152        "tests/GLSnapshotTestDispatch.cpp",
153        "tests/GLSnapshotTestStateUtils.cpp",
154        "tests/OpenGLTestContext.cpp",
155        "tests/SampleApplication.cpp",
156        "tests/ShaderUtils.cpp",
157    ],
158    header_libs: [
159        "gfxstream_opengl_headers",
160        "libgfxstream_host_vulkan_cereal_common",
161    ],
162    shared_libs: [
163        "libbase",
164        "libgfxstream_backend",
165    ],
166    export_static_lib_headers: [
167        "libgfxstream_oswindow_test_support",
168    ],
169    static_libs: [
170        "libgfxstream_host_apigen_codec_common",
171        "gfxstream_base",
172        "gfxstream_base_test_support",
173        "gfxstream_host_common_test_support",
174        "gfxstream_snapshot",
175        "libgfxstream_oswindow_test_support",
176        "libgmock",
177        "liblz4",
178    ],
179    export_include_dirs: ["tests"],
180}
181
182// Run with `atest --host gfxstream_compositorvk_test`
183cc_test_host {
184    name: "gfxstream_compositorvk_test",
185    defaults: ["gfxstream_defaults"],
186    header_libs: [
187        "libgfxstream_host_vulkan_cereal_common",
188    ],
189    srcs: [
190        "tests/CompositorVk_unittest.cpp",
191    ],
192    data: [
193        "tests/testdata/256x256_android.png",
194        "tests/testdata/256x256_android_with_transparency.png",
195        "tests/testdata/256x256_golden_blend_premultiplied.png",
196        "tests/testdata/256x256_golden_crop.png",
197        "tests/testdata/256x256_golden_simple_composition.png",
198        "tests/testdata/256x256_golden_multiple_layers.png",
199        "tests/testdata/256x256_golden_multiple_targets_0.png",
200        "tests/testdata/256x256_golden_multiple_targets_1.png",
201        "tests/testdata/256x256_golden_multiple_targets_2.png",
202        "tests/testdata/256x256_golden_multiple_targets_3.png",
203        "tests/testdata/256x256_golden_multiple_targets_4.png",
204        "tests/testdata/256x256_golden_multiple_targets_5.png",
205        "tests/testdata/256x256_golden_multiple_targets_6.png",
206        "tests/testdata/256x256_golden_multiple_targets_7.png",
207        "tests/testdata/256x256_golden_multiple_targets_8.png",
208        "tests/testdata/256x256_golden_multiple_targets_9.png",
209        "tests/testdata/256x256_golden_solid_color.png",
210        "tests/testdata/256x256_golden_solid_color_above.png",
211        "tests/testdata/256x256_golden_solid_color_below.png",
212        "tests/testdata/256x256_golden_transform_none.png",
213        "tests/testdata/256x256_golden_transform_fliph.png",
214        "tests/testdata/256x256_golden_transform_flipv.png",
215        "tests/testdata/256x256_golden_transform_rot90.png",
216        "tests/testdata/256x256_golden_transform_rot180.png",
217        "tests/testdata/256x256_golden_transform_rot270.png",
218        "tests/testdata/256x256_golden_transform_fliphrot90.png",
219        "tests/testdata/256x256_golden_transform_flipvrot90.png",
220    ],
221    shared_libs: [
222        "libbase",
223        "libgfxstream_backend",
224        "libgfxstream_common_image",
225    ],
226    static_libs: [
227        "libgfxstream_host_vulkan_server",
228        "libgfxstream_thirdparty_glm",
229    ],
230    test_options: {
231        // Disabled by default as requires Vulkan.
232        unit_test: false,
233    },
234    test_suites: [
235        "general-tests",
236    ],
237}
238
239// Run with `atest --host gfxstream_framebuffer_tests`
240cc_test_host {
241    name: "gfxstream_framebuffer_tests",
242    defaults: ["gfxstream_defaults"],
243    header_libs: [
244        "libgfxstream_host_vulkan_cereal_common",
245    ],
246    srcs: [
247        "tests/FrameBuffer_unittest.cpp",
248    ],
249    shared_libs: [
250        "libbase",
251        "libgfxstream_backend",
252    ],
253    static_libs: [
254        "gfxstream_backend_test_support",
255        "gfxstream_base_test_support",
256        "gfxstream_base",
257        "gfxstream_host_common_test_support",
258        "gfxstream_snapshot",
259        "libgfxstream_common_image",
260        "libgfxstream_host_vulkan_server",
261        "libgfxstream_oswindow_test_support",
262        "libgfxstream_thirdparty_glm",
263        "libgmock",
264        "liblz4",
265    ],
266    test_options: {
267        // Disabled by default as requires Vulkan.
268        unit_test: false,
269    },
270    test_suites: [
271        "general-tests",
272    ],
273}
274
275cc_test_host {
276    name: "gfxstream_magma_tests",
277    defaults: ["gfxstream_defaults"],
278    srcs: [
279        "tests/Magma_unittest.cpp",
280    ],
281    shared_libs: [
282        "libbase",
283        "libgfxstream_backend_magma",
284    ],
285    test_suites: [
286        "general-tests",
287    ],
288}
289