chromium/services/viz/privileged/mojom/viz_main.mojom

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module viz.mojom;

import "components/discardable_memory/public/mojom/discardable_shared_memory_manager.mojom";
import "components/viz/service/debugger/mojom/viz_debugger.mojom";
import "mojo/public/mojom/base/values.mojom";
import "mojo/public/mojom/base/shared_memory.mojom";
import "services/viz/public/mojom/compositing/compositing_mode_watcher.mojom";
import "services/viz/privileged/mojom/compositing/frame_sink_manager.mojom";
import "services/viz/privileged/mojom/compositing/renderer_settings.mojom";
import "services/viz/privileged/mojom/gl/gpu_host.mojom";
[EnableIf=is_win]
import "services/viz/privileged/mojom/gl/info_collection_gpu_service.mojom";
import "services/viz/privileged/mojom/gl/gpu_service.mojom";
import "ui/gfx/mojom/font_render_params.mojom";

struct FrameSinkManagerParams {
  // An id that changes for each viz process restart.
  uint32 restart_id;

  // Indicates whether CompositorFrames should activate after the deadline
  // below passes.
  bool use_activation_deadline = true;

  // Default number of frames to CompositorFrame activation deadline.
  uint32 activation_deadline_in_frames = 4;

  // Host to viz interface.
  pending_receiver<FrameSinkManager> frame_sink_manager;

  // Viz to host interface.
  pending_remote<FrameSinkManagerClient> frame_sink_manager_client;

  DebugRendererSettings debug_renderer_settings;
};

// This is the primordial interface used to (re)start the viz services.
interface VizMain {
  CreateFrameSinkManager(FrameSinkManagerParams params);

  CreateGpuService(
      pending_receiver<GpuService> gpu_service,
      pending_remote<GpuHost> gpu_host,
      pending_remote<discardable_memory.mojom.DiscardableSharedMemoryManager>
          discardable_memory_manager,
      mojo_base.mojom.UnsafeSharedMemoryRegion? use_shader_cache_shm_count);

  // Sets parameters necessary for rendering.
  SetRenderParams(
      gfx.mojom.SubpixelRendering subpixel_rendering,
      float text_contrast,
      float text_gamma);

  // Create a GPU info collection service provided by the info-collection GPU
  // process.
  [EnableIf=is_win]
  CreateInfoCollectionGpuService(
      pending_receiver<InfoCollectionGpuService> info_collection_gpu_service);

  // Pass the process ID of the browser process to the viz process. Used for
  // Android performance hinting.
  [EnableIf=is_android]
  SetHostProcessId(int32 pid);

  // Initiates the devtools enabled stream connection for the Viz Debugger.
  // This is only called if the flag --enable-viz-devtools is used.
  [EnableIf=use_viz_debugger]
  StartDebugStream(pending_remote<VizDebugOutput> viz_debug);

  // Sends debug filtering information to the active Viz Debugger instance.
  // This is only called if the flag --enable-viz-devtools is used.
  [EnableIf=use_viz_debugger]
  FilterDebugStream(mojo_base.mojom.DictionaryValue filterData);

  // Ends the Viz debugging session. This is only called if the flag
  // --enable-viz-devtools is used.
  [EnableIf=use_viz_debugger]
  StopDebugStream();
};