# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//build/config/ui.gni") import("//components/viz/viz.gni") import("//gpu/vulkan/features.gni") import("//media/gpu/args.gni") import("//skia/features.gni") import("//testing/libfuzzer/fuzzer_test.gni") config("viz_service_implementation") { } viz_component("service") { sources = [ "display/aggregated_frame.cc", "display/aggregated_frame.h", "display/bsp_tree.cc", "display/bsp_tree.h", "display/bsp_walk_action.cc", "display/bsp_walk_action.h", "display/damage_frame_annotator.cc", "display/damage_frame_annotator.h", "display/delegated_ink_point_renderer_base.cc", "display/delegated_ink_point_renderer_base.h", "display/delegated_ink_point_renderer_skia.cc", "display/delegated_ink_point_renderer_skia.h", "display/direct_renderer.cc", "display/direct_renderer.h", "display/display.cc", "display/display.h", "display/display_client.h", "display/display_damage_tracker.cc", "display/display_damage_tracker.h", "display/display_resource_provider.cc", "display/display_resource_provider.h", "display/display_scheduler.cc", "display/display_scheduler.h", "display/display_scheduler_base.cc", "display/display_scheduler_base.h", "display/draw_polygon.cc", "display/draw_polygon.h", "display/dynamic_geometry_binding.cc", "display/dynamic_geometry_binding.h", "display/external_use_client.cc", "display/external_use_client.h", "display/frame_rate_decider.cc", "display/frame_rate_decider.h", "display/geometry_binding.cc", "display/geometry_binding.h", "display/gl_renderer.cc", "display/gl_renderer.h", "display/gl_renderer_copier.cc", "display/gl_renderer_copier.h", "display/gl_renderer_draw_cache.cc", "display/gl_renderer_draw_cache.h", "display/layer_quad.cc", "display/layer_quad.h", "display/output_surface.cc", "display/output_surface.h", "display/output_surface_client.h", "display/output_surface_frame.cc", "display/output_surface_frame.h", "display/overlay_candidate.cc", "display/overlay_candidate.h", "display/overlay_candidate_temporal_tracker.cc", "display/overlay_candidate_temporal_tracker.h", "display/overlay_processor_interface.cc", "display/overlay_processor_interface.h", "display/overlay_processor_on_gpu.cc", "display/overlay_processor_on_gpu.h", "display/overlay_processor_stub.cc", "display/overlay_processor_stub.h", "display/program_binding.cc", "display/program_binding.h", "display/render_pass_id_remapper.cc", "display/render_pass_id_remapper.h", "display/renderer_utils.cc", "display/renderer_utils.h", "display/resource_fence.h", "display/scoped_gpu_memory_buffer_texture.cc", "display/scoped_gpu_memory_buffer_texture.h", "display/scoped_render_pass_texture.cc", "display/scoped_render_pass_texture.h", "display/shader.cc", "display/shader.h", "display/shared_bitmap_manager.h", "display/skia_output_surface.cc", "display/skia_output_surface.h", "display/skia_renderer.cc", "display/skia_renderer.h", "display/software_output_device.cc", "display/software_output_device.h", "display/software_renderer.cc", "display/software_renderer.h", "display/static_geometry_binding.cc", "display/static_geometry_binding.h", "display/surface_aggregator.cc", "display/surface_aggregator.h", "display/sync_query_collection.cc", "display/sync_query_collection.h", "display/texture_deleter.cc", "display/texture_deleter.h", "display_embedder/buffer_queue.cc", "display_embedder/buffer_queue.h", "display_embedder/gl_output_surface.cc", "display_embedder/gl_output_surface.h", "display_embedder/gl_output_surface_buffer_queue.cc", "display_embedder/gl_output_surface_buffer_queue.h", "display_embedder/gl_output_surface_offscreen.cc", "display_embedder/gl_output_surface_offscreen.h", "display_embedder/in_process_gpu_memory_buffer_manager.cc", "display_embedder/in_process_gpu_memory_buffer_manager.h", "display_embedder/output_surface_provider.h", "display_embedder/output_surface_provider_impl.cc", "display_embedder/output_surface_provider_impl.h", "display_embedder/server_shared_bitmap_manager.cc", "display_embedder/server_shared_bitmap_manager.h", "display_embedder/software_output_surface.cc", "display_embedder/software_output_surface.h", "display_embedder/viz_process_context_provider.cc", "display_embedder/viz_process_context_provider.h", "display_embedder/vsync_parameter_listener.cc", "display_embedder/vsync_parameter_listener.h", "frame_sinks/begin_frame_tracker.cc", "frame_sinks/begin_frame_tracker.h", "frame_sinks/compositor_frame_sink_impl.cc", "frame_sinks/compositor_frame_sink_impl.h", "frame_sinks/compositor_frame_sink_support.cc", "frame_sinks/compositor_frame_sink_support.h", "frame_sinks/external_begin_frame_source_mojo.cc", "frame_sinks/external_begin_frame_source_mojo.h", "frame_sinks/frame_sink_manager_impl.cc", "frame_sinks/frame_sink_manager_impl.h", "frame_sinks/frame_sink_observer.h", "frame_sinks/gpu_vsync_begin_frame_source.cc", "frame_sinks/gpu_vsync_begin_frame_source.h", "frame_sinks/root_compositor_frame_sink_impl.cc", "frame_sinks/root_compositor_frame_sink_impl.h", "frame_sinks/surface_resource_holder.cc", "frame_sinks/surface_resource_holder.h", "frame_sinks/surface_resource_holder_client.h", "frame_sinks/video_capture/capturable_frame_sink.h", "frame_sinks/video_capture/frame_sink_video_capturer_impl.cc", "frame_sinks/video_capture/frame_sink_video_capturer_impl.h", "frame_sinks/video_capture/frame_sink_video_capturer_manager.h", "frame_sinks/video_capture/in_flight_frame_delivery.cc", "frame_sinks/video_capture/in_flight_frame_delivery.h", "frame_sinks/video_capture/interprocess_frame_pool.cc", "frame_sinks/video_capture/interprocess_frame_pool.h", "frame_sinks/video_capture/video_capture_overlay.cc", "frame_sinks/video_capture/video_capture_overlay.h", "frame_sinks/video_detector.cc", "frame_sinks/video_detector.h", "hit_test/hit_test_aggregator.cc", "hit_test/hit_test_aggregator.h", "hit_test/hit_test_aggregator_delegate.h", "hit_test/hit_test_manager.cc", "hit_test/hit_test_manager.h", "surfaces/latest_local_surface_id_lookup_delegate.h", "surfaces/referenced_surface_tracker.cc", "surfaces/referenced_surface_tracker.h", "surfaces/surface.cc", "surfaces/surface.h", "surfaces/surface_allocation_group.cc", "surfaces/surface_allocation_group.h", "surfaces/surface_client.h", "surfaces/surface_dependency_deadline.cc", "surfaces/surface_dependency_deadline.h", "surfaces/surface_manager.cc", "surfaces/surface_manager.h", "surfaces/surface_manager_delegate.h", "surfaces/surface_observer.cc", "surfaces/surface_observer.h", "surfaces/surface_reference.cc", "surfaces/surface_reference.h", "viz_service_export.h", ] jumbo_excluded_sources = [ "display/display.cc", "display/overlay_processor_on_gpu.cc", ] defines = [ "VIZ_SERVICE_IMPLEMENTATION" ] allow_circular_includes_from = [ ":gpu_service_dependencies" ] deps = [ "//build:chromecast_buildflags", "//cc/base", "//cc/paint", "//components/crash/core/common:crash_key", "//gpu/command_buffer/client:gles2_cmd_helper", "//gpu/command_buffer/client:gles2_implementation", "//gpu/command_buffer/client:raster", # Note that dependency on //gpu/ipc/client is for GpuMemoryBufferImpl. This # dependency should not be in public_deps. "//gpu/ipc/client", "//gpu/ipc/common:common", "//gpu/ipc/common:surface_handle_type", "//gpu/ipc/service", "//gpu/skia_bindings:skia_bindings", "//gpu/vulkan:buildflags", "//media", "//media/capture:capture_lib", "//media/mojo/services", "//services/tracing/public/cpp:cpp", "//services/viz/privileged/mojom", "//skia", "//skia:skcms", "//third_party/libyuv", "//ui/display/types", ] public_deps = [ ":gpu_service_dependencies", "//base", "//cc", "//cc/debug", "//components/viz/common", "//gpu/command_buffer/client:gles2_interface", "//services/viz/privileged/mojom/compositing", "//services/viz/public/mojom", "//ui/base/prediction", "//ui/gfx", "//ui/gfx/geometry", "//ui/latency", ] if (use_x11) { sources += [ "display_embedder/software_output_device_x11.cc", "display_embedder/software_output_device_x11.h", ] deps += [ "//ui/gfx/x" ] } if (is_chromeos) { sources += [ "display_embedder/gl_output_surface_chromeos.cc", "display_embedder/gl_output_surface_chromeos.h", ] deps += [ "//components/arc/video_accelerator" ] } if (is_chromecast) { deps += [ "//chromecast/media/service/mojom" ] } if (is_mac) { sources += [ "display/ca_layer_overlay.cc", "display/ca_layer_overlay.h", "display/overlay_processor_mac.cc", "display/overlay_processor_mac.h", "display_embedder/software_output_device_mac.cc", "display_embedder/software_output_device_mac.h", ] deps += [ "//ui/accelerated_widget_mac" ] frameworks = [ "IOSurface.framework" ] } if (is_android || use_ozone) { sources += [ "display/overlay_processor_using_strategy.cc", "display/overlay_processor_using_strategy.h", "display/overlay_strategy_fullscreen.cc", "display/overlay_strategy_fullscreen.h", "display/overlay_strategy_single_on_top.cc", "display/overlay_strategy_single_on_top.h", "display/overlay_strategy_underlay.cc", "display/overlay_strategy_underlay.h", "display/overlay_strategy_underlay_cast.cc", "display/overlay_strategy_underlay_cast.h", ] } if (is_android) { sources += [ "display/overlay_processor_android.cc", "display/overlay_processor_android.h", "display/overlay_processor_surface_control.cc", "display/overlay_processor_surface_control.h", "display_embedder/gl_output_surface_android.cc", "display_embedder/gl_output_surface_android.h", "frame_sinks/external_begin_frame_source_android.cc", "frame_sinks/external_begin_frame_source_android.h", "gl/throw_uncaught_exception.cc", "gl/throw_uncaught_exception.h", ] deps += [ ":service_jni_headers" ] } if (use_ozone) { sources += [ "display/overlay_processor_ozone.cc", "display/overlay_processor_ozone.h", "display_embedder/software_output_device_ozone.cc", "display_embedder/software_output_device_ozone.h", ] public_deps += [ "//ui/ozone" ] } if (is_chromecast) { defines += [ "ALWAYS_ENABLE_BLENDING_FOR_PRIMARY" ] } if (is_win) { sources += [ "display/dc_layer_overlay.cc", "display/dc_layer_overlay.h", "display/overlay_processor_win.cc", "display/overlay_processor_win.h", "display_embedder/output_device_backing.cc", "display_embedder/output_device_backing.h", "display_embedder/software_output_device_win.cc", "display_embedder/software_output_device_win.h", ] } if (is_chromeos) { sources += [ "display_embedder/output_surface_unified.cc", "display_embedder/output_surface_unified.h", ] } if (enable_vulkan) { deps += [ "//gpu/vulkan" ] } } # The gpu_service_dependencies source set contains source files that # use the service side GL library (ui/gl), while the rest of # viz/service use the client side GL library. This split is needed # because the two GL libraries are incompatible and can't compile # together in jumbo builds. # # Long term all service code is moving to be in the gpu process and # then this build target will no longer be needed. viz_source_set("gpu_service_dependencies") { sources = [ "display/display_compositor_memory_and_task_controller.cc", "display/display_compositor_memory_and_task_controller.h", "display_embedder/image_context_impl.cc", "display_embedder/image_context_impl.h", "display_embedder/output_presenter.cc", "display_embedder/output_presenter.h", "display_embedder/output_presenter_gl.cc", "display_embedder/output_presenter_gl.h", "display_embedder/skia_output_device.cc", "display_embedder/skia_output_device.h", "display_embedder/skia_output_device_buffer_queue.cc", "display_embedder/skia_output_device_buffer_queue.h", "display_embedder/skia_output_device_gl.cc", "display_embedder/skia_output_device_gl.h", "display_embedder/skia_output_device_offscreen.cc", "display_embedder/skia_output_device_offscreen.h", "display_embedder/skia_output_device_webview.cc", "display_embedder/skia_output_device_webview.h", "display_embedder/skia_output_surface_dependency.h", "display_embedder/skia_output_surface_dependency_impl.cc", "display_embedder/skia_output_surface_dependency_impl.h", "display_embedder/skia_output_surface_impl.cc", "display_embedder/skia_output_surface_impl.h", "display_embedder/skia_output_surface_impl_on_gpu.cc", "display_embedder/skia_output_surface_impl_on_gpu.h", "gl/gpu_service_impl.cc", "gl/gpu_service_impl.h", ] public_deps = [ "//gpu/command_buffer/service:gles2", "//gpu/ipc:gl_in_process_context", "//gpu/ipc/service", "//gpu/vulkan:buildflags", "//media/gpu/ipc/service", "//media/mojo/services", "//services/viz/privileged/mojom/gl", "//skia", "//ui/latency:latency", ] defines = [ "VIZ_SERVICE_IMPLEMENTATION" ] deps = [ "//base", "//gpu/config", "//third_party/libyuv", ] if (is_win) { sources += [ "gl/info_collection_gpu_service_impl.cc", "gl/info_collection_gpu_service_impl.h", ] # SkiaOutputDeviceBufferQueue doesn't support Windows. sources -= [ "display_embedder/output_presenter.cc", "display_embedder/output_presenter.h", "display_embedder/output_presenter_gl.cc", "display_embedder/output_presenter_gl.h", "display_embedder/skia_output_device_buffer_queue.cc", "display_embedder/skia_output_device_buffer_queue.h", ] } if (is_chromeos) { deps += [ "//components/arc/video_accelerator", "//components/chromeos_camera:jpeg_encode_accelerator_service", "//components/chromeos_camera:mjpeg_decode_accelerator_service", "//gpu/command_buffer/service:gles2", "//media/mojo/services", ] } if (use_vaapi) { deps += [ "//media/gpu/vaapi" ] } if (use_ozone) { deps += [ "//ui/ozone" ] } if (enable_vulkan) { sources += [ "display_embedder/skia_output_device_vulkan.cc", "display_embedder/skia_output_device_vulkan.h", "display_embedder/skia_output_device_vulkan_secondary_cb.cc", "display_embedder/skia_output_device_vulkan_secondary_cb.h", ] public_deps += [ "//gpu/vulkan" ] } if (use_x11 && enable_vulkan) { sources += [ "display_embedder/skia_output_device_x11.cc", "display_embedder/skia_output_device_x11.h", ] deps += [ "//ui/gfx/x" ] } if (skia_use_dawn && is_win) { sources += [ "display_embedder/skia_output_device_dawn.cc", "display_embedder/skia_output_device_dawn.h", ] public_deps += [ "//third_party/dawn/src/dawn:dawn_headers" ] deps += [ "//third_party/dawn/src/dawn:dawn_proc", "//third_party/dawn/src/dawn:dawncpp", "//third_party/dawn/src/dawn_native", ] } if (is_fuchsia) { sources += [ "display_embedder/output_presenter_fuchsia.cc", "display_embedder/output_presenter_fuchsia.h", ] deps += [ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.images", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.sysmem", "//third_party/fuchsia-sdk/sdk/pkg/sys_inspect_cpp", ] } } viz_source_set("unit_tests") { # Not ready for jumbo compilation. Too much repeated test code. never_build_jumbo = true testonly = true sources = [ "display/bsp_tree_unittest.cc", "display/copy_output_scaling_pixeltest.cc", "display/delegated_ink_point_pixel_test_helper.cc", "display/delegated_ink_point_pixel_test_helper.h", "display/display_damage_tracker_unittest.cc", "display/display_resource_provider_unittest.cc", "display/display_scheduler_unittest.cc", "display/display_unittest.cc", "display/draw_polygon_unittest.cc", "display/frame_rate_decider_unittest.cc", "display/layer_quad_unittest.cc", "display/renderer_pixeltest.cc", "display/shader_unittest.cc", "display/skia_readback_pixeltest.cc", "display/software_renderer_unittest.cc", "display/surface_aggregator_pixeltest.cc", "display/surface_aggregator_unittest.cc", "display/texture_deleter_unittest.cc", "display/viz_pixel_test.cc", "display/viz_pixel_test.h", "display_embedder/buffer_queue_unittest.cc", "display_embedder/gl_output_surface_buffer_queue_unittest.cc", "display_embedder/server_shared_bitmap_manager_unittest.cc", "display_embedder/skia_output_device_buffer_queue_unittest.cc", "display_embedder/skia_output_surface_impl_unittest.cc", "display_embedder/software_output_surface_unittest.cc", "display_embedder/vsync_parameter_listener_unittest.cc", "frame_sinks/begin_frame_tracker_unittest.cc", "frame_sinks/compositor_frame_sink_support_unittest.cc", "frame_sinks/frame_sink_manager_unittest.cc", "frame_sinks/surface_references_unittest.cc", "frame_sinks/surface_synchronization_unittest.cc", "frame_sinks/video_capture/frame_sink_video_capturer_impl_unittest.cc", "frame_sinks/video_capture/interprocess_frame_pool_unittest.cc", "frame_sinks/video_capture/video_capture_overlay_unittest.cc", "frame_sinks/video_detector_unittest.cc", "gl/gpu_service_impl_unittest.cc", "hit_test/hit_test_aggregator_unittest.cc", "main/viz_main_impl_unittest.cc", "surfaces/referenced_surface_tracker_unittest.cc", "surfaces/surface_unittest.cc", ] if (enable_gl_backend_tests) { sources += [ "display/gl_renderer_copier_pixeltest.cc", "display/gl_renderer_copier_unittest.cc", "display/gl_renderer_unittest.cc", ] } if (!use_aura && !is_mac) { sources -= [ "display_embedder/buffer_queue_unittest.cc" ] } configs = [ "//build/config/compiler:no_size_t_to_int_warning", "//third_party/khronos:khronos_headers", ] deps = [ ":service", "//base", "//base/test:test_support", "//cc:test_support", "//cc/paint", "//components/viz/client", "//components/viz/common", "//components/viz/host", "//components/viz/service/main:main", "//components/viz/test:test_suite", "//components/viz/test:test_support", "//gpu/command_buffer/client", "//gpu/command_buffer/client:gles2_implementation", "//gpu/ipc:gl_in_process_context", "//gpu/ipc/service", "//media", "//media/capture:capture_lib", "//services/viz/public/mojom", "//skia", "//testing/gmock", "//testing/gtest", "//third_party/libyuv", "//ui/display/types", "//ui/gfx:test_support", "//ui/gl", ] if (use_ozone) { sources += [ "display/overlay_unittest.cc", "display_embedder/software_output_device_ozone_unittest.cc", ] deps += [ "//ui/base:features", "//ui/compositor:test_support", "//ui/ozone", ] } if (is_mac) { sources += [ "display/overlay_ca_unittest.cc", "display_embedder/software_output_device_mac_unittest.mm", ] frameworks = [ "IOSurface.framework" ] } if (is_win) { sources += [ "display/overlay_dc_unittest.cc", "display_embedder/output_device_backing_unittest.cc", "display_embedder/software_output_device_win_unittest.cc", ] # SkiaOutputDeviceBufferQueue doesn't support Windows. sources -= [ "display_embedder/skia_output_device_buffer_queue_unittest.cc" ] } if (is_android) { sources += [ "display/overlay_processor_surface_control_unittest.cc", "display/overlay_unittest.cc", "frame_sinks/external_begin_frame_source_android_unittest.cc", ] } if (enable_vulkan) { deps += [ "//gpu/vulkan:test_support", "//gpu/vulkan/init", ] } } viz_source_set("perf_tests") { # Not ready for jumbo compilation. Too much repeated test code. never_build_jumbo = true testonly = true sources = [ "display/bsp_tree_perftest.cc", "display/display_perftest.cc", "display/gl_renderer_copier_perftest.cc", "display/renderer_perftest.cc", "display/surface_aggregator_perftest.cc", ] deps = [ ":service", "//base", "//base/test:test_support", "//cc", "//cc:test_support", "//cc/base", "//components/viz/client:client", "//components/viz/test:test_support", "//testing/gtest", "//testing/perf", ] } fuzzer_test("hit_test_manager_fuzzer") { sources = [ "hit_test/hit_test_manager_fuzzer.cc" ] libfuzzer_options = [ "max_len=81920" ] deps = [ ":service", "//base/test:test_support", "//components/viz/test:test_support", ] } if (is_android) { android_library("service_java") { deps = [ "//base:base_java", "//base:jni_java", "//ui/android:ui_no_recycler_view_java", ] annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] sources = [ "java/src/org/chromium/components/viz/service/frame_sinks/ExternalBeginFrameSourceAndroid.java", "java/src/org/chromium/components/viz/service/gl/ThrowUncaughtException.java", ] } generate_jni("service_jni_headers") { sources = [ "java/src/org/chromium/components/viz/service/frame_sinks/ExternalBeginFrameSourceAndroid.java", "java/src/org/chromium/components/viz/service/gl/ThrowUncaughtException.java", ] } } group("viz_service_fuzzers") { testonly = true deps = [ ":hit_test_manager_fuzzer", "compositor_frame_fuzzer:compositor_frame_fuzzer", ] }