# Copyright 2014 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/linux/pkg_config.gni")
import("//ui/ozone/ozone.gni")
import("//gpu/vulkan/features.gni")

visibility = [ "//ui/ozone/*" ]

source_set("gbm") {
  sources = [
    "client_native_pixmap_factory_gbm.cc",
    "client_native_pixmap_factory_gbm.h",
    "common/display_types.h",
    "common/drm_util.cc",
    "common/drm_util.h",
    "common/scoped_drm_types.cc",
    "common/scoped_drm_types.h",
    "gpu/crtc_controller.cc",
    "gpu/crtc_controller.h",
    "gpu/drm_buffer.cc",
    "gpu/drm_buffer.h",
    "gpu/drm_console_buffer.cc",
    "gpu/drm_console_buffer.h",
    "gpu/drm_device.cc",
    "gpu/drm_device.h",
    "gpu/drm_device_generator.cc",
    "gpu/drm_device_generator.h",
    "gpu/drm_device_manager.cc",
    "gpu/drm_device_manager.h",
    "gpu/drm_display.cc",
    "gpu/drm_display.h",
    "gpu/drm_gpu_display_manager.cc",
    "gpu/drm_gpu_display_manager.h",
    "gpu/drm_gpu_util.cc",
    "gpu/drm_gpu_util.h",
    "gpu/drm_overlay_plane.cc",
    "gpu/drm_overlay_plane.h",
    "gpu/drm_overlay_validator.cc",
    "gpu/drm_overlay_validator.h",
    "gpu/drm_thread.cc",
    "gpu/drm_thread.h",
    "gpu/drm_thread_message_proxy.cc",
    "gpu/drm_thread_message_proxy.h",
    "gpu/drm_thread_proxy.cc",
    "gpu/drm_thread_proxy.h",
    "gpu/drm_vsync_provider.cc",
    "gpu/drm_vsync_provider.h",
    "gpu/drm_window.cc",
    "gpu/drm_window.h",
    "gpu/drm_window_proxy.cc",
    "gpu/drm_window_proxy.h",
    "gpu/gbm_buffer.cc",
    "gpu/gbm_buffer.h",
    "gpu/gbm_device.cc",
    "gpu/gbm_device.h",
    "gpu/gbm_overlay_surface.cc",
    "gpu/gbm_overlay_surface.h",
    "gpu/gbm_surface.cc",
    "gpu/gbm_surface.h",
    "gpu/gbm_surface_factory.cc",
    "gpu/gbm_surface_factory.h",
    "gpu/gbm_surfaceless.cc",
    "gpu/gbm_surfaceless.h",
    "gpu/hardware_display_controller.cc",
    "gpu/hardware_display_controller.h",
    "gpu/hardware_display_plane.cc",
    "gpu/hardware_display_plane.h",
    "gpu/hardware_display_plane_atomic.cc",
    "gpu/hardware_display_plane_atomic.h",
    "gpu/hardware_display_plane_dummy.cc",
    "gpu/hardware_display_plane_dummy.h",
    "gpu/hardware_display_plane_manager.cc",
    "gpu/hardware_display_plane_manager.h",
    "gpu/hardware_display_plane_manager_atomic.cc",
    "gpu/hardware_display_plane_manager_atomic.h",
    "gpu/hardware_display_plane_manager_legacy.cc",
    "gpu/hardware_display_plane_manager_legacy.h",
    "gpu/inter_thread_messaging_proxy.cc",
    "gpu/inter_thread_messaging_proxy.h",
    "gpu/page_flip_request.cc",
    "gpu/page_flip_request.h",
    "gpu/proxy_helpers.cc",
    "gpu/proxy_helpers.h",
    "gpu/scanout_buffer.h",
    "gpu/scanout_buffer_generator.h",
    "gpu/screen_manager.cc",
    "gpu/screen_manager.h",
    "host/drm_cursor.cc",
    "host/drm_cursor.h",
    "host/drm_device_connector.cc",
    "host/drm_device_connector.h",
    "host/drm_device_handle.cc",
    "host/drm_device_handle.h",
    "host/drm_display_host.cc",
    "host/drm_display_host.h",
    "host/drm_display_host_manager.cc",
    "host/drm_display_host_manager.h",
    "host/drm_gpu_platform_support_host.cc",
    "host/drm_gpu_platform_support_host.h",
    "host/drm_native_display_delegate.cc",
    "host/drm_native_display_delegate.h",
    "host/drm_overlay_candidates_host.cc",
    "host/drm_overlay_candidates_host.h",
    "host/drm_overlay_manager.cc",
    "host/drm_overlay_manager.h",
    "host/drm_window_host.cc",
    "host/drm_window_host.h",
    "host/drm_window_host_manager.cc",
    "host/drm_window_host_manager.h",
    "host/gpu_thread_adapter.h",
    "host/gpu_thread_observer.h",
    "host/host_cursor_proxy.cc",
    "host/host_cursor_proxy.h",
    "host/host_drm_device.cc",
    "host/host_drm_device.h",
    "ozone_platform_gbm.cc",
    "ozone_platform_gbm.h",
  ]

  deps = [
    "//base",
    "//gpu/vulkan:buildflags",
    "//ipc",
    "//mojo/public/cpp/system",
    "//services/service_manager/public/cpp",
    "//services/ui/public/interfaces:constants",
    "//skia",
    "//third_party/libdrm",
    "//third_party/libsync",
    "//third_party/minigbm",
    "//ui/base",
    "//ui/display",
    "//ui/display/types",
    "//ui/display/util",
    "//ui/events",
    "//ui/events/devices",
    "//ui/events/ozone:events_ozone",
    "//ui/events/ozone:events_ozone_evdev",
    "//ui/events/ozone:events_ozone_layout",
    "//ui/events/platform",
    "//ui/gfx",
    "//ui/gfx/geometry",
    "//ui/gl",
    "//ui/ozone:ozone_base",
    "//ui/ozone/common",
    "//ui/ozone/common/linux",
    "//ui/ozone/public/interfaces",
    "//ui/platform_window",
  ]

  if (enable_vulkan) {
    sources += [
      "gpu/vulkan_implementation_gbm.cc",
      "gpu/vulkan_implementation_gbm.h",
    ]
    deps += [ "//gpu/vulkan" ]
  }

  public_configs = [ "//third_party/khronos:khronos_headers" ]

  defines = [ "OZONE_IMPLEMENTATION" ]
}

source_set("gbm_unittests") {
  testonly = true
  sources = [
    "common/drm_util_unittest.cc",
    "gpu/drm_overlay_validator_unittest.cc",
    "gpu/drm_window_unittest.cc",
    "gpu/hardware_display_controller_unittest.cc",
    "gpu/hardware_display_plane_manager_unittest.cc",
    "gpu/mock_drm_device.cc",
    "gpu/mock_drm_device.h",
    "gpu/mock_dumb_buffer_generator.cc",
    "gpu/mock_dumb_buffer_generator.h",
    "gpu/mock_scanout_buffer.cc",
    "gpu/mock_scanout_buffer.h",
    "gpu/mock_scanout_buffer_generator.cc",
    "gpu/mock_scanout_buffer_generator.h",
    "gpu/proxy_helpers_unittest.cc",
    "gpu/screen_manager_unittest.cc",
  ]

  deps = [
    ":gbm",
    "//base/test:test_support",
    "//skia",
    "//testing/gtest",
    "//third_party/libdrm",
    "//ui/gfx",
    "//ui/ozone:platform",
    "//ui/ozone/common",
    "//ui/ozone/common/linux",
  ]
}
