blob: 9f9d04d25d07d60598d035548e912061e4f64e1b [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.sysmem;
// Describes how an image is represented.
// TODO(ZX-2260): change struct to table
struct ImageFormat {
// Row width in pixels.
uint32 width;
// Number of rows.
uint32 height;
// Number of layers within a multi-layered image.
// Defaults to 1 if not specified.
uint32 layers;
// Pixel format.
PixelFormat pixel_format;
// Color space.
ColorSpace color_space;
array<ImagePlane>:4 planes;
};
struct ImagePlane {
// Byte offset of the start of the plane from the beginning of the image.
uint32 byte_offset;
// Stride in bytes per row.
// Only meaningful for linear buffer formats.
uint32 bytes_per_row;
};
// Describes constraints for allocating images of some desired form.
// TODO(ZX-2260): change struct to table
struct ImageSpec {
// Minimum width in pixels.
uint32 min_width;
// Minimum height in pixels.
uint32 min_height;
// Number of layers within a multi-layered image.
// Defaults to 1 if not specified.
uint32 layers = 1;
// Pixel format.
PixelFormat pixel_format;
// Color space.
ColorSpace color_space;
// TODO(ZX-2270): Add tiling formats.
};
// Describes how the pixels within an image are represented.
// Simple formats need only a type.
// Parametric pixel formats may require additional properties.
// TODO(ZX-2260): change struct to table
struct PixelFormat {
PixelFormatType type;
};
// TODO(ZX-2270): add more formats.
// The ordering of the channels in the format name reflects how
// the actual layout of the channel.
enum PixelFormatType {
INVALID = 0;
R8G8B8A8 = 1;
BGRA32 = 101; // 32bpp BGRA, 1 plane. For UVC compliance.
I420 = 102; // For UVC compliance.
M420 = 103; // For UVC compliance.
NV12 = 104; // For UVC compliance.
YUY2 = 105; // For UVC compliance.
MJPEG = 106; // For UVC compliance.
};
// Describes how the pixels within an image are meant to be presented.
// Simple color spaces need only a type.
// Parametric color spaces may require additional properties.
// TODO(ZX-2260): change struct to table
struct ColorSpace {
ColorSpaceType type;
};
enum ColorSpaceType {
SRGB = 1;
REC601_NTSC = 2;
REC601_NTSC_FULL_RANGE = 3;
REC601_PAL = 4;
REC601_PAL_FULL_RANGE = 5;
REC709 = 6;
REC2020 = 7;
REC2100 = 8;
};