| # Copyright 2016 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("//gpu/vulkan/features.gni") |
| import("//mojo/public/tools/bindings/mojom.gni") |
| |
| group("common") { |
| if (is_component_build) { |
| public_deps = [ "//gpu" ] |
| } else { |
| public_deps = [ ":ipc_common_sources" ] |
| } |
| } |
| |
| group("command_buffer_traits") { |
| if (is_component_build) { |
| public_deps = [ "//gpu" ] |
| } else { |
| public_deps = [ ":command_buffer_traits_sources" ] |
| } |
| } |
| |
| source_set("command_buffer_traits_sources") { |
| # External code should depend on this via |
| # //gpu/ipc/common:command_buffer_traits above rather than depending on this |
| # directly or the component build will break. |
| visibility = [ "//gpu/*" ] |
| |
| sources = [ |
| "gpu_command_buffer_traits.cc", |
| "gpu_command_buffer_traits.h", |
| "gpu_command_buffer_traits_multi.h", |
| ] |
| |
| configs += [ |
| "//gpu:gpu_implementation", |
| "//third_party/khronos:khronos_headers", |
| ] |
| |
| public_deps = [ |
| "//gpu/command_buffer/common:common_sources", |
| "//ipc", |
| "//ui/gfx/ipc", |
| ] |
| |
| deps = [ |
| "//base", |
| "//gpu/ipc/common:vulkan_ycbcr_info", |
| "//ui/gfx/ipc/buffer_types", |
| "//ui/gfx/ipc/geometry", |
| ] |
| |
| if (!is_nacl) { |
| deps += [ "//ui/gfx/ipc/skia" ] |
| } |
| } |
| |
| source_set("ipc_common_sources") { |
| # External code should depend on this via //gpu/ipc/common above rather than |
| # depending on this directly or the component build will break. |
| visibility = [ "//gpu/*" ] |
| |
| sources = [ |
| "command_buffer_id.h", |
| "gpu_client_ids.h", |
| "gpu_memory_buffer_impl.cc", |
| "gpu_memory_buffer_impl.h", |
| "gpu_memory_buffer_impl_shared_memory.cc", |
| "gpu_memory_buffer_impl_shared_memory.h", |
| "gpu_memory_buffer_support.cc", |
| "gpu_memory_buffer_support.h", |
| "gpu_message_generator.cc", |
| "gpu_message_generator.h", |
| "gpu_messages.h", |
| "gpu_param_traits.cc", |
| "gpu_param_traits.h", |
| "gpu_param_traits_macros.h", |
| "gpu_peak_memory.h", |
| "gpu_watchdog_timeout.h", |
| "memory_stats.cc", |
| "memory_stats.h", |
| "result_codes.h", |
| ] |
| |
| if (is_win) { |
| sources += [ |
| "gpu_memory_buffer_impl_dxgi.cc", |
| "gpu_memory_buffer_impl_dxgi.h", |
| ] |
| } |
| if (is_linux || is_chromeos || use_ozone) { |
| sources += [ |
| "gpu_memory_buffer_impl_native_pixmap.cc", |
| "gpu_memory_buffer_impl_native_pixmap.h", |
| ] |
| } |
| if (is_android) { |
| sources += [ |
| "gpu_memory_buffer_impl_android_hardware_buffer.cc", |
| "gpu_memory_buffer_impl_android_hardware_buffer.h", |
| ] |
| visibility += [ "//media/gpu:gpu" ] |
| } |
| |
| configs += [ |
| "//gpu:gpu_implementation", |
| "//third_party/khronos:khronos_headers", |
| ] |
| |
| public_deps = [ |
| ":command_buffer_traits_sources", |
| ":surface_handle_type", |
| ":vulkan_ycbcr_info", |
| "//ipc", |
| "//url/ipc:url_ipc", |
| ] |
| |
| deps = [ |
| "//base", |
| "//components/viz/common:resource_format", |
| "//gpu/command_buffer/common:common_sources", |
| "//gpu/config:config_sources", |
| "//ui/base", |
| "//ui/gfx:color_space", |
| "//ui/gfx/geometry", |
| "//ui/gfx/ipc", |
| "//ui/gfx/ipc/buffer_types", |
| "//ui/gfx/ipc/color", |
| "//ui/gfx/ipc/geometry", |
| "//ui/gl", |
| ] |
| |
| if (is_mac) { |
| sources += [ |
| "gpu_memory_buffer_impl_io_surface.cc", |
| "gpu_memory_buffer_impl_io_surface.h", |
| ] |
| deps += [ "//ui/gfx:gfx_io_surface_hdr_metadata" ] |
| frameworks = [ "IOSurface.framework" ] |
| } |
| |
| if (!is_nacl) { |
| deps += [ "//ui/gfx/ipc/skia" ] |
| } |
| |
| if (is_android) { |
| sources += [ |
| "android/scoped_surface_request_conduit.cc", |
| "android/scoped_surface_request_conduit.h", |
| "gpu_surface_lookup.cc", |
| "gpu_surface_lookup.h", |
| "gpu_surface_tracker.cc", |
| "gpu_surface_tracker.h", |
| ] |
| libs = [ "android" ] |
| } |
| |
| if (use_ozone) { |
| deps += [ "//ui/ozone" ] |
| } |
| } |
| |
| if (is_android) { |
| source_set("android_image_reader_utils") { |
| sources = [ |
| "android/android_image_reader_utils.cc", |
| "android/android_image_reader_utils.h", |
| ] |
| configs += [ "//gpu:gpu_implementation" ] |
| deps = [ |
| "//base", |
| "//ui/gl", |
| ] |
| visibility = [ |
| "//android_webview/browser/gfx", |
| "//gpu/*", |
| "//media/gpu:gpu", |
| ] |
| } |
| } |
| |
| # Depend on this to use surface_handle.h without pulling in all of gpu ipc. |
| source_set("surface_handle_type") { |
| public = [ "surface_handle.h" ] |
| |
| public_deps = [ "//ui/gfx:native_widget_types" ] |
| } |
| |
| component("vulkan_ycbcr_info") { |
| sources = [ |
| "vulkan_ycbcr_info.cc", |
| "vulkan_ycbcr_info.h", |
| ] |
| deps = [ "//base" ] |
| configs += [ "//gpu:gpu_implementation" ] |
| } |
| |
| source_set("vulkan_types") { |
| sources = [ "vulkan_types.h" ] |
| public_deps = [ "//ui/gfx" ] |
| all_dependent_configs = |
| [ "//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers_config" ] |
| configs += [ "//gpu:gpu_implementation" ] |
| } |
| |
| mojom("interfaces") { |
| generate_java = true |
| sources = [ |
| "capabilities.mojom", |
| "context_result.mojom", |
| "device_perf_info.mojom", |
| "dx_diag_node.mojom", |
| "gpu_feature_info.mojom", |
| "gpu_info.mojom", |
| "gpu_peak_memory.mojom", |
| "mailbox.mojom", |
| "mailbox_holder.mojom", |
| "memory_stats.mojom", |
| "surface_handle.mojom", |
| "sync_token.mojom", |
| "vulkan_ycbcr_info.mojom", |
| ] |
| |
| if (is_win) { |
| sources += [ "luid.mojom" ] |
| } |
| |
| public_deps = [ |
| ":gpu_preferences_interface", |
| "//mojo/public/mojom/base", |
| "//ui/gfx/geometry/mojom", |
| "//ui/gfx/mojom", |
| ] |
| enabled_features = [] |
| if (enable_vulkan) { |
| public_deps += [ ":vulkan_interface" ] |
| enabled_features += [ "supports_vulkan" ] |
| } |
| if (use_x11) { |
| enabled_features += [ "use_x11" ] |
| } |
| |
| shared_cpp_typemaps = [ |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.Mailbox" |
| cpp = "::gpu::Mailbox" |
| }, |
| ] |
| traits_headers = [ "mailbox_mojom_traits.h" ] |
| traits_public_deps = [ ":shared_mojom_traits" ] |
| }, |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.MailboxHolder" |
| cpp = "::gpu::MailboxHolder" |
| }, |
| ] |
| traits_headers = [ "mailbox_holder_mojom_traits.h" ] |
| traits_public_deps = [ |
| ":mojom_traits", |
| ":shared_mojom_traits", |
| "//gpu/command_buffer/common", |
| ] |
| }, |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.SyncToken" |
| cpp = "::gpu::SyncToken" |
| }, |
| ] |
| traits_headers = [ "sync_token_mojom_traits.h" ] |
| traits_public_deps = [ |
| ":mojom_traits", |
| "//gpu/command_buffer/common", |
| ] |
| }, |
| ] |
| |
| if (is_win) { |
| shared_cpp_typemaps += [ |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.Luid" |
| cpp = "::LUID" |
| }, |
| ] |
| traits_headers = [ "luid_mojom_traits.h" ] |
| traits_public_deps = [ |
| ":mojom_traits", |
| "//gpu/config", |
| ] |
| }, |
| ] |
| } |
| |
| cpp_typemaps = shared_cpp_typemaps |
| blink_cpp_typemaps = shared_cpp_typemaps |
| |
| cpp_typemaps += [ |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.Capabilities" |
| cpp = "::gpu::Capabilities" |
| }, |
| ] |
| traits_headers = [ "gpu_command_buffer_traits.h" ] |
| traits_public_deps = [ ":command_buffer_traits" ] |
| }, |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.ContextResult" |
| cpp = "::gpu::ContextResult" |
| }, |
| ] |
| traits_headers = [ "context_result_mojom_traits.h" ] |
| traits_public_deps = [ "//gpu/command_buffer/common" ] |
| }, |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.IntelGpuGeneration" |
| cpp = "::gpu::IntelGpuGeneration" |
| }, |
| { |
| mojom = "gpu.mojom.D3D_FEATURE_LEVEL" |
| cpp = "::D3D_FEATURE_LEVEL" |
| }, |
| { |
| mojom = "gpu.mojom.DevicePerfInfo" |
| cpp = "::gpu::DevicePerfInfo" |
| }, |
| ] |
| traits_sources = [ "device_perf_info_mojom_traits.cc" ] |
| traits_headers = [ "device_perf_info_mojom_traits.h" ] |
| }, |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.DxDiagNode" |
| cpp = "::gpu::DxDiagNode" |
| }, |
| ] |
| traits_sources = [ "dx_diag_node_mojom_traits.cc" ] |
| traits_headers = [ "dx_diag_node_mojom_traits.h" ] |
| }, |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.GpuFeatureStatus" |
| cpp = "::gpu::GpuFeatureStatus" |
| }, |
| { |
| mojom = "gpu.mojom.GpuFeatureInfo" |
| cpp = "::gpu::GpuFeatureInfo" |
| }, |
| ] |
| traits_sources = [ "gpu_feature_info_mojom_traits.cc" ] |
| traits_headers = [ "gpu_feature_info_mojom_traits.h" ] |
| traits_public_deps = [ |
| "//gpu/config", |
| "//ui/gfx/geometry/mojom", |
| ] |
| }, |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.CollectInfoResult" |
| cpp = "::gpu::CollectInfoResult" |
| }, |
| { |
| mojom = "gpu.mojom.OverlayInfo" |
| cpp = "::gpu::OverlayInfo" |
| }, |
| { |
| mojom = "gpu.mojom.GpuDevice" |
| cpp = "::gpu::GPUInfo::GPUDevice" |
| }, |
| { |
| mojom = "gpu.mojom.GpuInfo" |
| cpp = "::gpu::GPUInfo" |
| }, |
| { |
| mojom = "gpu.mojom.VideoCodecProfile" |
| cpp = "::gpu::VideoCodecProfile" |
| }, |
| { |
| mojom = "gpu.mojom.VideoDecodeAcceleratorSupportedProfile" |
| cpp = "::gpu::VideoDecodeAcceleratorSupportedProfile" |
| }, |
| { |
| mojom = "gpu.mojom.VideoDecodeAcceleratorCapabilities" |
| cpp = "::gpu::VideoDecodeAcceleratorCapabilities" |
| }, |
| { |
| mojom = "gpu.mojom.VideoEncodeAcceleratorSupportedProfile" |
| cpp = "::gpu::VideoEncodeAcceleratorSupportedProfile" |
| }, |
| { |
| mojom = "gpu.mojom.ImageDecodeAcceleratorSupportedProfile" |
| cpp = "::gpu::ImageDecodeAcceleratorSupportedProfile" |
| }, |
| ] |
| traits_sources = [ "gpu_info_mojom_traits.cc" ] |
| traits_headers = [ "gpu_info_mojom_traits.h" ] |
| traits_public_deps = [ |
| "//gpu/config", |
| "//ui/gfx/geometry/mojom", |
| ] |
| }, |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.GpuPeakMemoryAllocationSource" |
| cpp = "::gpu::GpuPeakMemoryAllocationSource" |
| }, |
| ] |
| traits_headers = [ "gpu_peak_memory_mojom_traits.h" ] |
| traits_public_deps = [ ":common" ] |
| }, |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.VideoMemoryProcessStats" |
| cpp = "::gpu::VideoMemoryUsageStats::ProcessStats" |
| }, |
| { |
| mojom = "gpu.mojom.VideoMemoryUsageStats" |
| cpp = "::gpu::VideoMemoryUsageStats" |
| }, |
| ] |
| traits_headers = [ "memory_stats_mojom_traits.h" ] |
| }, |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.SurfaceHandle" |
| cpp = "::gpu::SurfaceHandle" |
| copyable_pass_by_value = true |
| }, |
| ] |
| traits_headers = [ "surface_handle_mojom_traits.h" ] |
| traits_public_deps = [ "//ui/gfx:native_widget_types" ] |
| }, |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.VulkanYCbCrInfo" |
| cpp = "::gpu::VulkanYCbCrInfo" |
| copyable_pass_by_value = true |
| }, |
| ] |
| traits_headers = [ "vulkan_ycbcr_info_mojom_traits.h" ] |
| }, |
| ] |
| |
| export_class_attribute_blink = "BLINK_PLATFORM_EXPORT" |
| export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1" |
| export_header_blink = "third_party/blink/public/platform/web_common.h" |
| } |
| |
| mojom("gpu_preferences_interface") { |
| generate_java = true |
| sources = [ "gpu_preferences.mojom" ] |
| |
| public_deps = [ |
| "//mojo/public/mojom/base", |
| "//ui/gfx/mojom", |
| ] |
| |
| enabled_features = [] |
| if (use_ozone) { |
| enabled_features += [ "use_ozone" ] |
| } |
| |
| cpp_typemaps = [ |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.GpuPreferences" |
| cpp = "::gpu::GpuPreferences" |
| }, |
| ] |
| traits_headers = [ "gpu_preferences_mojom_traits.h" ] |
| traits_public_deps = [ "//media:media_buildflags" ] |
| if (use_ozone) { |
| traits_public_deps += [ "//ui/base:features" ] |
| } |
| traits_deps = [ |
| # We depend on gpu_preferences but since it also depends on its own |
| # mojo bindings, that is handled with an |allowed_circular_includes| |
| # in //gpu/config:gpu_preferences. |
| # "//gpu/config:gpu_preferences", |
| ] |
| }, |
| ] |
| } |
| |
| mojom("vulkan_interface") { |
| generate_java = true |
| |
| # TODO(crbug.com/1062364): This interface code is used by some javascript targets even |
| # when vulkan isn't enabled, but the C++ fuzzer code will fail to compile if |
| # the headers aren't available. |
| if (!enable_vulkan) { |
| enable_fuzzing = false |
| } |
| |
| sources = [ |
| "vulkan_info.mojom", |
| "vulkan_types.mojom", |
| ] |
| |
| public_deps = [ "//mojo/public/mojom/base" ] |
| |
| js_generate_struct_deserializers = true |
| |
| # This imports the |generated_vulkan_type_mappings| definition used below. |
| import("//gpu/ipc/common/generated_vulkan_type_mappings.gni") |
| cpp_typemaps = [ |
| { |
| types = [ |
| { |
| mojom = "gpu.mojom.VulkanPhysicalDeviceInfo" |
| cpp = "::gpu::VulkanPhysicalDeviceInfo" |
| }, |
| { |
| mojom = "gpu.mojom.VulkanInfo" |
| cpp = "::gpu::VulkanInfo" |
| }, |
| ] |
| traits_headers = [ "vulkan_info_mojom_traits.h" ] |
| }, |
| { |
| types = generated_vulkan_type_mappings |
| traits_sources = [ "vulkan_types_mojom_traits.cc" ] |
| traits_headers = [ "vulkan_types_mojom_traits.h" ] |
| traits_public_deps = [ ":vulkan_types_mojom_traits" ] |
| }, |
| ] |
| |
| webui_module_path = "/" |
| } |
| |
| mojom("test_interfaces") { |
| testonly = true |
| sources = [ "traits_test_service.mojom" ] |
| |
| public_deps = [ |
| ":gpu_preferences_interface", |
| ":interfaces", |
| ] |
| |
| if (enable_vulkan) { |
| public_deps += [ ":vulkan_interface" ] |
| } |
| } |
| |
| source_set("vulkan_types_mojom_traits") { |
| sources = [ "vulkan_types_mojom_traits.h" ] |
| |
| deps = [ |
| ":vulkan_interface_shared_cpp_sources", |
| ":vulkan_types", |
| ] |
| } |
| |
| source_set("mojom_traits") { |
| sources = [ |
| "context_result_mojom_traits.h", |
| "gpu_peak_memory_mojom_traits.h", |
| "mailbox_holder_mojom_traits.h", |
| "mailbox_mojom_traits.h", |
| "memory_stats_mojom_traits.h", |
| "surface_handle_mojom_traits.h", |
| "sync_token_mojom_traits.h", |
| ] |
| deps = [ |
| ":interfaces_shared_cpp_sources", |
| ":surface_handle_type", |
| ":vulkan_ycbcr_info", |
| "//gpu/command_buffer/common", |
| "//gpu/ipc/common", |
| "//mojo/public/cpp/bindings:bindings", |
| ] |
| if (is_android) { |
| sources += [ "vulkan_ycbcr_info_mojom_traits.h" ] |
| } |
| if (is_win) { |
| sources += [ "luid_mojom_traits.h" ] |
| } |
| if (enable_vulkan) { |
| deps += [ ":vulkan_types_mojom_traits" ] |
| } |
| } |
| |
| component("shared_mojom_traits") { |
| output_name = "gpu_shared_mojom_traits" |
| sources = [ |
| "mailbox_mojom_traits.cc", |
| "mailbox_mojom_traits.h", |
| ] |
| defines = [ "IS_GPU_SHARED_MOJOM_TRAITS_IMPL" ] |
| public_deps = [ |
| ":interfaces_shared", |
| "//base", |
| "//gpu/command_buffer/common", |
| "//mojo/public/cpp/bindings", |
| ] |
| } |