// 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 "gpu/ipc/common/mailbox.mojom";
import "gpu/ipc/common/sync_token.mojom";
import "gpu/ipc/common/vulkan_ycbcr_info.mojom";
import "services/viz/public/mojom/compositing/shared_image_format.mojom";
import "services/viz/public/mojom/compositing/resource_id.mojom";
import "services/viz/public/mojom/compositing/shared_bitmap_id.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gfx/mojom/color_space.mojom";
import "ui/gfx/mojom/hdr_metadata.mojom";
// See viz::TransferableResource::SynchronizationType in
// components/viz/common/resources/transferable_resource.h
enum SynchronizationType {
kSyncToken,
kGpuCommandsCompleted,
kReleaseFence,
};
// See components/viz/common/resources/transferable_resource.h.
union MemoryBufferId {
gpu.mojom.Mailbox mailbox;
SharedBitmapId shared_bitmap_id;
};
// Represents a visual resource (e.g., image, video frame) that can be
// transferred between processes for rendering and compositing within Chromium's
// Viz display system. Encapsulates the resource's data, format, and metadata
// necessary for efficient display and manipulation by the compositor.
//
// See components/viz/common/resources/transferable_resource.h for more details.
struct TransferableResource {
ResourceId id;
SharedImageFormat format;
gfx.mojom.Size size;
MemoryBufferId memory_buffer_id;
gpu.mojom.SyncToken sync_token;
uint32 texture_target;
SynchronizationType synchronization_type;
bool is_software;
bool is_overlay_candidate;
[EnableIf=is_android]
bool is_backed_by_surface_texture;
bool wants_promotion_hint;
gfx.mojom.ColorSpace color_space;
gfx.mojom.HDRMetadata hdr_metadata;
bool needs_detiling;
gpu.mojom.VulkanYCbCrInfo? ycbcr_info;
};