chromium/services/viz/public/mojom/compositing/copy_output_result.mojom

// 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.

module viz.mojom;

import "gpu/ipc/common/mailbox.mojom";
import "services/viz/public/mojom/compositing/bitmap_in_shared_memory.mojom";
import "services/viz/public/mojom/compositing/texture_releaser.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gfx/mojom/color_space.mojom";

// See components/viz/common/frame_sinks/copy_output_result.h.
// Only the RGBA format is supported for cross-process requests.
// CopyOutputRequests with other formats are issued internally to viz/.
enum CopyOutputResultFormat {
  RGBA,
};

// See components/viz/common/frame_sinks/copy_output_result.h.
enum CopyOutputResultDestination {
  kSystemMemory,
  kNativeTextures,
};

// See components/viz/common/frame_sinks/copy_output_result.h.
struct CopyOutputResult {
  CopyOutputResultFormat format;
  CopyOutputResultDestination destination;
  gfx.mojom.Rect rect;

  // Present when the destination is kSystemMemory.
  BitmapInSharedMemory? bitmap;

  // Present when the destination is kNativeTextures.
  // If the result is empty, then the |mailbox| will be present but empty.
  gpu.mojom.Mailbox? mailbox;
  gfx.mojom.ColorSpace? color_space;
  // Present when the destination is kNativeTextures and |mailbox| is non-empty.
  pending_remote<TextureReleaser>? releaser;
};