# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/buildflag_header.gni")
import("//components/viz/common/debugger/viz_debugger.gni")
import("//components/viz/viz.gni")
import("//gpu/vulkan/features.gni")
import("//skia/features.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
import("//third_party/inspector_protocol/inspector_protocol.gni")
viz_component("shared_image_format") {
output_name = "viz_shared_image_format"
defines = [ "IS_VIZ_SHARED_IMAGE_FORMAT_IMPL" ]
sources = [
"resources/resource_sizes.h",
"resources/shared_image_format.cc",
"resources/shared_image_format.h",
"resources/shared_image_format_utils.cc",
"resources/shared_image_format_utils.h",
]
public_deps = [
"//base",
"//mojo/public/cpp/bindings",
"//services/viz/public/mojom:singleplanar_format",
]
deps = [
"//base",
"//build:chromeos_buildflags",
"//cc/base",
"//gpu/vulkan:buildflags",
"//skia",
"//third_party/angle:includes",
"//third_party/dawn/include/dawn:cpp_headers",
"//ui/gfx:buffer_types",
"//ui/gfx/geometry",
]
if (enable_vulkan) {
deps += [ "//third_party/vulkan-headers/src:vulkan_headers" ]
}
}
always_enable_blending_for_primary = is_castos || is_cast_android
assert(enable_cast_overlay_strategy || !always_enable_blending_for_primary)
buildflag_header("buildflags") {
header = "buildflags.h"
flags = [
"USE_VIZ_DEBUGGER=$use_viz_debugger",
"ENABLE_CAST_OVERLAY_STRATEGY=$enable_cast_overlay_strategy",
"ALWAYS_ENABLE_BLENDING_FOR_PRIMARY=$always_enable_blending_for_primary",
]
}
if (skia_use_metal) {
viz_component("metal_context_provider") {
output_name = "viz_metal_context_provider"
defines = [ "VIZ_METAL_CONTEXT_PROVIDER_IMPLEMENTATION" ]
sources = [
"gpu/metal_context_provider.h",
"gpu/metal_context_provider.mm",
"viz_metal_context_provider_export.h",
]
public_deps = [ "//skia" ]
deps = [
"//base",
"//components/crash/core/common:crash_key",
"//components/metal_util",
"//gpu/config",
"//ui/gfx",
"//ui/gl",
]
frameworks = [
"Metal.framework",
"Foundation.framework",
]
}
}
if (enable_vulkan) {
viz_component("vulkan_context_provider") {
output_name = "viz_vulkan_context_provider"
defines = [ "VIZ_VULKAN_CONTEXT_PROVIDER_IMPLEMENTATION" ]
# TODO(cblume): http://crbug.com/911313
# Abstract out the platform specific defines. Right now we need the android
# platform specific define here to be able to include android specific
# functions.
if (is_android) {
defines += [ "VK_USE_PLATFORM_ANDROID_KHR" ]
}
sources = [
"gpu/vulkan_context_provider.h",
"gpu/vulkan_in_process_context_provider.cc",
"gpu/vulkan_in_process_context_provider.h",
"viz_vulkan_context_provider_export.h",
]
public_deps = [ "//skia" ]
deps = [
"//base",
"//gpu/vulkan",
"//gpu/vulkan:buildflags",
"//gpu/vulkan/init:skia",
"//ui/gfx",
]
}
}
viz_component("common") {
output_name = "viz_common"
defines = [ "VIZ_COMMON_IMPLEMENTATION" ]
sources = [
"color_space_utils.cc",
"color_space_utils.h",
"constants.cc",
"constants.h",
"delegated_ink_prediction_configuration.h",
"display/overlay_strategy.cc",
"display/overlay_strategy.h",
"display/renderer_settings.cc",
"display/renderer_settings.h",
"display/update_vsync_parameters_callback.h",
"features.cc",
"features.h",
"frame_sinks/begin_frame_args.cc",
"frame_sinks/begin_frame_args.h",
"frame_sinks/begin_frame_source.cc",
"frame_sinks/begin_frame_source.h",
"frame_sinks/blit_request.cc",
"frame_sinks/blit_request.h",
"frame_sinks/copy_output_request.cc",
"frame_sinks/copy_output_request.h",
"frame_sinks/copy_output_result.cc",
"frame_sinks/copy_output_result.h",
"frame_sinks/copy_output_util.cc",
"frame_sinks/copy_output_util.h",
"frame_sinks/delay_based_time_source.cc",
"frame_sinks/delay_based_time_source.h",
"frame_timing_details.h",
"frame_timing_details_map.h",
"gpu/context_cache_controller.cc",
"gpu/context_cache_controller.h",
"gpu/context_lost_observer.h",
"gpu/context_lost_reason.cc",
"gpu/context_lost_reason.h",
"gpu/context_provider.cc",
"gpu/context_provider.h",
"gpu/raster_context_provider.cc",
"gpu/raster_context_provider.h",
"hit_test/aggregated_hit_test_region.h",
"hit_test/hit_test_data_provider.h",
"hit_test/hit_test_query.cc",
"hit_test/hit_test_query.h",
"hit_test/hit_test_region_list.cc",
"hit_test/hit_test_region_list.h",
"hit_test/hit_test_region_observer.h",
"performance_hint_utils.cc",
"performance_hint_utils.h",
"quads/aggregated_render_pass.cc",
"quads/aggregated_render_pass.h",
"quads/aggregated_render_pass_draw_quad.cc",
"quads/aggregated_render_pass_draw_quad.h",
"quads/compositor_frame.cc",
"quads/compositor_frame.h",
"quads/compositor_frame_metadata.cc",
"quads/compositor_frame_metadata.h",
"quads/compositor_frame_transition_directive.cc",
"quads/compositor_frame_transition_directive.h",
"quads/compositor_render_pass.cc",
"quads/compositor_render_pass.h",
"quads/compositor_render_pass_draw_quad.cc",
"quads/compositor_render_pass_draw_quad.h",
"quads/content_draw_quad_base.cc",
"quads/content_draw_quad_base.h",
"quads/debug_border_draw_quad.cc",
"quads/debug_border_draw_quad.h",
"quads/draw_quad.cc",
"quads/draw_quad.h",
"quads/frame_deadline.cc",
"quads/frame_deadline.h",
"quads/frame_interval_inputs.cc",
"quads/frame_interval_inputs.h",
"quads/largest_draw_quad.cc",
"quads/largest_draw_quad.h",
"quads/offset_tag.cc",
"quads/offset_tag.h",
"quads/picture_draw_quad.cc",
"quads/picture_draw_quad.h",
"quads/quad_list.cc",
"quads/quad_list.h",
"quads/render_pass_draw_quad_internal.cc",
"quads/render_pass_draw_quad_internal.h",
"quads/render_pass_internal.cc",
"quads/render_pass_internal.h",
"quads/render_pass_io.cc",
"quads/render_pass_io.h",
"quads/selection.h",
"quads/shared_element_draw_quad.cc",
"quads/shared_element_draw_quad.h",
"quads/shared_quad_state.cc",
"quads/shared_quad_state.h",
"quads/solid_color_draw_quad.cc",
"quads/solid_color_draw_quad.h",
"quads/surface_draw_quad.cc",
"quads/surface_draw_quad.h",
"quads/texture_draw_quad.cc",
"quads/texture_draw_quad.h",
"quads/tile_draw_quad.cc",
"quads/tile_draw_quad.h",
"quads/video_hole_draw_quad.cc",
"quads/video_hole_draw_quad.h",
"quads/yuv_video_draw_quad.cc",
"quads/yuv_video_draw_quad.h",
"resources/bitmap_allocation.cc",
"resources/bitmap_allocation.h",
"resources/platform_color.h",
"resources/release_callback.h",
"resources/resource_id.cc",
"resources/resource_id.h",
"resources/return_callback.h",
"resources/returned_resource.cc",
"resources/returned_resource.h",
"resources/shared_bitmap.cc",
"resources/shared_bitmap.h",
"resources/shared_bitmap_id.cc",
"resources/shared_bitmap_id.h",
"resources/transferable_resource.cc",
"resources/transferable_resource.h",
"skia_helper.cc",
"skia_helper.h",
"surfaces/child_local_surface_id_allocator.cc",
"surfaces/child_local_surface_id_allocator.h",
"surfaces/frame_sink_bundle_id.h",
"surfaces/frame_sink_id.cc",
"surfaces/frame_sink_id.h",
"surfaces/frame_sink_id_allocator.cc",
"surfaces/frame_sink_id_allocator.h",
"surfaces/local_surface_id.cc",
"surfaces/local_surface_id.h",
"surfaces/parent_local_surface_id_allocator.cc",
"surfaces/parent_local_surface_id_allocator.h",
"surfaces/region_capture_bounds.cc",
"surfaces/region_capture_bounds.h",
"surfaces/scoped_surface_id_allocator.cc",
"surfaces/scoped_surface_id_allocator.h",
"surfaces/subtree_capture_id.cc",
"surfaces/subtree_capture_id.h",
"surfaces/subtree_capture_id_allocator.h",
"surfaces/surface_id.cc",
"surfaces/surface_id.h",
"surfaces/surface_info.cc",
"surfaces/surface_info.h",
"surfaces/surface_range.cc",
"surfaces/surface_range.h",
"surfaces/video_capture_target.cc",
"surfaces/video_capture_target.h",
"switches.cc",
"switches.h",
"traced_value.cc",
"traced_value.h",
"transition_utils.cc",
"transition_utils.h",
"vertical_scroll_direction.h",
"view_transition_element_resource_id.cc",
"view_transition_element_resource_id.h",
"viz_common_export.h",
"viz_utils.cc",
"viz_utils.h",
]
deps = [
"//base",
"//build:chromeos_buildflags",
# TODO(staraz): cc/base was added because SharedQuadState includes
# cc::MathUtil. Remove it once cc/base/math_util* are moved to viz.
"//cc/base",
"//cc/paint",
"//gpu/command_buffer/client:gles2_implementation",
"//gpu/command_buffer/client:gles2_interface",
"//gpu/command_buffer/client:raster",
"//gpu/command_buffer/client:raster_interface",
"//gpu/config",
"//gpu/ipc/common:common",
"//gpu/vulkan:buildflags",
"//media:media_buildflags",
"//mojo/public/cpp/base",
"//mojo/public/cpp/system",
"//services/tracing/public/cpp:cpp",
"//third_party/blink/public/common/tokens:tokens_headers",
"//third_party/libyuv",
"//ui/display/types",
"//ui/gfx",
"//ui/gfx:color_space",
"//ui/gfx/geometry",
"//ui/gfx/geometry:geometry_skia",
"//ui/gl",
"//ui/latency",
]
if (is_win) {
sources += [
"display/use_layered_window.cc",
"display/use_layered_window.h",
"overlay_state/win/overlay_state_aggregator.cc",
"overlay_state/win/overlay_state_aggregator.h",
"overlay_state/win/overlay_state_service.cc",
"overlay_state/win/overlay_state_service.h",
]
deps += [ "//ui/base" ]
}
if (is_android) {
deps += [ "//gpu/config" ]
}
public_deps = [
":buildflags",
":shared_image_format",
"//gpu/command_buffer/client",
"//gpu/command_buffer/common",
"//mojo/public/cpp/bindings",
"//skia",
]
if (enable_vulkan) {
public_deps += [ ":vulkan_context_provider" ]
}
if (skia_use_metal) {
public_deps += [ ":metal_context_provider" ]
}
}
viz_source_set("unit_tests") {
testonly = true
sources = [
"display/overlay_strategy_unittest.cc",
"frame_sinks/begin_frame_args_unittest.cc",
"frame_sinks/begin_frame_source_unittest.cc",
"frame_sinks/copy_output_util_unittest.cc",
"frame_sinks/delay_based_time_source_unittest.cc",
"gpu/context_cache_controller_unittest.cc",
"hit_test/hit_test_query_unittest.cc",
"quads/compositor_frame_metadata_unittest.cc",
"quads/compositor_frame_transition_directive_unittest.cc",
"quads/compositor_render_pass_unittest.cc",
"quads/draw_quad_unittest.cc",
"quads/offset_tag_unittest.cc",
"quads/render_pass_io_unittest.cc",
"resources/resource_sizes_unittest.cc",
"resources/shared_image_format_unittest.cc",
"resources/shared_image_format_utils_unittest.cc",
"surfaces/child_local_surface_id_allocator_unittest.cc",
"surfaces/local_surface_id_unittest.cc",
"surfaces/parent_local_surface_id_allocator_unittest.cc",
"surfaces/scoped_surface_id_allocator_unittest.cc",
"surfaces/surface_range_unittest.cc",
"yuv_readback_unittest.cc",
]
if (enable_vulkan) {
sources += [ "gpu/vulkan_in_process_context_provider_unittest.cc" ]
}
deps = [
":buildflags",
":common",
"//base/test:test_support",
"//cc:test_support",
"//components/viz/test:test_support",
"//gpu/command_buffer/client:gles2_implementation",
"//gpu/command_buffer/client:gles2_interface",
"//gpu/ipc:gl_in_process_context",
"//gpu/ipc/common:surface_handle_type",
"//media",
"//testing/gmock",
"//testing/gtest",
"//ui/gfx",
"//ui/gfx:color_space",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
"//ui/latency",
]
if (is_win) {
sources += [ "overlay_state/win/overlay_state_service_unittest.cc" ]
deps += [
"//components/viz/test:test_suite",
"//media/mojo/mojom",
]
}
}
viz_source_set("perf_tests") {
testonly = true
sources = [ "quads/draw_quad_perftest.cc" ]
deps = [
":common",
"//base",
"//cc/base",
"//skia",
"//testing/gtest",
"//testing/perf",
]
}
fuzzer_test("hit_test_query_fuzzer") {
sources = [ "hit_test/hit_test_query_fuzzer.cc" ]
libfuzzer_options = [ "max_len=4096" ]
deps = [
":common",
"//base/test:test_support",
"//components/viz/test:test_support",
"//ui/gfx:test_support",
]
}