1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef GPU_IPC_COMMON_VULKAN_YCBCR_INFO_H_
6 #define GPU_IPC_COMMON_VULKAN_YCBCR_INFO_H_
7 
8 #include <stdint.h>
9 #include "gpu/gpu_export.h"
10 
11 namespace gpu {
12 
13 // Sampler Ycbcr conversion information.
14 struct GPU_EXPORT VulkanYCbCrInfo {
15   VulkanYCbCrInfo();
16   VulkanYCbCrInfo(uint32_t image_format,
17                   uint64_t external_format,
18                   uint32_t suggested_ycbcr_model,
19                   uint32_t suggested_ycbcr_range,
20                   uint32_t suggested_xchroma_offset,
21                   uint32_t suggested_ychroma_offset,
22                   uint32_t format_features);
23 
24   // Source image format.
25   // Corresponds to vulkan type: VkFormat.
26   uint32_t image_format;
27 
28   // Implementation-defined external format identifier for use with
29   // VkExternalFormatANDROID.
30   // This property is driver specific.
31   uint64_t external_format;
32 
33   // Describes the color matrix for conversion between color models.
34   // Corresponds to vulkan type: VkSamplerYcbcrModelConversion.
35   uint32_t suggested_ycbcr_model;
36 
37   // Describes whether the encoded values have headroom and foot room, or
38   // whether the encoding uses the full numerical range.
39   // Corresponds to vulkan type: VkSamplerYcbcrRange.
40   uint32_t suggested_ycbcr_range;
41 
42   // Describes the sample location associated with downsampled chroma channels
43   // in the x dimension. It has no effect for formats in which chroma channels
44   // are the same resolution as the luma channel.
45   // Corresponds to vulkan type: VkChromaLocation.
46   uint32_t suggested_xchroma_offset;
47 
48   // Describes the sample location associated with downsampled chroma channels
49   // in the y dimension. It has no effect for formats in which chroma channels
50   // are not downsampled vertically.
51   // Corresponds to vulkan type: VkChromaLocation.
52   uint32_t suggested_ychroma_offset;
53 
54   // Describes the capabilities of the format when used with an image bound to
55   // memory imported from buffer. Must be set when for external-format image
56   // created from the Android hardware buffer. For regular (not external) images
57   // it can be set 0. Corresponds to Vulkan type: VkFormatFeatureFlags.
58   uint32_t format_features;
59 };
60 
61 }  // namespace gpu
62 
63 #endif  // GPU_IPC_COMMON_VULKAN_YCBCR_INFO_H_
64