166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev/*
266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * Copyright (C) 2011 The Android Open Source Project
366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev *
466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * Licensed under the Apache License, Version 2.0 (the "License");
566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * you may not use this file except in compliance with the License.
666ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * You may obtain a copy of the License at
766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev *
866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev *      http://www.apache.org/licenses/LICENSE-2.0
966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev *
1066ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * Unless required by applicable law or agreed to in writing, software
1166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * distributed under the License is distributed on an "AS IS" BASIS,
1266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * See the License for the specific language governing permissions and
1466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev * limitations under the License.
1566ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev */
1666ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev
1766ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev#ifndef SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H
1866ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev#define SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H
1966ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev
209cf80c6b40370c2ae5b7d453a217540663f9f592Mattias Nissler#include <stddef.h>
21e13f15ab55d957976bc66f314c3f58090e903207Alex Ray#include <stdint.h>
22e13f15ab55d957976bc66f314c3f58090e903207Alex Ray
23e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu/*
24e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu * Some of the enums are now defined in HIDL in hardware/interfaces and are
25e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu * generated.
26e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu */
27e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu#include "graphics-base.h"
28e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu
29c9b06951e0349244fdca7401e7bcc54c538dce62Mathias Agopian#ifdef __cplusplus
30c9b06951e0349244fdca7401e7bcc54c538dce62Mathias Agopianextern "C" {
31c9b06951e0349244fdca7401e7bcc54c538dce62Mathias Agopian#endif
3266ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev
33e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu/* for compatibility */
34e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu#define HAL_PIXEL_FORMAT_YCbCr_420_888 HAL_PIXEL_FORMAT_YCBCR_420_888
35e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu#define HAL_PIXEL_FORMAT_YCbCr_422_888 HAL_PIXEL_FORMAT_YCBCR_422_888
36e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu#define HAL_PIXEL_FORMAT_YCbCr_444_888 HAL_PIXEL_FORMAT_YCBCR_444_888
37e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu#define HAL_PIXEL_FORMAT_YCbCr_422_SP HAL_PIXEL_FORMAT_YCBCR_422_SP
38e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu#define HAL_PIXEL_FORMAT_YCrCb_420_SP HAL_PIXEL_FORMAT_YCRCB_420_SP
39e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu#define HAL_PIXEL_FORMAT_YCbCr_422_I HAL_PIXEL_FORMAT_YCBCR_422_I
40e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wutypedef android_pixel_format_t android_pixel_format;
41e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wutypedef android_transform_t android_transform;
42e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wutypedef android_dataspace_t android_dataspace;
43e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wutypedef android_color_mode_t android_color_mode;
44e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wutypedef android_color_transform_t android_color_transform;
45e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wutypedef android_hdr_t android_hdr;
46e4c672a2ad9dfe5913a34840445793633e926520Chia-I Wu
475c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian/*
485c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian * If the HAL needs to create service threads to handle graphics related
495c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian * tasks, these threads need to run at HAL_PRIORITY_URGENT_DISPLAY priority
505c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian * if they can block the main rendering thread in any way.
515c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian *
525c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian * the priority of the current thread can be set with:
535c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian *
545c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian *      #include <sys/resource.h>
555c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian *      setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY);
565c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian *
575c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian */
585c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian
595c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian#define HAL_PRIORITY_URGENT_DISPLAY     (-8)
605c9be402a4d934b678fe6609b6cc4d488d6ddaa4Mathias Agopian
61e13f15ab55d957976bc66f314c3f58090e903207Alex Ray/*
62e13f15ab55d957976bc66f314c3f58090e903207Alex Ray * Structure for describing YCbCr formats for consumption by applications.
63e13f15ab55d957976bc66f314c3f58090e903207Alex Ray * This is used with HAL_PIXEL_FORMAT_YCbCr_*_888.
64e13f15ab55d957976bc66f314c3f58090e903207Alex Ray *
65e13f15ab55d957976bc66f314c3f58090e903207Alex Ray * Buffer chroma subsampling is defined in the format.
66e13f15ab55d957976bc66f314c3f58090e903207Alex Ray * e.g. HAL_PIXEL_FORMAT_YCbCr_420_888 has subsampling 4:2:0.
67e13f15ab55d957976bc66f314c3f58090e903207Alex Ray *
68e13f15ab55d957976bc66f314c3f58090e903207Alex Ray * Buffers must have a 8 bit depth.
69e13f15ab55d957976bc66f314c3f58090e903207Alex Ray *
707c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross * y, cb, and cr point to the first byte of their respective planes.
71e13f15ab55d957976bc66f314c3f58090e903207Alex Ray *
72e13f15ab55d957976bc66f314c3f58090e903207Alex Ray * Stride describes the distance in bytes from the first value of one row of
73e13f15ab55d957976bc66f314c3f58090e903207Alex Ray * the image to the first value of the next row.  It includes the width of the
74e13f15ab55d957976bc66f314c3f58090e903207Alex Ray * image plus padding.
757c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross * ystride is the stride of the luma plane.
767c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross * cstride is the stride of the chroma planes.
77e13f15ab55d957976bc66f314c3f58090e903207Alex Ray *
787c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross * chroma_step is the distance in bytes from one chroma pixel value to the
79e13f15ab55d957976bc66f314c3f58090e903207Alex Ray * next.  This is 2 bytes for semiplanar (because chroma values are interleaved
80e13f15ab55d957976bc66f314c3f58090e903207Alex Ray * and each chroma value is one byte) and 1 for planar.
81e13f15ab55d957976bc66f314c3f58090e903207Alex Ray */
82e13f15ab55d957976bc66f314c3f58090e903207Alex Ray
83e13f15ab55d957976bc66f314c3f58090e903207Alex Raystruct android_ycbcr {
84e13f15ab55d957976bc66f314c3f58090e903207Alex Ray    void *y;
85e13f15ab55d957976bc66f314c3f58090e903207Alex Ray    void *cb;
86e13f15ab55d957976bc66f314c3f58090e903207Alex Ray    void *cr;
87e13f15ab55d957976bc66f314c3f58090e903207Alex Ray    size_t ystride;
88e13f15ab55d957976bc66f314c3f58090e903207Alex Ray    size_t cstride;
89e13f15ab55d957976bc66f314c3f58090e903207Alex Ray    size_t chroma_step;
90e13f15ab55d957976bc66f314c3f58090e903207Alex Ray
91e13f15ab55d957976bc66f314c3f58090e903207Alex Ray    /** reserved for future use, set to 0 by gralloc's (*lock_ycbcr)() */
92e13f15ab55d957976bc66f314c3f58090e903207Alex Ray    uint32_t reserved[8];
93e13f15ab55d957976bc66f314c3f58090e903207Alex Ray};
9466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev
950e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar/*
960e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * Structures for describing flexible YUVA/RGBA formats for consumption by
970e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * applications. Such flexible formats contain a plane for each component (e.g.
980e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * red, green, blue), where each plane is laid out in a grid-like pattern
990e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * occupying unique byte addresses and with consistent byte offsets between
1000e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * neighboring pixels.
1010e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar *
1020e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * The android_flex_layout structure is used with any pixel format that can be
1030e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * represented by it, such as:
1040e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar *  - HAL_PIXEL_FORMAT_YCbCr_*_888
1050e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar *  - HAL_PIXEL_FORMAT_FLEX_RGB*_888
1060e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar *  - HAL_PIXEL_FORMAT_RGB[AX]_888[8],BGRA_8888,RGB_888
1070e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar *  - HAL_PIXEL_FORMAT_YV12,Y8,Y16,YCbCr_422_SP/I,YCrCb_420_SP
1080e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar *  - even implementation defined formats that can be represented by
1090e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar *    the structures
1100e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar *
1110e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * Vertical increment (aka. row increment or stride) describes the distance in
1120e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * bytes from the first pixel of one row to the first pixel of the next row
1130e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * (below) for the component plane. This can be negative.
1140e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar *
1150e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * Horizontal increment (aka. column or pixel increment) describes the distance
1160e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * in bytes from one pixel to the next pixel (to the right) on the same row for
1170e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * the component plane. This can be negative.
1180e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar *
1190e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * Each plane can be subsampled either vertically or horizontally by
1200e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * a power-of-two factor.
1210e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar *
1220e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * The bit-depth of each component can be arbitrary, as long as the pixels are
1230e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * laid out on whole bytes, in native byte-order, using the most significant
1240e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar * bits of each unit.
1250e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar */
1260e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar
1270e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnartypedef enum android_flex_component {
1280e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* luma */
1290e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_COMPONENT_Y = 1 << 0,
1300e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* chroma blue */
1310e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_COMPONENT_Cb = 1 << 1,
1320e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* chroma red */
1330e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_COMPONENT_Cr = 1 << 2,
1340e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar
1350e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* red */
1360e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_COMPONENT_R = 1 << 10,
1370e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* green */
1380e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_COMPONENT_G = 1 << 11,
1390e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* blue */
1400e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_COMPONENT_B = 1 << 12,
1410e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar
1420e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* alpha */
1430e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_COMPONENT_A = 1 << 30,
1440e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar} android_flex_component_t;
1450e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar
1460e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnartypedef struct android_flex_plane {
1470e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* pointer to the first byte of the top-left pixel of the plane. */
1480e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    uint8_t *top_left;
1490e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar
1500e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    android_flex_component_t component;
1510e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar
1520e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* bits allocated for the component in each pixel. Must be a positive
1530e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar       multiple of 8. */
1540e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    int32_t bits_per_component;
1550e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* number of the most significant bits used in the format for this
1560e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar       component. Must be between 1 and bits_per_component, inclusive. */
1570e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    int32_t bits_used;
1580e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar
1590e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* horizontal increment */
1600e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    int32_t h_increment;
1610e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* vertical increment */
1620e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    int32_t v_increment;
1630e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* horizontal subsampling. Must be a positive power of 2. */
1640e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    int32_t h_subsampling;
1650e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* vertical subsampling. Must be a positive power of 2. */
1660e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    int32_t v_subsampling;
1670e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar} android_flex_plane_t;
1680e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar
1690e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnartypedef enum android_flex_format {
1700e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* not a flexible format */
1710e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_FORMAT_INVALID = 0x0,
1720e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_FORMAT_Y = FLEX_COMPONENT_Y,
1730e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_FORMAT_YCbCr = FLEX_COMPONENT_Y | FLEX_COMPONENT_Cb | FLEX_COMPONENT_Cr,
1740e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_FORMAT_YCbCrA = FLEX_FORMAT_YCbCr | FLEX_COMPONENT_A,
1750e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_FORMAT_RGB = FLEX_COMPONENT_R | FLEX_COMPONENT_G | FLEX_COMPONENT_B,
1760e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    FLEX_FORMAT_RGBA = FLEX_FORMAT_RGB | FLEX_COMPONENT_A,
1770e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar} android_flex_format_t;
1780e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar
1790e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnartypedef struct android_flex_layout {
1800e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* the kind of flexible format */
1810e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    android_flex_format_t format;
1820e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar
1830e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* number of planes; 0 for FLEX_FORMAT_INVALID */
1840e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    uint32_t num_planes;
1850e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    /* a plane for each component; ordered in increasing component value order.
1860e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar       E.g. FLEX_FORMAT_RGBA maps 0 -> R, 1 -> G, etc.
1870e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar       Can be NULL for FLEX_FORMAT_INVALID */
1880e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar    android_flex_plane_t *planes;
1890e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar} android_flex_layout_t;
1900e10df4dd6ebd300d8054dbe5016ef1a582995e8Lajos Molnar
19166ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev/**
19203743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala * Structure used to define depth point clouds for format HAL_PIXEL_FORMAT_BLOB
19303743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala * with dataSpace value of HAL_DATASPACE_DEPTH.
19403743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala * When locking a native buffer of the above format and dataSpace value,
19503743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala * the vaddr pointer can be cast to this structure.
19603743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala *
19720651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala * A variable-length list of (x,y,z, confidence) 3D points, as floats.  (x, y,
19820651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala * z) represents a measured point's position, with the coordinate system defined
19920651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala * by the data source.  Confidence represents the estimated likelihood that this
20020651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala * measurement is correct. It is between 0.f and 1.f, inclusive, with 1.f ==
20120651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala * 100% confidence.
20203743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala *
2037c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross * num_points is the number of points in the list
20403743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala *
2057c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross * xyz_points is the flexible array of floating-point values.
20620651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala *   It contains (num_points) * 4 floats.
20703743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala *
20803743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala *   For example:
20903743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala *     android_depth_points d = get_depth_buffer();
21003743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala *     struct {
21120651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala *       float x; float y; float z; float confidence;
21203743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala *     } firstPoint, lastPoint;
21303743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala *
21420651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala *     firstPoint.x = d.xyzc_points[0];
21520651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala *     firstPoint.y = d.xyzc_points[1];
21620651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala *     firstPoint.z = d.xyzc_points[2];
21720651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala *     firstPoint.confidence = d.xyzc_points[3];
21820651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala *     lastPoint.x = d.xyzc_points[(d.num_points - 1) * 4 + 0];
21920651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala *     lastPoint.y = d.xyzc_points[(d.num_points - 1) * 4 + 1];
22020651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala *     lastPoint.z = d.xyzc_points[(d.num_points - 1) * 4 + 2];
22120651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala *     lastPoint.confidence = d.xyzc_points[(d.num_points - 1) * 4 + 3];
22203743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala */
22303743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala
22403743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvalastruct android_depth_points {
22503743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala    uint32_t num_points;
22603743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala
22703743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala    /** reserved for future use, set to 0 by gralloc's (*lock)() */
22803743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala    uint32_t reserved[8];
22903743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala
2307c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross#if defined(__clang__)
2317c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross#pragma clang diagnostic push
2327c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross#pragma clang diagnostic ignored "-Wc99-extensions"
2337c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross#endif
23420651b5c7d73cb7b4fe3cf45b9b322eedd060c28Eino-Ville Talvala    float xyzc_points[];
2357c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross#if defined(__clang__)
2367c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross#pragma clang diagnostic pop
2377c7990e6fdb3cbf7f3ce2cf220767ba5fa5e18c7Colin Cross#endif
23803743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala};
23903743414cb1651c9bcbc80de9edb0efca33f86b8Eino-Ville Talvala
240cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter/**
241cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter  * These structures are used to define the reference display's
242cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter  * capabilities for HDR content. Display engine can use this
243cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter  * to better tone map content to user's display.
244cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter  * Color is defined in CIE XYZ coordinates
245cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter  */
246cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchterstruct android_xy_color {
247cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter    float x;
248cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter    float y;
249cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter};
250cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter
251cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchterstruct android_smpte2086_metadata {
252cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter    struct android_xy_color displayPrimaryRed;
253cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter    struct android_xy_color displayPrimaryGreen;
254cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter    struct android_xy_color displayPrimaryBlue;
255cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter    struct android_xy_color whitePoint;
256cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter    float maxLuminance;
257cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter    float minLuminance;
258cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter};
259cae676769800b5aab71244b16eedf15f9c8aaa44Courtney Goeltzenleuchter
260c9b06951e0349244fdca7401e7bcc54c538dce62Mathias Agopian#ifdef __cplusplus
261c9b06951e0349244fdca7401e7bcc54c538dce62Mathias Agopian}
262c9b06951e0349244fdca7401e7bcc54c538dce62Mathias Agopian#endif
26366ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev
26466ea3574b6383e4107c74a192cadda1427320375Iliyan Malchev#endif /* SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H */
265