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

// Copyright 2022 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 "services/viz/public/mojom/compositing/internal/singleplanar_format.mojom";

// See PlaneConfig in components/viz/common/resources/shared_image_format.h
enum PlaneConfig { kY_U_V, kY_V_U, kY_UV, kY_UV_A, kY_U_V_A };

// See Subsampling in components/viz/common/resources/shared_image_format.h
enum Subsampling { k420, k422, k444 };

// See ChannelFormat in components/viz/common/resources/shared_image_format.h
enum ChannelFormat { k8, k10, k16, k16F };

// A struct for multiplanar format that is defined by the PlaneConfig,
// Subsampling and ChannelFormat it holds. This corresponds to an inner struct
// of viz::SharedImageFormat so it's not intended to be used external.
struct MultiplanarFormat {
  PlaneConfig plane_config;
  Subsampling subsampling;
  ChannelFormat channel_format;

  [EnableIf=use_ozone]
  bool prefers_external_sampler;
};

// Corresponds to viz::SharedImageFormat. It can only be SingleplanarFormat or
// MultiplanarFormat at any given time.
union SharedImageFormat {
  SingleplanarFormat singleplanar_format;
  MultiplanarFormat multiplanar_format;
};