| # 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/buildflag_header.gni") |
| import("//build/config/features.gni") |
| import("//build/config/ui.gni") |
| import("//media/gpu/args.gni") |
| import("//media/media_options.gni") |
| import("//testing/test.gni") |
| import("//tools/generate_stubs/rules.gni") |
| |
| buildflag_header("buildflags") { |
| header = "buildflags.h" |
| |
| flags = [ |
| "USE_VAAPI=$use_vaapi", |
| "USE_V4L2_CODEC=$use_v4l2_codec", |
| "USE_LIBV4L2=$use_v4lplugin", |
| ] |
| } |
| |
| component("gpu") { |
| output_name = "media_gpu" |
| |
| # Only local test code, GPU-related IPC code in the media layer, and |
| # media-related content code should access //media/gpu. |
| visibility = [ |
| "//chrome/gpu", |
| "//components/arc/common:media", |
| "//components/arc/video_accelerator", |
| "//components/mirroring/service:mirroring_service", |
| "//components/viz/service/main", |
| "//content/gpu:*", |
| "//content/renderer:*", |
| "//media/gpu/ipc/*", |
| "//media/gpu/vaapi/*", |
| "//media/gpu/test/*", |
| "//media/mojo/*", |
| "//remoting/codec:encoder", |
| ":*", |
| ] |
| |
| if (is_mac) { |
| # On Mac, content/common reaches into here to do some pre-sandbox |
| # initialization. |
| visibility += [ "//content/common" ] |
| } |
| |
| defines = [ "MEDIA_GPU_IMPLEMENTATION" ] |
| |
| sources = [ |
| "command_buffer_helper.cc", |
| "command_buffer_helper.h", |
| "fake_mjpeg_decode_accelerator.cc", |
| "fake_mjpeg_decode_accelerator.h", |
| "gles2_decoder_helper.cc", |
| "gles2_decoder_helper.h", |
| "gpu_jpeg_encode_accelerator_factory.cc", |
| "gpu_jpeg_encode_accelerator_factory.h", |
| "gpu_mjpeg_decode_accelerator_factory.cc", |
| "gpu_mjpeg_decode_accelerator_factory.h", |
| "gpu_video_accelerator_util.cc", |
| "gpu_video_accelerator_util.h", |
| "gpu_video_decode_accelerator_factory.cc", |
| "gpu_video_decode_accelerator_factory.h", |
| "gpu_video_encode_accelerator_factory.cc", |
| "gpu_video_encode_accelerator_factory.h", |
| ] |
| |
| public_deps = [ |
| ":buildflags", |
| ":common", |
| ":image_processor", |
| ":video_frame_mapper", |
| "//base", |
| "//gpu", |
| "//media", |
| "//third_party/mesa_headers", |
| "//ui/gfx/geometry", |
| ] |
| deps = [ |
| "//gpu/command_buffer/common:gles2_utils", |
| "//gpu/command_buffer/service:gles2", |
| "//gpu/ipc/service", |
| "//third_party/libyuv", |
| "//ui/base", |
| "//ui/display/types", |
| "//ui/gl", |
| "//ui/platform_window", |
| ] |
| libs = [] |
| ldflags = [] |
| |
| if (is_linux) { |
| public_deps += [ "//media/gpu/linux" ] |
| } |
| |
| if (is_mac) { |
| public_deps += [ "//media/gpu/mac" ] |
| } |
| |
| if (is_android) { |
| sources += [ |
| "android/android_video_decode_accelerator.cc", |
| "android/android_video_decode_accelerator.h", |
| "android/android_video_encode_accelerator.cc", |
| "android/android_video_encode_accelerator.h", |
| "android/android_video_surface_chooser.cc", |
| "android/android_video_surface_chooser.h", |
| "android/android_video_surface_chooser_impl.cc", |
| "android/android_video_surface_chooser_impl.h", |
| "android/avda_codec_image.cc", |
| "android/avda_codec_image.h", |
| "android/avda_picture_buffer_manager.cc", |
| "android/avda_picture_buffer_manager.h", |
| "android/avda_shared_state.cc", |
| "android/avda_shared_state.h", |
| "android/avda_state_provider.h", |
| "android/avda_surface_bundle.cc", |
| "android/avda_surface_bundle.h", |
| "android/codec_allocator.cc", |
| "android/codec_allocator.h", |
| "android/codec_image.cc", |
| "android/codec_image.h", |
| "android/codec_image_group.cc", |
| "android/codec_image_group.h", |
| "android/codec_wrapper.cc", |
| "android/codec_wrapper.h", |
| "android/device_info.cc", |
| "android/device_info.h", |
| "android/image_reader_gl_owner.cc", |
| "android/image_reader_gl_owner.h", |
| "android/media_codec_video_decoder.cc", |
| "android/media_codec_video_decoder.h", |
| "android/promotion_hint_aggregator.h", |
| "android/promotion_hint_aggregator_impl.cc", |
| "android/promotion_hint_aggregator_impl.h", |
| "android/shared_image_video.cc", |
| "android/shared_image_video.h", |
| "android/surface_chooser_helper.cc", |
| "android/surface_chooser_helper.h", |
| "android/surface_texture_gl_owner.cc", |
| "android/surface_texture_gl_owner.h", |
| "android/texture_owner.cc", |
| "android/texture_owner.h", |
| "android/video_frame_factory.h", |
| "android/video_frame_factory_impl.cc", |
| "android/video_frame_factory_impl.h", |
| ] |
| libs += [ "android" ] |
| deps += [ |
| "//gpu/ipc/common:android_image_reader_utils", |
| |
| # TODO(crbug.com/789435): This can be removed once CdmManager is removed. |
| "//gpu/ipc/common:ipc_common_sources", |
| "//media/mojo:buildflags", |
| "//services/service_manager/public/cpp:cpp", |
| "//ui/gl:gl_jni_headers", |
| ] |
| |
| # TODO(crbug.com/789435): This is needed for AVDA to access the CDM |
| # directly. Remove this dependency after VDAs are also running as part of |
| # the mojo media service. See http://crbug.com/522298 |
| if (mojo_media_host == "gpu") { |
| deps += [ "//media/cdm:cdm_manager" ] |
| } |
| } |
| |
| if (use_v4l2_codec) { |
| public_deps += [ "//media/gpu/v4l2" ] |
| } |
| |
| if (use_vaapi) { |
| public_deps += [ "//media/gpu/vaapi" ] |
| } |
| |
| if (is_win) { |
| sources += [ |
| "windows/d3d11_h264_accelerator.cc", |
| "windows/d3d11_h264_accelerator.h", |
| "windows/d3d11_picture_buffer.cc", |
| "windows/d3d11_picture_buffer.h", |
| "windows/d3d11_video_context_wrapper.cc", |
| "windows/d3d11_video_context_wrapper.h", |
| "windows/d3d11_video_decoder.cc", |
| "windows/d3d11_video_decoder.h", |
| "windows/d3d11_video_decoder_client.h", |
| "windows/d3d11_video_decoder_impl.cc", |
| "windows/d3d11_video_decoder_impl.h", |
| "windows/d3d11_vp9_accelerator.cc", |
| "windows/d3d11_vp9_accelerator.h", |
| "windows/d3d11_vp9_picture.cc", |
| "windows/d3d11_vp9_picture.h", |
| "windows/dxva_picture_buffer_win.cc", |
| "windows/dxva_picture_buffer_win.h", |
| "windows/dxva_video_decode_accelerator_win.cc", |
| "windows/dxva_video_decode_accelerator_win.h", |
| "windows/init_guid.cc", |
| "windows/media_foundation_video_encode_accelerator_win.cc", |
| "windows/media_foundation_video_encode_accelerator_win.h", |
| ] |
| configs += [ |
| # TODO(https://crbug.com/167187): Fix size_t to int truncations. |
| "//build/config/compiler:no_size_t_to_int_warning", |
| "//third_party/khronos:khronos_headers", |
| ] |
| public_deps += [ "//media/base/win:media_foundation_util" ] |
| deps += [ |
| "//third_party/angle:includes", |
| "//ui/display", |
| ] |
| libs += [ |
| "d3d9.lib", |
| "d3d11.lib", |
| "dxva2.lib", |
| "strmiids.lib", |
| "mf.lib", |
| "mfplat.lib", |
| "mfuuid.lib", |
| ] |
| ldflags += [ |
| "/DELAYLOAD:d3d9.dll", |
| "/DELAYLOAD:d3d11.dll", |
| "/DELAYLOAD:dxva2.dll", |
| "/DELAYLOAD:mf.dll", |
| "/DELAYLOAD:mfplat.dll", |
| ] |
| if (enable_library_cdms) { |
| sources += [ |
| "windows/d3d11_cdm_proxy.cc", |
| "windows/d3d11_cdm_proxy.h", |
| "windows/d3d11_decryptor.cc", |
| "windows/d3d11_decryptor.h", |
| ] |
| } |
| } |
| |
| if (use_ozone) { |
| deps += [ "//ui/ozone" ] |
| } |
| } |
| |
| source_set("common") { |
| defines = [ "MEDIA_GPU_IMPLEMENTATION" ] |
| sources = [ |
| "accelerated_video_decoder.h", |
| "codec_picture.cc", |
| "codec_picture.h", |
| "format_utils.cc", |
| "format_utils.h", |
| "gpu_video_decode_accelerator_helpers.h", |
| "gpu_video_encode_accelerator_helpers.cc", |
| "gpu_video_encode_accelerator_helpers.h", |
| "h264_decoder.cc", |
| "h264_decoder.h", |
| "h264_dpb.cc", |
| "h264_dpb.h", |
| "macros.h", |
| "vp9_decoder.cc", |
| "vp9_decoder.h", |
| "vp9_picture.cc", |
| "vp9_picture.h", |
| "vp9_reference_frame_vector.cc", |
| "vp9_reference_frame_vector.h", |
| ] |
| if (use_v4l2_codec || use_vaapi) { |
| sources += [ |
| "decode_surface_handler.h", |
| "vp8_decoder.cc", |
| "vp8_decoder.h", |
| "vp8_picture.cc", |
| "vp8_picture.h", |
| "vp8_reference_frame_vector.cc", |
| "vp8_reference_frame_vector.h", |
| ] |
| } |
| |
| deps = [ |
| ":buildflags", |
| "//base", |
| "//media", |
| "//ui/gfx:buffer_types", |
| "//ui/gfx:memory_buffer", |
| "//ui/gfx/geometry", |
| ] |
| } |
| |
| source_set("image_processor") { |
| defines = [ "MEDIA_GPU_IMPLEMENTATION" ] |
| sources = [ |
| "image_processor_factory.cc", |
| "libyuv_image_processor.cc", |
| "libyuv_image_processor.h", |
| ] |
| |
| public_deps = [ |
| ":image_processor_common", |
| ] |
| |
| deps = [ |
| "//third_party/libyuv", |
| "//ui/gl", |
| ] |
| |
| if (use_v4l2_codec) { |
| deps += [ "//media/gpu/v4l2" ] |
| } |
| if (is_linux) { |
| deps += [ ":video_frame_mapper" ] |
| } |
| } |
| |
| source_set("image_processor_common") { |
| defines = [ "MEDIA_GPU_IMPLEMENTATION" ] |
| sources = [ |
| "image_processor.cc", |
| "image_processor.h", |
| "image_processor_factory.h", |
| ] |
| |
| public_deps = [ |
| ":buildflags", |
| ":common", |
| "//base", |
| "//media", |
| "//ui/gfx/geometry", |
| ] |
| } |
| |
| source_set("video_frame_mapper") { |
| defines = [ "MEDIA_GPU_IMPLEMENTATION" ] |
| sources = [ |
| "video_frame_mapper_factory.cc", |
| ] |
| public_deps = [ |
| ":video_frame_mapper_common", |
| ] |
| deps = [] |
| |
| # generic_dmabuf_video_frame_mapper |
| if (is_linux) { |
| deps += [ "//media/gpu/linux:video_frame_mapper" ] |
| } |
| |
| # vaapi_dmabuf_video_frame_mapper |
| if (use_vaapi) { |
| deps += [ "//media/gpu/vaapi" ] |
| } |
| } |
| |
| source_set("video_frame_mapper_common") { |
| defines = [ "MEDIA_GPU_IMPLEMENTATION" ] |
| sources = [ |
| "video_frame_mapper.h", |
| "video_frame_mapper_factory.h", |
| ] |
| |
| public_deps = [ |
| ":buildflags", |
| "//base", |
| "//media", |
| ] |
| } |
| |
| # TODO(watk): Run this on bots. http://crbug.com/461437 |
| if (is_win || is_android || use_v4l2_codec || use_vaapi) { |
| test("video_decode_accelerator_unittest") { |
| data = [ |
| "//media/test/data/", |
| ] |
| |
| deps = [ |
| ":common", |
| ":gpu", |
| "//base", |
| "//base/test:test_support", |
| "//media:test_support", |
| "//mojo/core/embedder", |
| "//testing/gtest", |
| "//ui/base", |
| "//ui/display/manager", |
| "//ui/gfx", |
| "//ui/gfx:test_support", |
| "//ui/gfx/geometry", |
| "//ui/gl", |
| "//ui/gl:test_support", |
| "//ui/gl/init", |
| ] |
| |
| configs += [ "//third_party/khronos:khronos_headers" ] |
| |
| if (is_win || is_chromeos || use_v4l2_codec) { |
| sources = [ |
| "test/fake_video_decode_accelerator.cc", |
| "test/fake_video_decode_accelerator.h", |
| "video_decode_accelerator_unittest.cc", |
| ] |
| deps += [ |
| "test:decode_helpers", |
| "test:frame_file_writer", |
| "test:frame_validator", |
| "//mojo/core/embedder", |
| "//ui/display", |
| "//ui/display/types", |
| "//ui/platform_window", |
| ] |
| } |
| |
| if (is_android) { |
| deps += [ |
| ":android_video_decode_accelerator_unittests", |
| "//media/base/android:media_java", |
| "//media/test:run_all_unittests", |
| "//ui/android:ui_java", |
| ] |
| } |
| |
| if (is_win) { |
| # TODO(https://crbug.com/167187): Fix size_t to int truncations. |
| configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] |
| deps += [ |
| "//third_party/angle:libEGL", |
| "//third_party/angle:libGLESv2", |
| ] |
| } |
| |
| if (use_x11) { |
| configs += [ "//build/config/linux:x11" ] |
| deps += [ "//ui/gfx/x" ] |
| } |
| |
| if (use_ozone) { |
| deps += [ "//ui/ozone" ] |
| } |
| } |
| } |
| |
| source_set("android_video_decode_accelerator_unittests") { |
| if (is_android) { |
| testonly = true |
| sources = [ |
| "android/android_video_decode_accelerator_unittest.cc", |
| "android/android_video_surface_chooser_impl_unittest.cc", |
| "android/codec_allocator_unittest.cc", |
| "android/codec_image_group_unittest.cc", |
| "android/codec_image_unittest.cc", |
| "android/codec_wrapper_unittest.cc", |
| "android/fake_codec_allocator.cc", |
| "android/fake_codec_allocator.h", |
| "android/image_reader_gl_owner_unittest.cc", |
| "android/media_codec_video_decoder_unittest.cc", |
| "android/mock_abstract_texture.cc", |
| "android/mock_abstract_texture.h", |
| "android/mock_android_video_surface_chooser.cc", |
| "android/mock_android_video_surface_chooser.h", |
| "android/mock_device_info.cc", |
| "android/mock_device_info.h", |
| "android/mock_promotion_hint_aggregator.cc", |
| "android/mock_promotion_hint_aggregator.h", |
| "android/mock_texture_owner.cc", |
| "android/mock_texture_owner.h", |
| "android/promotion_hint_aggregator_impl_unittest.cc", |
| "android/surface_chooser_helper_unittest.cc", |
| "android/surface_texture_gl_owner_unittest.cc", |
| "android/video_frame_factory_impl_unittest.cc", |
| ] |
| deps = [ |
| ":common", |
| ":gpu", |
| "//base/test:test_support", |
| "//gpu:test_support", |
| "//media", |
| "//media:test_support", |
| "//testing/gmock", |
| "//testing/gtest", |
| "//ui/gl", |
| "//ui/gl/init", |
| ] |
| } |
| } |
| |
| if (use_v4l2_codec || use_vaapi || is_mac || is_win) { |
| test("video_encode_accelerator_unittest") { |
| deps = [ |
| "test:helpers", |
| "//base", |
| "//base/test:test_support", |
| "//media:test_support", |
| "//media/gpu", |
| "//mojo/core/embedder", |
| "//testing/gtest", |
| "//ui/base", |
| "//ui/gfx", |
| "//ui/gfx:test_support", |
| "//ui/gfx/geometry", |
| "//ui/gl", |
| "//ui/gl:test_support", |
| ] |
| configs += [ "//third_party/libyuv:libyuv_config" ] |
| sources = [ |
| "video_encode_accelerator_unittest.cc", |
| ] |
| if (use_x11) { |
| deps += [ "//ui/gfx/x" ] |
| } |
| if (use_ozone) { |
| deps += [ "//ui/ozone" ] |
| } |
| } |
| } |
| |
| if (use_v4l2_codec || use_vaapi) { |
| test("jpeg_encode_accelerator_unittest") { |
| deps = [ |
| "test:helpers", |
| "//base", |
| "//base/test:test_support", |
| "//media:test_support", |
| "//media/gpu", |
| "//mojo/core/embedder", |
| "//testing/gtest", |
| "//third_party:jpeg", |
| "//third_party/libyuv", |
| "//ui/base", |
| "//ui/gfx", |
| "//ui/gfx:test_support", |
| "//ui/gfx/geometry", |
| "//ui/gl", |
| "//ui/gl:test_support", |
| ] |
| configs += [ "//third_party/libyuv:libyuv_config" ] |
| sources = [ |
| "jpeg_encode_accelerator_unittest.cc", |
| ] |
| if (use_x11) { |
| deps += [ "//ui/gfx/x" ] |
| } |
| if (use_ozone) { |
| deps += [ "//ui/ozone" ] |
| } |
| } |
| } |
| |
| if (is_chromeos || is_linux) { |
| test("jpeg_decode_accelerator_unittest") { |
| deps = [ |
| "test:helpers", |
| "//base", |
| "//media:test_support", |
| "//media/gpu", |
| "//media/mojo/services", |
| "//mojo/core/embedder", |
| "//testing/gtest", |
| "//third_party/libyuv", |
| "//ui/base", |
| "//ui/gfx", |
| "//ui/gfx:test_support", |
| "//ui/gfx/geometry", |
| "//ui/gl", |
| "//ui/gl:test_support", |
| ] |
| configs += [ "//third_party/libyuv:libyuv_config" ] |
| sources = [ |
| "jpeg_decode_accelerator_unittest.cc", |
| ] |
| data = [ |
| "//media/test/data/peach_pi-1280x720.jpg", |
| "//media/test/data/peach_pi-40x23.jpg", |
| "//media/test/data/peach_pi-41x22.jpg", |
| "//media/test/data/peach_pi-41x23.jpg", |
| ] |
| if (use_vaapi) { |
| deps += [ "//media/gpu/vaapi:jpeg_decoder_unit_test" ] |
| data += [ "//media/test/data/pixel-1280x720.jpg" ] |
| } |
| if (use_x11) { |
| deps += [ "//ui/gfx/x" ] |
| } |
| if (use_ozone) { |
| deps += [ "//ui/ozone" ] |
| } |
| } |
| } |
| |
| static_library("test_support") { |
| visibility = [ "//media:test_support" ] |
| testonly = true |
| sources = [ |
| "test/fake_command_buffer_helper.cc", |
| "test/fake_command_buffer_helper.h", |
| ] |
| configs += [ "//media:media_config" ] |
| deps = [ |
| ":gpu", |
| ] |
| public_deps = [ |
| "//base", |
| "//media", |
| ] |
| } |
| |
| source_set("unit_tests") { |
| testonly = true |
| deps = [ |
| "//base", |
| "//base/test:test_support", |
| "//media:test_support", |
| "//media/gpu", |
| "//media/gpu/ipc/service:unit_tests", |
| "//testing/gmock", |
| "//testing/gtest", |
| ] |
| sources = [ |
| "h264_decoder_unittest.cc", |
| ] |
| |
| if (use_vaapi) { |
| deps += [ "//media/gpu/vaapi:unit_test" ] |
| } |
| if (use_v4l2_codec) { |
| deps += [ "//media/gpu/v4l2:unit_test" ] |
| } |
| if (use_v4l2_codec || use_vaapi) { |
| sources += [ "vp8_decoder_unittest.cc" ] |
| } |
| if (is_win && enable_library_cdms) { |
| sources += [ |
| "windows/d3d11_cdm_proxy_unittest.cc", |
| "windows/d3d11_decryptor_unittest.cc", |
| "windows/d3d11_video_decoder_unittest.cc", |
| ] |
| libs = [ "dxguid.lib" ] |
| } |
| } |
| |
| test("video_decode_accelerator_tests") { |
| sources = [ |
| "video_decode_accelerator_tests.cc", |
| ] |
| data = [ |
| "//media/test/data/", |
| ] |
| deps = [ |
| ":buildflags", |
| "test:frame_file_writer", |
| "test:frame_validator", |
| "test:helpers", |
| "test:video_player", |
| "test:video_player_test_environment", |
| "test:video_player_thumbnail_renderer", |
| "//media:test_support", |
| "//testing/gtest", |
| ] |
| } |
| |
| test("video_decode_accelerator_perf_tests") { |
| sources = [ |
| "video_decode_accelerator_perf_tests.cc", |
| ] |
| data = [ |
| "//media/test/data/", |
| ] |
| deps = [ |
| ":buildflags", |
| "test:video_player", |
| "test:video_player_test_environment", |
| "//media:test_support", |
| "//testing/gtest", |
| ] |
| } |
| |
| test("image_processor_test") { |
| sources = [ |
| "image_processor_test.cc", |
| ] |
| deps = [ |
| ":buildflags", |
| ":gpu", |
| "test:frame_validator", |
| "test:helpers", |
| "test:image_processor", |
| "test:render_helpers", |
| "//base/test:test_support", |
| "//media:test_support", |
| "//mojo/core/embedder", |
| "//testing/gtest", |
| ] |
| } |