1// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS.  PLEASE
2//     CONSULT THE OWNERS AND [email protected] 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
20cc_library_host_static {
21    name: "libgfxstream_backend_proto",
22    defaults: [
23        "gfxstream_defaults",
24        "gfxstream_host_cc_defaults",
25    ],
26    proto: {
27        canonical_path_from_root: false,
28        export_proto_headers: true,
29        type: "full",
30        static: true,
31    },
32    srcs: [
33        "VirtioGpuContextSnapshot.proto",
34        "VirtioGpuFrontendSnapshot.proto",
35        "VirtioGpuRingBlobSnapshot.proto",
36        "VirtioGpuResourceSnapshot.proto",
37    ],
38}
39
40gfxstream_backend_static_deps = [
41    "gfxstream_base",
42    "gfxstream_host_common",
43    "libgfxstream_common_utils",
44    "libgfxstream_host_features",
45    "libgfxstream_host_tracing",
46    "libgfxstream_etc",
47    "libgfxstream_glestranslator_egl",
48    "libgfxstream_glestranslator_glescm",
49    "libgfxstream_glestranslator_glesv2",
50    "libgfxstream_host_apigen_codec_common",
51    "libgfxstream_host_backend",
52    "libgfxstream_host_compressedtextures",
53    "libgfxstream_host_dispatch",
54    "libgfxstream_host_gl_host_common",
55    "libgfxstream_host_gl_server",
56    "libgfxstream_host_gles1_dec",
57    "libgfxstream_host_gles2_dec",
58    "libgfxstream_host_glestranslator_glcommon",
59    "libgfxstream_host_glsnapshot",
60    "libgfxstream_host_rendercontrol_dec",
61    "libgfxstream_host_vulkan_cereal",
62    "libgfxstream_host_vulkan_emulatedtextures",
63    "libgfxstream_host_vulkan_server",
64    "libgfxstream_thirdparty_glm",
65]
66
67gfxstream_backend_snapshot_static_deps = [
68    "libgfxstream_backend_proto",
69    "libprotobuf-cpp-full",
70    "libz",
71]
72
73gfxstream_backend_magma_static_deps = [
74    "libgfxstream_host_magma_dec",
75    "libgfxstream_host_magma_server",
76]
77
78cc_defaults {
79    name: "libgfxstream_backend_defaults",
80    defaults: [
81        "gfxstream_defaults",
82        "gfxstream_host_cc_defaults",
83    ],
84    vendor_available: true,
85    cflags: [
86        "-Wno-unused-parameter",
87        "-Wno-unused-variable",
88        "-Wno-unused-function",
89        "-Wno-unreachable-code-loop-increment",
90    ],
91    header_libs: [
92        "gfxstream_opengl_headers",
93        "libgfxstream_host_vulkan_cereal_common",
94    ],
95    // When this lib is build as a static lib, these static dependencies have
96    // to be included as a whole, because otherwise they are dropped from the
97    // built archive.
98    static: {
99        whole_static_libs: gfxstream_backend_static_deps,
100    },
101    shared: {
102        static_libs: gfxstream_backend_static_deps,
103    },
104    export_static_lib_headers: [
105        "gfxstream_base",
106        "libgfxstream_host_features",
107        "libgfxstream_host_tracing",
108        "libgfxstream_host_gl_host_common",
109        "libgfxstream_host_gles2_dec",
110        "libgfxstream_host_glsnapshot",
111        "libgfxstream_host_vulkan_cereal",
112    ],
113    shared_libs: [
114        "liblog", // gfxstream_base uses this via perfetto-libperfettobase
115    ],
116    export_include_dirs: [
117        "include",
118    ],
119    srcs: [
120        "Buffer.cpp",
121        "ExternalObjectManager.cpp",
122        "ChannelStream.cpp",
123        "ColorBuffer.cpp",
124        "DisplaySurface.cpp",
125        "DisplaySurfaceUser.cpp",
126        "Hwc2.cpp",
127        "PostWorker.cpp",
128        "PostWorkerGl.cpp",
129        "ReadBuffer.cpp",
130        "render_api.cpp",
131        "RenderChannelImpl.cpp",
132        "RenderThread.cpp",
133        "RenderThreadInfo.cpp",
134        "RenderThreadInfoGl.cpp",
135        "RingStream.cpp",
136        "SyncThread.cpp",
137        "RenderControl.cpp",
138        "RenderWindow.cpp",
139        "RenderLibImpl.cpp",
140        "RendererImpl.cpp",
141        "FrameBuffer.cpp",
142        "GfxStreamAgents.cpp",
143        "virtio-gpu-gfxstream-renderer.cpp",
144        "virtio-gpu-gfxstream-renderer-goldfish.cpp",
145        "VirtioGpuContext.cpp",
146        "VirtioGpuFrontend.cpp",
147        "VirtioGpuResource.cpp",
148        "VirtioGpuRingBlob.cpp",
149        "VirtioGpuTimelines.cpp",
150        "VsyncThread.cpp",
151    ],
152    host_ldlibs: [
153        "-lpthread",
154    ],
155    target: {
156        host: {
157            srcs: ["NativeSubWindow_x11.cpp"],
158            static_libs: gfxstream_backend_snapshot_static_deps,
159            whole_static_libs: gfxstream_backend_snapshot_static_deps,
160        },
161        android: {
162            srcs: ["NativeSubWindow_android.cpp"],
163        },
164    },
165}
166
167cc_library {
168    name: "libgfxstream_backend",
169    defaults: ["libgfxstream_backend_defaults"],
170}
171
172cc_library {
173    name: "libgfxstream_backend_magma",
174    defaults: ["libgfxstream_backend_defaults"],
175    static: {
176        whole_static_libs: gfxstream_backend_magma_static_deps,
177    },
178    shared: {
179        static_libs: gfxstream_backend_magma_static_deps,
180    },
181    export_static_lib_headers: gfxstream_backend_magma_static_deps,
182}
183
184cc_test_library {
185    name: "gfxstream_backend_test_support",
186    defaults: ["gfxstream_defaults"],
187    srcs: [
188        "tests/GLSnapshotTesting.cpp",
189        "tests/GLTestUtils.cpp",
190        "tests/GLSnapshotTestDispatch.cpp",
191        "tests/GLSnapshotTestStateUtils.cpp",
192        "tests/OpenGLTestContext.cpp",
193        "tests/SampleApplication.cpp",
194        "tests/ShaderUtils.cpp",
195    ],
196    header_libs: [
197        "gfxstream_opengl_headers",
198        "libgfxstream_host_vulkan_cereal_common",
199    ],
200    shared_libs: [
201        "libbase",
202        "libgfxstream_backend",
203    ],
204    export_static_lib_headers: [
205        "libgfxstream_oswindow_test_support",
206    ],
207    static_libs: [
208        "libgfxstream_host_apigen_codec_common",
209        "gfxstream_base",
210        "gfxstream_base_test_support",
211        "gfxstream_host_common_test_support",
212        "gfxstream_snapshot",
213        "libgfxstream_oswindow_test_support",
214        "libgmock",
215        "liblz4",
216    ],
217    export_include_dirs: ["tests"],
218}
219
220// Run with `atest --host gfxstream_compositorvk_test`
221cc_test_host {
222    name: "gfxstream_compositorvk_test",
223    defaults: ["gfxstream_defaults"],
224    header_libs: [
225        "libgfxstream_host_vulkan_cereal_common",
226    ],
227    srcs: [
228        "tests/CompositorVk_unittest.cpp",
229    ],
230    data: [
231        "tests/testdata/256x256_android.png",
232        "tests/testdata/256x256_android_with_transparency.png",
233        "tests/testdata/256x256_golden_blend_premultiplied.png",
234        "tests/testdata/256x256_golden_crop.png",
235        "tests/testdata/256x256_golden_simple_composition.png",
236        "tests/testdata/256x256_golden_multiple_layers.png",
237        "tests/testdata/256x256_golden_multiple_targets_0.png",
238        "tests/testdata/256x256_golden_multiple_targets_1.png",
239        "tests/testdata/256x256_golden_multiple_targets_2.png",
240        "tests/testdata/256x256_golden_multiple_targets_3.png",
241        "tests/testdata/256x256_golden_multiple_targets_4.png",
242        "tests/testdata/256x256_golden_multiple_targets_5.png",
243        "tests/testdata/256x256_golden_multiple_targets_6.png",
244        "tests/testdata/256x256_golden_multiple_targets_7.png",
245        "tests/testdata/256x256_golden_multiple_targets_8.png",
246        "tests/testdata/256x256_golden_multiple_targets_9.png",
247        "tests/testdata/256x256_golden_solid_color.png",
248        "tests/testdata/256x256_golden_solid_color_above.png",
249        "tests/testdata/256x256_golden_solid_color_below.png",
250        "tests/testdata/256x256_golden_transform_none.png",
251        "tests/testdata/256x256_golden_transform_fliph.png",
252        "tests/testdata/256x256_golden_transform_flipv.png",
253        "tests/testdata/256x256_golden_transform_rot90.png",
254        "tests/testdata/256x256_golden_transform_rot180.png",
255        "tests/testdata/256x256_golden_transform_rot270.png",
256        "tests/testdata/256x256_golden_transform_fliphrot90.png",
257        "tests/testdata/256x256_golden_transform_flipvrot90.png",
258    ],
259    shared_libs: [
260        "libbase",
261        "libgfxstream_backend",
262        "libgfxstream_common_image",
263    ],
264    static_libs: [
265        "libgfxstream_host_vulkan_server",
266        "libgfxstream_thirdparty_glm",
267    ],
268    test_options: {
269        // Disabled by default as requires Vulkan.
270        unit_test: false,
271    },
272    test_suites: [
273        "general-tests",
274    ],
275}
276
277// Run with `atest --host gfxstream_framebuffer_tests`
278cc_test_host {
279    name: "gfxstream_framebuffer_tests",
280    defaults: ["gfxstream_defaults"],
281    header_libs: [
282        "libgfxstream_host_vulkan_cereal_common",
283    ],
284    srcs: [
285        "tests/FrameBuffer_unittest.cpp",
286    ],
287    shared_libs: [
288        "libbase",
289        "libgfxstream_backend",
290    ],
291    static_libs: [
292        "gfxstream_backend_test_support",
293        "gfxstream_base_test_support",
294        "gfxstream_base",
295        "gfxstream_host_common_test_support",
296        "gfxstream_snapshot",
297        "libgfxstream_common_image",
298        "libgfxstream_host_vulkan_server",
299        "libgfxstream_oswindow_test_support",
300        "libgfxstream_thirdparty_glm",
301        "libgmock",
302        "liblz4",
303    ],
304    test_options: {
305        // Disabled by default as requires Vulkan.
306        unit_test: false,
307    },
308    test_suites: [
309        "general-tests",
310    ],
311}
312
313cc_test_host {
314    name: "gfxstream_magma_tests",
315    defaults: ["gfxstream_defaults"],
316    srcs: [
317        "tests/Magma_unittest.cpp",
318    ],
319    shared_libs: [
320        "libbase",
321        "libgfxstream_backend_magma",
322    ],
323    test_suites: [
324        "general-tests",
325    ],
326}
327