load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library") load("//:build_variables.bzl", "GFXSTREAM_HOST_COPTS", "GFXSTREAM_HOST_DEFINES") package( default_applicable_licenses = ["//:gfxstream_license"], default_visibility = ["//:gfxstream"], ) cc_library( name = "gfxstream_backend_headers", hdrs = [ "include/gfxstream/virtio-gpu-gfxstream-renderer.h", "include/gfxstream/virtio-gpu-gfxstream-renderer-unstable.h", "include/render-utils/MediaNative.h", "include/render-utils/RenderChannel.h", "include/render-utils/RenderLib.h", "include/render-utils/Renderer.h", "include/render-utils/address_space_graphics_types.h", "include/render-utils/address_space_operations.h", "include/render-utils/display_operations.h", "include/render-utils/dma_device.h", "include/render-utils/gralloc_enums.h", "include/render-utils/logging_operations.h", "include/render-utils/render_api.h", "include/render-utils/render_api_functions.h", "include/render-utils/render_api_platform_types.h", "include/render-utils/renderer_enums.h", "include/render-utils/small_vector.h", "include/render-utils/snapshot_operations.h", "include/render-utils/stream.h", "include/render-utils/sync_device.h", "include/render-utils/virtio_gpu_ops.h", "include/render-utils/vm_operations.h", "include/render-utils/window_operations.h", ], copts = GFXSTREAM_HOST_COPTS, defines = GFXSTREAM_HOST_DEFINES, includes = ["include"], visibility = ["//visibility:public"], deps = [ "//host/features:gfxstream_host_features", ], ) cc_library( name = "gfxstream_host_headers", hdrs = [ "Buffer.h", "ColorBuffer.h", "Compositor.h", "FrameBuffer.h", "FrameworkFormats.h", "GlesCompat.h", "Handle.h", "Hwc2.h", "PostCommands.h", "PostWorker.h", "ReadbackWorker.h", "StalePtrRegistry.h", "VsyncThread.h", ], copts = GFXSTREAM_HOST_COPTS, defines = GFXSTREAM_HOST_DEFINES, includes = ["."], deps = [ ":gfxstream_backend_headers", "//common/base:gfxstream_common_base", "//common/logging:gfxstream_common_logging", "//host/backend:gfxstream_host_backend", "//host/features:gfxstream_host_features", "//host/health:gfxstream_host_health", "//host/metrics:gfxstream_host_metrics", "//host/snapshot:gfxstream_host_snapshot", "//third_party/opengl:gfxstream_egl_headers", "//third_party/opengl:gfxstream_gles2_headers", "//third_party/opengl:gfxstream_gles3_headers", "//third_party/vulkan:gfxstream_vulkan_headers", ], ) objc_library( name = "gfxstream_backend_static-darwin", srcs = [ "GlesCompat.h", "NativeSubWindow.h", "NativeSubWindow_cocoa.mm", ], copts = GFXSTREAM_HOST_COPTS + [ "-Wno-deprecated-declarations", ], defines = GFXSTREAM_HOST_DEFINES, sdk_frameworks = [ "AppKit", "QuartzCore", "IOSurface", ], target_compatible_with = [ "@platforms//os:macos", ], deps = [ ":gfxstream_backend_headers", "//third_party/opengl:gfxstream_egl_headers", ], ) cc_library( name = "gfxstream_backend_static", srcs = [ "Buffer.cpp", "ChannelStream.cpp", "ColorBuffer.cpp", "FrameBuffer.cpp", "Hwc2.cpp", "PostWorker.cpp", "PostWorkerGl.cpp", "ReadBuffer.cpp", "RenderChannelImpl.cpp", "RenderControl.cpp", "RenderLibImpl.cpp", "RenderThread.cpp", "RenderThreadInfo.cpp", "RenderWindow.cpp", "RendererImpl.cpp", "RingStream.cpp", "SyncThread.cpp", "VirtioGpuContext.cpp", "VirtioGpuFrontend.cpp", "VirtioGpuPipe.cpp", "VirtioGpuResource.cpp", "VirtioGpuRingBlob.cpp", "VirtioGpuTimelines.cpp", "VsyncThread.cpp", ] + select({ "@platforms//os:macos": [], "@platforms//os:windows": [ "NativeSubWindow_win32.cpp", ], "@platforms//os:linux": [ "NativeSubWindow_x11.cpp", ], "//conditions:default": [], }), hdrs = [ "Buffer.h", "ChannelStream.h", "ColorBuffer.h", "Compositor.h", "FrameBuffer.h", "FrameworkFormats.h", "GlesCompat.h", "Handle.h", "Hwc2.h", "NativeSubWindow.h", "PostCommands.h", "PostWorker.h", "PostWorkerGl.h", "ReadBuffer.h", "ReadbackWorker.h", "RenderChannelImpl.h", "RenderControl.h", "RenderLibImpl.h", "RenderThread.h", "RenderThreadInfo.h", "RenderWindow.h", "RendererImpl.h", "RingStream.h", "StalePtrRegistry.h", "SyncThread.h", "VirtioGpu.h", "VirtioGpuContext.h", "VirtioGpuFormatUtils.h", "VirtioGpuFrontend.h", "VirtioGpuPipe.h", "VirtioGpuResource.h", "VirtioGpuRingBlob.h", "VirtioGpuTimelines.h", "VsyncThread.h", "virtgpu_gfxstream_protocol.h", ], copts = GFXSTREAM_HOST_COPTS + [ "-Wno-extern-c-compat", "-Wno-return-type-c-linkage", "-Wno-unused-private-field", ], defines = GFXSTREAM_HOST_DEFINES + ["QEMU_NEXT"], includes = [ ".", "gl", ], linkstatic = True, visibility = ["//visibility:public"], deps = [ ":gfxstream_backend_headers", "//common/base:gfxstream_common_base", "//common/logging:gfxstream_common_logging", "//host/address_space:gfxstream_host_address_space", "//host/backend:gfxstream_host_backend", "//host/compressed_textures:gfxstream_host_compressed_textures", "//host/decoder_common:gfxstream_host_decoder_common", "//host/features:gfxstream_host_features", "//host/gl:EGL_translator_static", "//host/gl:gfxstream_opengl_server", "//host/gl:gl_common_headers", "//host/gl:gles1_dec", "//host/gl:gles2_dec", "//host/gl/OpenGLESDispatch:gfxstream_host_openglesdispatch", "//host/gl/OpenGLESDispatch:gfxstream_host_openglesdispatch_headers", "//host/gl/glestranslator/GLES_CM:GLES_CM_translator_static", "//host/health:gfxstream_host_health", "//host/iostream:gfxstream_host_iostream", "//host/library:gfxstream_host_library", "//host/metrics:gfxstream_host_metrics", "//host/renderControl_dec", "//host/renderdoc:gfxstream_host_renderdoc", "//host/snapshot:gfxstream_host_snapshot", "//host/tracing:gfxstream_host_tracing", "//host/vulkan:gfxstream_vulkan_server", "//third_party/drm:gfxstream_drm_headers", "//third_party/opengl:gfxstream_egl_headers", "//third_party/opengl:gfxstream_gles2_headers", "//third_party/opengl:gfxstream_gles3_headers", "//third_party/vulkan:gfxstream_vulkan_headers", ] + select({ "@platforms//os:macos": [ ":gfxstream_backend_static-darwin", ], "//conditions:default": [], }), ) cc_library( name = "gfxstream_backend_shared", srcs = [ "render_api.cpp", "virtio-gpu-gfxstream-renderer.cpp", ], copts = GFXSTREAM_HOST_COPTS + [ "-Wno-extern-c-compat", "-Wno-return-type-c-linkage", ], defines = GFXSTREAM_HOST_DEFINES, linkstatic = True, visibility = ["//visibility:public"], deps = [ ":gfxstream_backend_headers", ":gfxstream_backend_static", ":gfxstream_host_headers", "//common/base:gfxstream_common_base", "//common/logging:gfxstream_common_logging", "//common/utils:gfxstream_common_utils", "//host/address_space:gfxstream_host_address_space", "//host/features:gfxstream_host_features", "//host/metrics:gfxstream_host_metrics", "//host/tracing:gfxstream_host_tracing", "//host/vulkan:gfxstream_vulkan_server", ], ) cc_binary( name = "gfxstream_backend", srcs = [ "render_api.cpp", "virtio-gpu-gfxstream-renderer.cpp", ], copts = GFXSTREAM_HOST_COPTS, defines = GFXSTREAM_HOST_DEFINES, linkshared = True, visibility = ["//visibility:public"], deps = [ ":gfxstream_backend_headers", ":gfxstream_backend_static", ":gfxstream_host_headers", "//common/base:gfxstream_common_base", "//common/logging:gfxstream_common_logging", "//common/utils:gfxstream_common_utils", "//host/address_space:gfxstream_host_address_space", "//host/features:gfxstream_host_features", "//host/metrics:gfxstream_host_metrics", "//host/tracing:gfxstream_host_tracing", "//host/vulkan:gfxstream_vulkan_server", ], ) cc_test( name = "gfxstream_framebuffer_tests", srcs = [ "FrameBuffer_unittest.cpp", ], copts = GFXSTREAM_HOST_COPTS, deps = [ ":gfxstream_backend_static", "//common/base:gfxstream_common_base", "//host/backend:gfxstream_host_backend", "//host/features:gfxstream_host_features", "//host/testlibs/oswindow:gfxstream_oswindow_test_support", "//host/testlibs/support:gfxstream_host_testing_support", "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", ], ) cc_test( name = "gfxstream_vsyncthread_tests", srcs = [ "VsyncThread_unittest.cpp", ], copts = GFXSTREAM_HOST_COPTS, deps = [ ":gfxstream_backend_static", "//host/testlibs/support:gfxstream_host_testing_support", "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", ], )