mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
android_stub: sync Android 16 headers
Acked-by: Valentine Burley <valentine.burley@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41373>
This commit is contained in:
parent
4193314295
commit
d15e1fd108
10 changed files with 1007 additions and 215 deletions
|
|
@ -14,6 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup ADataSpace Data Space
|
||||
*
|
||||
* ADataSpace describes how to interpret colors.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file data_space.h
|
||||
*/
|
||||
|
|
@ -22,6 +29,7 @@
|
|||
#define ANDROID_DATA_SPACE_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
|
|
@ -30,7 +38,7 @@ __BEGIN_DECLS
|
|||
/**
|
||||
* ADataSpace.
|
||||
*/
|
||||
enum ADataSpace {
|
||||
enum ADataSpace : int32_t {
|
||||
/**
|
||||
* Default-assumption data space, when not explicitly specified.
|
||||
*
|
||||
|
|
@ -43,21 +51,371 @@ enum ADataSpace {
|
|||
ADATASPACE_UNKNOWN = 0,
|
||||
|
||||
/**
|
||||
* scRGB linear encoding:
|
||||
* Color-description aspects
|
||||
*
|
||||
* The following aspects define various characteristics of the color
|
||||
* specification. These represent bitfields, so that a data space value
|
||||
* can specify each of them independently.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Standard aspect
|
||||
*
|
||||
* Defines the chromaticity coordinates of the source primaries in terms of
|
||||
* the CIE 1931 definition of x and y specified in ISO 11664-1.
|
||||
*/
|
||||
ADATASPACE_STANDARD_MASK = 63 << 16,
|
||||
|
||||
/**
|
||||
* Chromacity coordinates are unknown or are determined by the application.
|
||||
* Implementations shall use the following suggested standards:
|
||||
*
|
||||
* All YCbCr formats: BT709 if size is 720p or larger (since most video
|
||||
* content is letterboxed this corresponds to width is
|
||||
* 1280 or greater, or height is 720 or greater).
|
||||
* BT601_625 if size is smaller than 720p or is JPEG.
|
||||
* All RGB formats: BT709.
|
||||
*
|
||||
* For all other formats standard is undefined, and implementations should use
|
||||
* an appropriate standard for the data represented.
|
||||
*/
|
||||
ADATASPACE_STANDARD_UNSPECIFIED = 0 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.300 0.600
|
||||
* blue 0.150 0.060
|
||||
* red 0.640 0.330
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.2126, KB = 0.0722 luminance interpretation
|
||||
* for RGB conversion.
|
||||
*/
|
||||
ADATASPACE_STANDARD_BT709 = 1 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.290 0.600
|
||||
* blue 0.150 0.060
|
||||
* red 0.640 0.330
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* KR = 0.299, KB = 0.114. This adjusts the luminance interpretation
|
||||
* for RGB conversion from the one purely determined by the primaries
|
||||
* to minimize the color shift into RGB space that uses BT.709
|
||||
* primaries.
|
||||
*/
|
||||
ADATASPACE_STANDARD_BT601_625 = 2 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.290 0.600
|
||||
* blue 0.150 0.060
|
||||
* red 0.640 0.330
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.222, KB = 0.071 luminance interpretation
|
||||
* for RGB conversion.
|
||||
*/
|
||||
ADATASPACE_STANDARD_BT601_625_UNADJUSTED = 3 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.310 0.595
|
||||
* blue 0.155 0.070
|
||||
* red 0.630 0.340
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* KR = 0.299, KB = 0.114. This adjusts the luminance interpretation
|
||||
* for RGB conversion from the one purely determined by the primaries
|
||||
* to minimize the color shift into RGB space that uses BT.709
|
||||
* primaries.
|
||||
*/
|
||||
ADATASPACE_STANDARD_BT601_525 = 4 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.310 0.595
|
||||
* blue 0.155 0.070
|
||||
* red 0.630 0.340
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.212, KB = 0.087 luminance interpretation
|
||||
* for RGB conversion (as in SMPTE 240M).
|
||||
*/
|
||||
ADATASPACE_STANDARD_BT601_525_UNADJUSTED = 5 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.170 0.797
|
||||
* blue 0.131 0.046
|
||||
* red 0.708 0.292
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.2627, KB = 0.0593 luminance interpretation
|
||||
* for RGB conversion.
|
||||
*/
|
||||
ADATASPACE_STANDARD_BT2020 = 6 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.170 0.797
|
||||
* blue 0.131 0.046
|
||||
* red 0.708 0.292
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.2627, KB = 0.0593 luminance interpretation
|
||||
* for RGB conversion using the linear domain.
|
||||
*/
|
||||
ADATASPACE_STANDARD_BT2020_CONSTANT_LUMINANCE = 7 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.21 0.71
|
||||
* blue 0.14 0.08
|
||||
* red 0.67 0.33
|
||||
* white (C) 0.310 0.316</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.30, KB = 0.11 luminance interpretation
|
||||
* for RGB conversion.
|
||||
*/
|
||||
ADATASPACE_STANDARD_BT470M = 8 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.243 0.692
|
||||
* blue 0.145 0.049
|
||||
* red 0.681 0.319
|
||||
* white (C) 0.310 0.316</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.254, KB = 0.068 luminance interpretation
|
||||
* for RGB conversion.
|
||||
*/
|
||||
ADATASPACE_STANDARD_FILM = 9 << 16,
|
||||
|
||||
/**
|
||||
* SMPTE EG 432-1 and SMPTE RP 431-2. (DCI-P3)
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.265 0.690
|
||||
* blue 0.150 0.060
|
||||
* red 0.680 0.320
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*/
|
||||
ADATASPACE_STANDARD_DCI_P3 = 10 << 16,
|
||||
|
||||
/**
|
||||
* Adobe RGB
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.210 0.710
|
||||
* blue 0.150 0.060
|
||||
* red 0.640 0.330
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*/
|
||||
ADATASPACE_STANDARD_ADOBE_RGB = 11 << 16,
|
||||
|
||||
/**
|
||||
* Transfer aspect
|
||||
*
|
||||
* Transfer characteristics are the opto-electronic transfer characteristic
|
||||
* at the source as a function of linear optical intensity (luminance).
|
||||
*
|
||||
* For digital signals, E corresponds to the recorded value. Normally, the
|
||||
* transfer function is applied in RGB space to each of the R, G and B
|
||||
* components independently. This may result in color shift that can be
|
||||
* minized by applying the transfer function in Lab space only for the L
|
||||
* component. Implementation may apply the transfer function in RGB space
|
||||
* for all pixel formats if desired.
|
||||
*/
|
||||
ADATASPACE_TRANSFER_MASK = 31 << 22,
|
||||
|
||||
/**
|
||||
* Transfer characteristics are unknown or are determined by the
|
||||
* application.
|
||||
*
|
||||
* Implementations should use the following transfer functions:
|
||||
*
|
||||
* For YCbCr formats: use ADATASPACE_TRANSFER_SMPTE_170M
|
||||
* For RGB formats: use ADATASPACE_TRANSFER_SRGB
|
||||
*
|
||||
* For all other formats transfer function is undefined, and implementations
|
||||
* should use an appropriate standard for the data represented.
|
||||
*/
|
||||
ADATASPACE_TRANSFER_UNSPECIFIED = 0 << 22,
|
||||
|
||||
/**
|
||||
* Linear transfer.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = L
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
ADATASPACE_TRANSFER_LINEAR = 1 << 22,
|
||||
|
||||
/**
|
||||
* sRGB transfer.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = 1.055 * L^(1/2.4) - 0.055 for 0.0031308 <= L <= 1
|
||||
* = 12.92 * L for 0 <= L < 0.0031308
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
ADATASPACE_TRANSFER_SRGB = 2 << 22,
|
||||
|
||||
/**
|
||||
* SMPTE 170M transfer.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = 1.099 * L ^ 0.45 - 0.099 for 0.018 <= L <= 1
|
||||
* = 4.500 * L for 0 <= L < 0.018
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
ADATASPACE_TRANSFER_SMPTE_170M = 3 << 22,
|
||||
|
||||
/**
|
||||
* Display gamma 2.2.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = L ^ (1/2.2)
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
ADATASPACE_TRANSFER_GAMMA2_2 = 4 << 22,
|
||||
|
||||
/**
|
||||
* Display gamma 2.6.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = L ^ (1/2.6)
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
ADATASPACE_TRANSFER_GAMMA2_6 = 5 << 22,
|
||||
|
||||
/**
|
||||
* Display gamma 2.8.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = L ^ (1/2.8)
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
ADATASPACE_TRANSFER_GAMMA2_8 = 6 << 22,
|
||||
|
||||
/**
|
||||
* SMPTE ST 2084 (Dolby Perceptual Quantizer).
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = ((c1 + c2 * L^n) / (1 + c3 * L^n)) ^ m
|
||||
* c1 = c3 - c2 + 1 = 3424 / 4096 = 0.8359375
|
||||
* c2 = 32 * 2413 / 4096 = 18.8515625
|
||||
* c3 = 32 * 2392 / 4096 = 18.6875
|
||||
* m = 128 * 2523 / 4096 = 78.84375
|
||||
* n = 0.25 * 2610 / 4096 = 0.1593017578125
|
||||
* L - luminance of image 0 <= L <= 1 for HDR colorimetry.
|
||||
* L = 1 corresponds to 10000 cd/m2
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
ADATASPACE_TRANSFER_ST2084 = 7 << 22,
|
||||
|
||||
/**
|
||||
* ARIB STD-B67 Hybrid Log Gamma.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = r * L^0.5 for 0 <= L <= 1
|
||||
* = a * ln(L - b) + c for 1 < L
|
||||
* a = 0.17883277
|
||||
* b = 0.28466892
|
||||
* c = 0.55991073
|
||||
* r = 0.5
|
||||
* L - luminance of image 0 <= L for HDR colorimetry. L = 1 corresponds
|
||||
* to reference white level of 100 cd/m2
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
ADATASPACE_TRANSFER_HLG = 8 << 22,
|
||||
|
||||
/**
|
||||
* Range aspect
|
||||
*
|
||||
* Defines the range of values corresponding to the unit range of 0-1.
|
||||
* This is defined for YCbCr only, but can be expanded to RGB space.
|
||||
*/
|
||||
ADATASPACE_RANGE_MASK = 7 << 27,
|
||||
|
||||
/**
|
||||
* Range is unknown or are determined by the application. Implementations
|
||||
* shall use the following suggested ranges:
|
||||
*
|
||||
* All YCbCr formats: limited range.
|
||||
* All RGB or RGBA formats (including RAW and Bayer): full range.
|
||||
* All Y formats: full range
|
||||
*
|
||||
* For all other formats range is undefined, and implementations should use
|
||||
* an appropriate range for the data represented.
|
||||
*/
|
||||
ADATASPACE_RANGE_UNSPECIFIED = 0 << 27,
|
||||
|
||||
/**
|
||||
* Full range uses all values for Y, Cb and Cr from
|
||||
* 0 to 2^b-1, where b is the bit depth of the color format.
|
||||
*/
|
||||
ADATASPACE_RANGE_FULL = 1 << 27,
|
||||
|
||||
/**
|
||||
* Limited range uses values 16/256*2^b to 235/256*2^b for Y, and
|
||||
* 1/16*2^b to 15/16*2^b for Cb, Cr, R, G and B, where b is the bit depth of
|
||||
* the color format.
|
||||
*
|
||||
* E.g. For 8-bit-depth formats:
|
||||
* Luma (Y) samples should range from 16 to 235, inclusive
|
||||
* Chroma (Cb, Cr) samples should range from 16 to 240, inclusive
|
||||
*
|
||||
* For 10-bit-depth formats:
|
||||
* Luma (Y) samples should range from 64 to 940, inclusive
|
||||
* Chroma (Cb, Cr) samples should range from 64 to 960, inclusive
|
||||
*/
|
||||
ADATASPACE_RANGE_LIMITED = 2 << 27,
|
||||
|
||||
/**
|
||||
* Extended range is used for scRGB. Intended for use with
|
||||
* floating point pixel formats. [0.0 - 1.0] is the standard
|
||||
* sRGB space. Values outside the range 0.0 - 1.0 can encode
|
||||
* color outside the sRGB gamut.
|
||||
* Used to blend / merge multiple dataspaces on a single display.
|
||||
*/
|
||||
ADATASPACE_RANGE_EXTENDED = 3 << 27,
|
||||
|
||||
/**
|
||||
* scRGB linear encoding
|
||||
*
|
||||
* The red, green, and blue components are stored in extended sRGB space,
|
||||
* but are linear, not gamma-encoded.
|
||||
* The RGB primaries and the white point are the same as BT.709.
|
||||
*
|
||||
* The values are floating point.
|
||||
* A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits.
|
||||
* Values beyond the range [0.0 - 1.0] would correspond to other colors
|
||||
* spaces and/or HDR content.
|
||||
*
|
||||
* Uses extended range, linear transfer and BT.709 standard.
|
||||
*/
|
||||
ADATASPACE_SCRGB_LINEAR = 406913024, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_EXTENDED
|
||||
ADATASPACE_SCRGB_LINEAR = 406913024, // ADATASPACE_STANDARD_BT709 | ADATASPACE_TRANSFER_LINEAR |
|
||||
// ADATASPACE_RANGE_EXTENDED
|
||||
|
||||
/**
|
||||
* sRGB gamma encoding:
|
||||
* sRGB gamma encoding
|
||||
*
|
||||
* The red, green and blue components are stored in sRGB space, and
|
||||
* converted to linear space when read, using the SRGB transfer function
|
||||
|
|
@ -67,81 +425,131 @@ enum ADataSpace {
|
|||
* The alpha component, if present, is always stored in linear space and
|
||||
* is left unmodified when read or written.
|
||||
*
|
||||
* Use full range and BT.709 standard.
|
||||
* Uses full range, sRGB transfer BT.709 standard.
|
||||
*/
|
||||
ADATASPACE_SRGB = 142671872, // STANDARD_BT709 | TRANSFER_SRGB | RANGE_FULL
|
||||
ADATASPACE_SRGB = 142671872, // ADATASPACE_STANDARD_BT709 | ADATASPACE_TRANSFER_SRGB |
|
||||
// ADATASPACE_RANGE_FULL
|
||||
|
||||
/**
|
||||
* scRGB:
|
||||
* scRGB
|
||||
*
|
||||
* The red, green, and blue components are stored in extended sRGB space,
|
||||
* and gamma-encoded using the SRGB transfer function.
|
||||
* The RGB primaries and the white point are the same as BT.709.
|
||||
*
|
||||
* The values are floating point.
|
||||
* A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits.
|
||||
* Values beyond the range [0.0 - 1.0] would correspond to other colors
|
||||
* spaces and/or HDR content.
|
||||
*
|
||||
* Uses extended range, sRGB transfer and BT.709 standard.
|
||||
*/
|
||||
ADATASPACE_SCRGB = 411107328, // STANDARD_BT709 | TRANSFER_SRGB | RANGE_EXTENDED
|
||||
ADATASPACE_SCRGB = 411107328, // ADATASPACE_STANDARD_BT709 | ADATASPACE_TRANSFER_SRGB |
|
||||
// ADATASPACE_RANGE_EXTENDED
|
||||
|
||||
/**
|
||||
* Display P3
|
||||
*
|
||||
* Use same primaries and white-point as DCI-P3
|
||||
* but sRGB transfer function.
|
||||
* Uses full range, sRGB transfer and D65 DCI-P3 standard.
|
||||
*/
|
||||
ADATASPACE_DISPLAY_P3 = 143261696, // STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_FULL
|
||||
ADATASPACE_DISPLAY_P3 = 143261696, // ADATASPACE_STANDARD_DCI_P3 | ADATASPACE_TRANSFER_SRGB |
|
||||
// ADATASPACE_RANGE_FULL
|
||||
|
||||
/**
|
||||
* ITU-R Recommendation 2020 (BT.2020)
|
||||
*
|
||||
* Ultra High-definition television
|
||||
*
|
||||
* Use full range, SMPTE 2084 (PQ) transfer and BT2020 standard
|
||||
* Uses full range, SMPTE 2084 (PQ) transfer and BT2020 standard.
|
||||
*/
|
||||
ADATASPACE_BT2020_PQ = 163971072, // STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_FULL
|
||||
ADATASPACE_BT2020_PQ = 163971072, // ADATASPACE_STANDARD_BT2020 | ADATASPACE_TRANSFER_ST2084 |
|
||||
// ADATASPACE_RANGE_FULL
|
||||
|
||||
/**
|
||||
* ITU-R Recommendation 2020 (BT.2020)
|
||||
*
|
||||
* Ultra High-definition television
|
||||
*
|
||||
* Uses limited range, SMPTE 2084 (PQ) transfer and BT2020 standard.
|
||||
*/
|
||||
ADATASPACE_BT2020_ITU_PQ = 298188800, // ADATASPACE_STANDARD_BT2020 | ADATASPACE_TRANSFER_ST2084
|
||||
// | ADATASPACE_RANGE_LIMITED
|
||||
|
||||
/**
|
||||
* Adobe RGB
|
||||
*
|
||||
* Use full range, gamma 2.2 transfer and Adobe RGB primaries
|
||||
* Uses full range, gamma 2.2 transfer and Adobe RGB standard.
|
||||
*
|
||||
* Note: Application is responsible for gamma encoding the data as
|
||||
* a 2.2 gamma encoding is not supported in HW.
|
||||
*/
|
||||
ADATASPACE_ADOBE_RGB = 151715840, // STANDARD_ADOBE_RGB | TRANSFER_GAMMA2_2 | RANGE_FULL
|
||||
ADATASPACE_ADOBE_RGB = 151715840, // ADATASPACE_STANDARD_ADOBE_RGB |
|
||||
// ADATASPACE_TRANSFER_GAMMA2_2 | ADATASPACE_RANGE_FULL
|
||||
|
||||
/**
|
||||
* JPEG File Interchange Format (JFIF)
|
||||
*
|
||||
* Same model as BT.601-625, but all values (Y, Cb, Cr) range from 0 to 255.
|
||||
*
|
||||
* Uses full range, SMPTE 170M transfer and BT.601_625 standard.
|
||||
*/
|
||||
ADATASPACE_JFIF = 146931712, // ADATASPACE_STANDARD_BT601_625 | ADATASPACE_TRANSFER_SMPTE_170M |
|
||||
// ADATASPACE_RANGE_FULL
|
||||
|
||||
/**
|
||||
* ITU-R Recommendation 601 (BT.601) - 625-line
|
||||
*
|
||||
* Standard-definition television, 625 Lines (PAL)
|
||||
*
|
||||
* Uses limited range, SMPTE 170M transfer and BT.601_625 standard.
|
||||
*/
|
||||
ADATASPACE_BT601_625 = 281149440, // ADATASPACE_STANDARD_BT601_625 |
|
||||
// ADATASPACE_TRANSFER_SMPTE_170M | ADATASPACE_RANGE_LIMITED
|
||||
|
||||
/**
|
||||
* ITU-R Recommendation 601 (BT.601) - 525-line
|
||||
*
|
||||
* Standard-definition television, 525 Lines (NTSC)
|
||||
*
|
||||
* Uses limited range, SMPTE 170M transfer and BT.601_525 standard.
|
||||
*/
|
||||
ADATASPACE_BT601_525 = 281280512, // ADATASPACE_STANDARD_BT601_525 |
|
||||
// ADATASPACE_TRANSFER_SMPTE_170M | ADATASPACE_RANGE_LIMITED
|
||||
|
||||
/**
|
||||
* ITU-R Recommendation 2020 (BT.2020)
|
||||
*
|
||||
* Ultra High-definition television
|
||||
*
|
||||
* Use full range, BT.709 transfer and BT2020 standard
|
||||
* Uses full range, SMPTE 170M transfer and BT2020 standard.
|
||||
*/
|
||||
ADATASPACE_BT2020 = 147193856, // STANDARD_BT2020 | TRANSFER_SMPTE_170M | RANGE_FULL
|
||||
ADATASPACE_BT2020 = 147193856, // ADATASPACE_STANDARD_BT2020 | ADATASPACE_TRANSFER_SMPTE_170M |
|
||||
// ADATASPACE_RANGE_FULL
|
||||
|
||||
/**
|
||||
* ITU-R Recommendation 709 (BT.709)
|
||||
*
|
||||
* High-definition television
|
||||
*
|
||||
* Use limited range, BT.709 transfer and BT.709 standard.
|
||||
* Uses limited range, SMPTE 170M transfer and BT.709 standard.
|
||||
*/
|
||||
ADATASPACE_BT709 = 281083904, // STANDARD_BT709 | TRANSFER_SMPTE_170M | RANGE_LIMITED
|
||||
ADATASPACE_BT709 = 281083904, // ADATASPACE_STANDARD_BT709 | ADATASPACE_TRANSFER_SMPTE_170M |
|
||||
// ADATASPACE_RANGE_LIMITED
|
||||
|
||||
/**
|
||||
* SMPTE EG 432-1 and SMPTE RP 431-2.
|
||||
* SMPTE EG 432-1 and SMPTE RP 431-2
|
||||
*
|
||||
* Digital Cinema DCI-P3
|
||||
*
|
||||
* Use full range, gamma 2.6 transfer and D65 DCI-P3 standard
|
||||
* Uses full range, gamma 2.6 transfer and D65 DCI-P3 standard.
|
||||
*
|
||||
* Note: Application is responsible for gamma encoding the data as
|
||||
* a 2.6 gamma encoding is not supported in HW.
|
||||
*/
|
||||
ADATASPACE_DCI_P3 = 155844608, // STANDARD_DCI_P3 | TRANSFER_GAMMA2_6 | RANGE_FULL
|
||||
ADATASPACE_DCI_P3 = 155844608, // ADATASPACE_STANDARD_DCI_P3 | ADATASPACE_TRANSFER_GAMMA2_6 |
|
||||
// ADATASPACE_RANGE_FULL
|
||||
|
||||
/**
|
||||
* sRGB linear encoding:
|
||||
* sRGB linear encoding
|
||||
*
|
||||
* The red, green, and blue components are stored in sRGB space, but
|
||||
* are linear, not gamma-encoded.
|
||||
|
|
@ -149,10 +557,82 @@ enum ADataSpace {
|
|||
*
|
||||
* The values are encoded using the full range ([0,255] for 8-bit) for all
|
||||
* components.
|
||||
*
|
||||
* Uses full range, linear transfer and BT.709 standard.
|
||||
*/
|
||||
ADATASPACE_SRGB_LINEAR = 138477568, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_FULL
|
||||
ADATASPACE_SRGB_LINEAR = 138477568, // ADATASPACE_STANDARD_BT709 | ADATASPACE_TRANSFER_LINEAR |
|
||||
// ADATASPACE_RANGE_FULL
|
||||
|
||||
/**
|
||||
* Hybrid Log Gamma encoding
|
||||
*
|
||||
* Uses full range, hybrid log gamma transfer and BT2020 standard.
|
||||
*/
|
||||
ADATASPACE_BT2020_HLG = 168165376, // ADATASPACE_STANDARD_BT2020 | ADATASPACE_TRANSFER_HLG |
|
||||
// ADATASPACE_RANGE_FULL
|
||||
|
||||
/**
|
||||
* ITU Hybrid Log Gamma encoding
|
||||
*
|
||||
* Uses limited range, hybrid log gamma transfer and BT2020 standard.
|
||||
*/
|
||||
ADATASPACE_BT2020_ITU_HLG = 302383104, // ADATASPACE_STANDARD_BT2020 | ADATASPACE_TRANSFER_HLG |
|
||||
// ADATASPACE_RANGE_LIMITED
|
||||
/**
|
||||
* sRGB-encoded BT. 2020
|
||||
*
|
||||
* Uses full range, sRGB transfer and BT2020 standard.
|
||||
*/
|
||||
ADATASPACE_DISPLAY_BT2020 = 142999552, // ADATASPACE_STANDARD_BT2020 | ADATASPACE_TRANSFER_SRGB
|
||||
// | ADATASPACE_RANGE_FULL
|
||||
|
||||
/**
|
||||
* Depth
|
||||
*
|
||||
* This value is valid with formats HAL_PIXEL_FORMAT_Y16 and HAL_PIXEL_FORMAT_BLOB.
|
||||
*/
|
||||
ADATASPACE_DEPTH = 4096,
|
||||
|
||||
/**
|
||||
* ISO 16684-1:2011(E) Dynamic Depth
|
||||
*
|
||||
* Embedded depth metadata following the dynamic depth specification.
|
||||
*/
|
||||
ADATASPACE_DYNAMIC_DEPTH = 4098,
|
||||
|
||||
#ifndef ADATASPACE_SKIP_LEGACY_DEFINES
|
||||
STANDARD_MASK = ADATASPACE_STANDARD_MASK,
|
||||
STANDARD_UNSPECIFIED = ADATASPACE_STANDARD_UNSPECIFIED,
|
||||
STANDARD_BT709 = ADATASPACE_STANDARD_BT709,
|
||||
STANDARD_BT601_625 = ADATASPACE_STANDARD_BT601_625,
|
||||
STANDARD_BT601_625_UNADJUSTED = ADATASPACE_STANDARD_BT601_625_UNADJUSTED,
|
||||
STANDARD_BT601_525 = ADATASPACE_STANDARD_BT601_525,
|
||||
STANDARD_BT601_525_UNADJUSTED = ADATASPACE_STANDARD_BT601_525_UNADJUSTED,
|
||||
STANDARD_BT470M = ADATASPACE_STANDARD_BT470M,
|
||||
STANDARD_BT2020 = ADATASPACE_STANDARD_BT2020,
|
||||
STANDARD_FILM = ADATASPACE_STANDARD_FILM,
|
||||
STANDARD_DCI_P3 = ADATASPACE_STANDARD_DCI_P3,
|
||||
STANDARD_ADOBE_RGB = ADATASPACE_STANDARD_ADOBE_RGB,
|
||||
TRANSFER_MASK = ADATASPACE_TRANSFER_MASK,
|
||||
TRANSFER_UNSPECIFIED = ADATASPACE_TRANSFER_UNSPECIFIED,
|
||||
TRANSFER_LINEAR = ADATASPACE_TRANSFER_LINEAR,
|
||||
TRANSFER_SMPTE_170M = ADATASPACE_TRANSFER_SMPTE_170M,
|
||||
TRANSFER_GAMMA2_2 = ADATASPACE_TRANSFER_GAMMA2_2,
|
||||
TRANSFER_GAMMA2_6 = ADATASPACE_TRANSFER_GAMMA2_6,
|
||||
TRANSFER_GAMMA2_8 = ADATASPACE_TRANSFER_GAMMA2_8,
|
||||
TRANSFER_SRGB = ADATASPACE_TRANSFER_SRGB,
|
||||
TRANSFER_ST2084 = ADATASPACE_TRANSFER_ST2084,
|
||||
TRANSFER_HLG = ADATASPACE_TRANSFER_HLG,
|
||||
RANGE_MASK = ADATASPACE_RANGE_MASK,
|
||||
RANGE_UNSPECIFIED = ADATASPACE_RANGE_UNSPECIFIED,
|
||||
RANGE_FULL = ADATASPACE_RANGE_FULL,
|
||||
RANGE_LIMITED = ADATASPACE_RANGE_LIMITED,
|
||||
RANGE_EXTENDED = ADATASPACE_RANGE_EXTENDED,
|
||||
#endif
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // ANDROID_DATA_SPACE_H
|
||||
|
||||
/** @} */
|
||||
|
|
|
|||
|
|
@ -45,14 +45,21 @@
|
|||
#ifndef ANDROID_HARDWARE_BUFFER_H
|
||||
#define ANDROID_HARDWARE_BUFFER_H
|
||||
|
||||
#include <android/rect.h>
|
||||
#define ADATASPACE_SKIP_LEGACY_DEFINES
|
||||
#include <android/data_space.h>
|
||||
#undef ADATASPACE_SKIP_LEGACY_DEFINES
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <android/rect.h>
|
||||
#if !defined(__INTRODUCED_IN)
|
||||
#define __INTRODUCED_IN(__api_level) /* nothing */
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
// clang-format off
|
||||
|
||||
/**
|
||||
* Buffer pixel formats.
|
||||
*/
|
||||
|
|
@ -167,58 +174,98 @@ enum AHardwareBuffer_Format {
|
|||
*/
|
||||
AHARDWAREBUFFER_FORMAT_YCbCr_P010 = 0x36,
|
||||
|
||||
/**
|
||||
* YUV P210 format.
|
||||
* Must have an even width and height. Can be accessed in OpenGL
|
||||
* shaders through an external sampler. Does not support mip-maps
|
||||
* cube-maps or multi-layered textures.
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_YCbCr_P210 = 0x3c,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R8_UNORM
|
||||
* OpenGL ES: GR_GL_R8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R8_UNORM = 0x38,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R16_UINT
|
||||
* OpenGL ES: GL_R16UI
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R16_UINT = 0x39,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R16G16_UINT
|
||||
* OpenGL ES: GL_RG16UI
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R16G16_UINT = 0x3a,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16
|
||||
* OpenGL ES: N/A
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM = 0x3b,
|
||||
};
|
||||
|
||||
/**
|
||||
* Buffer usage flags, specifying how the buffer will be accessed.
|
||||
*/
|
||||
enum AHardwareBuffer_UsageFlags {
|
||||
/// The buffer will never be locked for direct CPU reads using the
|
||||
/// AHardwareBuffer_lock() function. Note that reading the buffer
|
||||
/// using OpenGL or Vulkan functions or memory mappings is still
|
||||
/// allowed.
|
||||
/**
|
||||
* The buffer will never be locked for direct CPU reads using the
|
||||
* AHardwareBuffer_lock() function. Note that reading the buffer
|
||||
* using OpenGL or Vulkan functions or memory mappings is still
|
||||
* allowed.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_CPU_READ_NEVER = 0UL,
|
||||
/// The buffer will sometimes be locked for direct CPU reads using
|
||||
/// the AHardwareBuffer_lock() function. Note that reading the
|
||||
/// buffer using OpenGL or Vulkan functions or memory mappings
|
||||
/// does not require the presence of this flag.
|
||||
/**
|
||||
* The buffer will sometimes be locked for direct CPU reads using
|
||||
* the AHardwareBuffer_lock() function. Note that reading the
|
||||
* buffer using OpenGL or Vulkan functions or memory mappings
|
||||
* does not require the presence of this flag.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_CPU_READ_RARELY = 2UL,
|
||||
/// The buffer will often be locked for direct CPU reads using
|
||||
/// the AHardwareBuffer_lock() function. Note that reading the
|
||||
/// buffer using OpenGL or Vulkan functions or memory mappings
|
||||
/// does not require the presence of this flag.
|
||||
/**
|
||||
* The buffer will often be locked for direct CPU reads using
|
||||
* the AHardwareBuffer_lock() function. Note that reading the
|
||||
* buffer using OpenGL or Vulkan functions or memory mappings
|
||||
* does not require the presence of this flag.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN = 3UL,
|
||||
/// CPU read value mask.
|
||||
|
||||
/** CPU read value mask. */
|
||||
AHARDWAREBUFFER_USAGE_CPU_READ_MASK = 0xFUL,
|
||||
|
||||
/// The buffer will never be locked for direct CPU writes using the
|
||||
/// AHardwareBuffer_lock() function. Note that writing the buffer
|
||||
/// using OpenGL or Vulkan functions or memory mappings is still
|
||||
/// allowed.
|
||||
/**
|
||||
* The buffer will never be locked for direct CPU writes using the
|
||||
* AHardwareBuffer_lock() function. Note that writing the buffer
|
||||
* using OpenGL or Vulkan functions or memory mappings is still
|
||||
* allowed.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER = 0UL << 4,
|
||||
/// The buffer will sometimes be locked for direct CPU writes using
|
||||
/// the AHardwareBuffer_lock() function. Note that writing the
|
||||
/// buffer using OpenGL or Vulkan functions or memory mappings
|
||||
/// does not require the presence of this flag.
|
||||
/**
|
||||
* The buffer will sometimes be locked for direct CPU writes using
|
||||
* the AHardwareBuffer_lock() function. Note that writing the
|
||||
* buffer using OpenGL or Vulkan functions or memory mappings
|
||||
* does not require the presence of this flag.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY = 2UL << 4,
|
||||
/// The buffer will often be locked for direct CPU writes using
|
||||
/// the AHardwareBuffer_lock() function. Note that writing the
|
||||
/// buffer using OpenGL or Vulkan functions or memory mappings
|
||||
/// does not require the presence of this flag.
|
||||
/**
|
||||
* The buffer will often be locked for direct CPU writes using
|
||||
* the AHardwareBuffer_lock() function. Note that writing the
|
||||
* buffer using OpenGL or Vulkan functions or memory mappings
|
||||
* does not require the presence of this flag.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN = 3UL << 4,
|
||||
/// CPU write value mask.
|
||||
/** CPU write value mask. */
|
||||
AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK = 0xFUL << 4,
|
||||
|
||||
/// The buffer will be read from by the GPU as a texture.
|
||||
AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE = 1UL << 8,
|
||||
/// The buffer will be written to by the GPU as a framebuffer attachment.
|
||||
AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER = 1UL << 9,
|
||||
/** The buffer will be read from by the GPU as a texture. */
|
||||
AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE = 1UL << 8,
|
||||
/** The buffer will be written to by the GPU as a framebuffer attachment.*/
|
||||
AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER = 1UL << 9,
|
||||
/**
|
||||
* The buffer will be written to by the GPU as a framebuffer
|
||||
* attachment.
|
||||
|
|
@ -229,7 +276,7 @@ enum AHardwareBuffer_UsageFlags {
|
|||
* attachment should also have this flag. Use the equivalent flag
|
||||
* AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER to avoid this confusion.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT = AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER,
|
||||
AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT = AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER,
|
||||
/**
|
||||
* The buffer will be used as a composer HAL overlay layer.
|
||||
*
|
||||
|
|
@ -240,7 +287,7 @@ enum AHardwareBuffer_UsageFlags {
|
|||
* directly through AHardwareBuffer_allocate instead of buffers allocated
|
||||
* by the framework.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY = 1ULL << 11,
|
||||
AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY = 1ULL << 11,
|
||||
/**
|
||||
* The buffer is protected from direct CPU access or being read by
|
||||
* non-secure hardware, such as video encoders.
|
||||
|
|
@ -251,19 +298,19 @@ enum AHardwareBuffer_UsageFlags {
|
|||
* GL_EXT_protected_textures for more information on how these
|
||||
* buffers are expected to behave.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT = 1UL << 14,
|
||||
/// The buffer will be read by a hardware video encoder.
|
||||
AHARDWAREBUFFER_USAGE_VIDEO_ENCODE = 1UL << 16,
|
||||
AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT = 1UL << 14,
|
||||
/** The buffer will be read by a hardware video encoder. */
|
||||
AHARDWAREBUFFER_USAGE_VIDEO_ENCODE = 1UL << 16,
|
||||
/**
|
||||
* The buffer will be used for direct writes from sensors.
|
||||
* When this flag is present, the format must be AHARDWAREBUFFER_FORMAT_BLOB.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA = 1UL << 23,
|
||||
AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA = 1UL << 23,
|
||||
/**
|
||||
* The buffer will be used as a shader storage or uniform buffer object.
|
||||
* When this flag is present, the format must be AHARDWAREBUFFER_FORMAT_BLOB.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER = 1UL << 24,
|
||||
AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER = 1UL << 24,
|
||||
/**
|
||||
* The buffer will be used as a cube map texture.
|
||||
* When this flag is present, the buffer must have a layer count
|
||||
|
|
@ -271,13 +318,23 @@ enum AHardwareBuffer_UsageFlags {
|
|||
* bound to OpenGL textures using the extension
|
||||
* GL_EXT_EGL_image_storage instead of GL_KHR_EGL_image.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP = 1UL << 25,
|
||||
AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP = 1UL << 25,
|
||||
/**
|
||||
* The buffer contains a complete mipmap hierarchy.
|
||||
* Note that buffers with this flag must be bound to OpenGL textures using
|
||||
* the extension GL_EXT_EGL_image_storage instead of GL_KHR_EGL_image.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE = 1UL << 26,
|
||||
AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE = 1UL << 26,
|
||||
|
||||
/**
|
||||
* Usage: The buffer is used for front-buffer rendering. When
|
||||
* front-buffering rendering is specified, different usages may adjust their
|
||||
* behavior as a result. For example, when used as GPU_COLOR_OUTPUT the buffer
|
||||
* will behave similar to a single-buffered window. When used with
|
||||
* COMPOSER_OVERLAY, the system will try to prioritize the buffer receiving
|
||||
* an overlay plane & avoid caching it in intermediate composition buffers.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_FRONT_BUFFER = 1ULL << 32,
|
||||
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_0 = 1ULL << 28,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_1 = 1ULL << 29,
|
||||
|
|
@ -306,8 +363,8 @@ enum AHardwareBuffer_UsageFlags {
|
|||
* parameters of existing ones.
|
||||
*/
|
||||
typedef struct AHardwareBuffer_Desc {
|
||||
uint32_t width; ///< Width in pixels.
|
||||
uint32_t height; ///< Height in pixels.
|
||||
uint32_t width; ///< Width in pixels.
|
||||
uint32_t height; ///< Height in pixels.
|
||||
/**
|
||||
* Number of images in an image array. AHardwareBuffers with one
|
||||
* layer correspond to regular 2D textures. AHardwareBuffers with
|
||||
|
|
@ -316,21 +373,21 @@ typedef struct AHardwareBuffer_Desc {
|
|||
* AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP is present, the buffer is
|
||||
* a cube map or a cube map array.
|
||||
*/
|
||||
uint32_t layers;
|
||||
uint32_t format; ///< One of AHardwareBuffer_Format.
|
||||
uint64_t usage; ///< Combination of AHardwareBuffer_UsageFlags.
|
||||
uint32_t stride; ///< Row stride in pixels, ignored for AHardwareBuffer_allocate()
|
||||
uint32_t rfu0; ///< Initialize to zero, reserved for future use.
|
||||
uint64_t rfu1; ///< Initialize to zero, reserved for future use.
|
||||
uint32_t layers;
|
||||
uint32_t format; ///< One of AHardwareBuffer_Format.
|
||||
uint64_t usage; ///< Combination of AHardwareBuffer_UsageFlags.
|
||||
uint32_t stride; ///< Row stride in pixels, ignored for AHardwareBuffer_allocate()
|
||||
uint32_t rfu0; ///< Initialize to zero, reserved for future use.
|
||||
uint64_t rfu1; ///< Initialize to zero, reserved for future use.
|
||||
} AHardwareBuffer_Desc;
|
||||
|
||||
/**
|
||||
* Holds data for a single image plane.
|
||||
*/
|
||||
typedef struct AHardwareBuffer_Plane {
|
||||
void* data; ///< Points to first byte in plane
|
||||
uint32_t pixelStride; ///< Distance in bytes from the color channel of one pixel to the next
|
||||
uint32_t rowStride; ///< Distance in bytes from the first value of one row of the image to
|
||||
void* _Nullable data; ///< Points to first byte in plane
|
||||
uint32_t pixelStride; ///< Distance in bytes from the color channel of one pixel to the next
|
||||
uint32_t rowStride; ///< Distance in bytes from the first value of one row of the image to
|
||||
/// the first value of the next row.
|
||||
} AHardwareBuffer_Plane;
|
||||
|
||||
|
|
@ -338,8 +395,8 @@ typedef struct AHardwareBuffer_Plane {
|
|||
* Holds all image planes that contain the pixel data.
|
||||
*/
|
||||
typedef struct AHardwareBuffer_Planes {
|
||||
uint32_t planeCount; ///< Number of distinct planes
|
||||
AHardwareBuffer_Plane planes[4]; ///< Array of image planes
|
||||
uint32_t planeCount; ///< Number of distinct planes
|
||||
AHardwareBuffer_Plane planes[4]; ///< Array of image planes
|
||||
} AHardwareBuffer_Planes;
|
||||
|
||||
/**
|
||||
|
|
@ -347,6 +404,8 @@ typedef struct AHardwareBuffer_Planes {
|
|||
*/
|
||||
typedef struct AHardwareBuffer AHardwareBuffer;
|
||||
|
||||
// clang-format on
|
||||
|
||||
/**
|
||||
* Allocates a buffer that matches the passed AHardwareBuffer_Desc.
|
||||
*
|
||||
|
|
@ -360,8 +419,8 @@ typedef struct AHardwareBuffer AHardwareBuffer;
|
|||
* \return 0 on success, or an error number of the allocation fails for
|
||||
* any reason. The returned buffer has a reference count of 1.
|
||||
*/
|
||||
int AHardwareBuffer_allocate(const AHardwareBuffer_Desc* desc,
|
||||
AHardwareBuffer** outBuffer) __INTRODUCED_IN(26);
|
||||
int AHardwareBuffer_allocate(const AHardwareBuffer_Desc* _Nonnull desc,
|
||||
AHardwareBuffer* _Nullable* _Nonnull outBuffer) __INTRODUCED_IN(26);
|
||||
/**
|
||||
* Acquire a reference on the given AHardwareBuffer object.
|
||||
*
|
||||
|
|
@ -370,7 +429,7 @@ int AHardwareBuffer_allocate(const AHardwareBuffer_Desc* desc,
|
|||
*
|
||||
* Available since API level 26.
|
||||
*/
|
||||
void AHardwareBuffer_acquire(AHardwareBuffer* buffer) __INTRODUCED_IN(26);
|
||||
void AHardwareBuffer_acquire(AHardwareBuffer* _Nonnull buffer) __INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Remove a reference that was previously acquired with
|
||||
|
|
@ -378,7 +437,7 @@ void AHardwareBuffer_acquire(AHardwareBuffer* buffer) __INTRODUCED_IN(26);
|
|||
*
|
||||
* Available since API level 26.
|
||||
*/
|
||||
void AHardwareBuffer_release(AHardwareBuffer* buffer) __INTRODUCED_IN(26);
|
||||
void AHardwareBuffer_release(AHardwareBuffer* _Nonnull buffer) __INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Return a description of the AHardwareBuffer in the passed
|
||||
|
|
@ -386,8 +445,8 @@ void AHardwareBuffer_release(AHardwareBuffer* buffer) __INTRODUCED_IN(26);
|
|||
*
|
||||
* Available since API level 26.
|
||||
*/
|
||||
void AHardwareBuffer_describe(const AHardwareBuffer* buffer,
|
||||
AHardwareBuffer_Desc* outDesc) __INTRODUCED_IN(26);
|
||||
void AHardwareBuffer_describe(const AHardwareBuffer* _Nonnull buffer,
|
||||
AHardwareBuffer_Desc* _Nonnull outDesc) __INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Lock the AHardwareBuffer for direct CPU access.
|
||||
|
|
@ -441,8 +500,53 @@ void AHardwareBuffer_describe(const AHardwareBuffer* buffer,
|
|||
* has more than one layer. Error number if the lock fails for any other
|
||||
* reason.
|
||||
*/
|
||||
int AHardwareBuffer_lock(AHardwareBuffer* buffer, uint64_t usage,
|
||||
int32_t fence, const ARect* rect, void** outVirtualAddress) __INTRODUCED_IN(26);
|
||||
int AHardwareBuffer_lock(AHardwareBuffer* _Nonnull buffer, uint64_t usage, int32_t fence,
|
||||
const ARect* _Nullable rect, void* _Nullable* _Nonnull outVirtualAddress)
|
||||
__INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Unlock the AHardwareBuffer from direct CPU access.
|
||||
*
|
||||
* Must be called after all changes to the buffer are completed by the
|
||||
* caller. If \a fence is NULL, the function will block until all work
|
||||
* is completed. Otherwise, \a fence will be set either to a valid file
|
||||
* descriptor or to -1. The file descriptor will become signaled once
|
||||
* the unlocking is complete and buffer contents are updated.
|
||||
* The caller is responsible for closing the file descriptor once it's
|
||||
* no longer needed. The value -1 indicates that unlocking has already
|
||||
* completed before the function returned and no further operations are
|
||||
* necessary.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*
|
||||
* \return 0 on success. -EINVAL if \a buffer is NULL. Error number if
|
||||
* the unlock fails for any reason.
|
||||
*/
|
||||
int AHardwareBuffer_unlock(AHardwareBuffer* _Nonnull buffer, int32_t* _Nullable fence)
|
||||
__INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Send the AHardwareBuffer to an AF_UNIX socket.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*
|
||||
* \return 0 on success, -EINVAL if \a buffer is NULL, or an error
|
||||
* number if the operation fails for any reason.
|
||||
*/
|
||||
int AHardwareBuffer_sendHandleToUnixSocket(const AHardwareBuffer* _Nonnull buffer, int socketFd)
|
||||
__INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Receive an AHardwareBuffer from an AF_UNIX socket.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*
|
||||
* \return 0 on success, -EINVAL if \a outBuffer is NULL, or an error
|
||||
* number if the operation fails for any reason.
|
||||
*/
|
||||
int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd,
|
||||
AHardwareBuffer* _Nullable* _Nonnull outBuffer)
|
||||
__INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Lock a potentially multi-planar AHardwareBuffer for direct CPU access.
|
||||
|
|
@ -471,48 +575,9 @@ int AHardwareBuffer_lock(AHardwareBuffer* buffer, uint64_t usage,
|
|||
* has more than one layer. Error number if the lock fails for any other
|
||||
* reason.
|
||||
*/
|
||||
int AHardwareBuffer_lockPlanes(AHardwareBuffer* buffer, uint64_t usage,
|
||||
int32_t fence, const ARect* rect, AHardwareBuffer_Planes* outPlanes) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Unlock the AHardwareBuffer from direct CPU access.
|
||||
*
|
||||
* Must be called after all changes to the buffer are completed by the
|
||||
* caller. If \a fence is NULL, the function will block until all work
|
||||
* is completed. Otherwise, \a fence will be set either to a valid file
|
||||
* descriptor or to -1. The file descriptor will become signaled once
|
||||
* the unlocking is complete and buffer contents are updated.
|
||||
* The caller is responsible for closing the file descriptor once it's
|
||||
* no longer needed. The value -1 indicates that unlocking has already
|
||||
* completed before the function returned and no further operations are
|
||||
* necessary.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*
|
||||
* \return 0 on success. -EINVAL if \a buffer is NULL. Error number if
|
||||
* the unlock fails for any reason.
|
||||
*/
|
||||
int AHardwareBuffer_unlock(AHardwareBuffer* buffer, int32_t* fence) __INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Send the AHardwareBuffer to an AF_UNIX socket.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*
|
||||
* \return 0 on success, -EINVAL if \a buffer is NULL, or an error
|
||||
* number if the operation fails for any reason.
|
||||
*/
|
||||
int AHardwareBuffer_sendHandleToUnixSocket(const AHardwareBuffer* buffer, int socketFd) __INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Receive an AHardwareBuffer from an AF_UNIX socket.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*
|
||||
* \return 0 on success, -EINVAL if \a outBuffer is NULL, or an error
|
||||
* number if the operation fails for any reason.
|
||||
*/
|
||||
int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd, AHardwareBuffer** outBuffer) __INTRODUCED_IN(26);
|
||||
int AHardwareBuffer_lockPlanes(AHardwareBuffer* _Nonnull buffer, uint64_t usage, int32_t fence,
|
||||
const ARect* _Nullable rect,
|
||||
AHardwareBuffer_Planes* _Nonnull outPlanes) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Test whether the given format and usage flag combination is
|
||||
|
|
@ -533,7 +598,7 @@ int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd, AHardwareBuffer** out
|
|||
* \return 1 if the format and usage flag combination is allocatable,
|
||||
* 0 otherwise.
|
||||
*/
|
||||
int AHardwareBuffer_isSupported(const AHardwareBuffer_Desc* desc) __INTRODUCED_IN(29);
|
||||
int AHardwareBuffer_isSupported(const AHardwareBuffer_Desc* _Nonnull desc) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Lock an AHardwareBuffer for direct CPU access.
|
||||
|
|
@ -546,9 +611,23 @@ int AHardwareBuffer_isSupported(const AHardwareBuffer_Desc* desc) __INTRODUCED_I
|
|||
*
|
||||
* Available since API level 29.
|
||||
*/
|
||||
int AHardwareBuffer_lockAndGetInfo(AHardwareBuffer* buffer, uint64_t usage,
|
||||
int32_t fence, const ARect* rect, void** outVirtualAddress,
|
||||
int32_t* outBytesPerPixel, int32_t* outBytesPerStride) __INTRODUCED_IN(29);
|
||||
int AHardwareBuffer_lockAndGetInfo(AHardwareBuffer* _Nonnull buffer, uint64_t usage, int32_t fence,
|
||||
const ARect* _Nullable rect,
|
||||
void* _Nullable* _Nonnull outVirtualAddress,
|
||||
int32_t* _Nonnull outBytesPerPixel,
|
||||
int32_t* _Nonnull outBytesPerStride) __INTRODUCED_IN(29);
|
||||
|
||||
|
||||
/**
|
||||
* Get the system wide unique id for an AHardwareBuffer.
|
||||
*
|
||||
* Available since API level 31.
|
||||
*
|
||||
* \return 0 on success, -EINVAL if \a buffer or \a outId is NULL, or an error number if the
|
||||
* operation fails for any reason.
|
||||
*/
|
||||
int AHardwareBuffer_getId(const AHardwareBuffer* _Nonnull buffer, uint64_t* _Nonnull outId)
|
||||
__INTRODUCED_IN(31);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
|||
|
|
@ -55,9 +55,11 @@
|
|||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if !defined(__BIONIC__) && !defined(__INTRODUCED_IN)
|
||||
#define __INTRODUCED_IN(x)
|
||||
|
|
@ -92,22 +94,33 @@ typedef enum android_LogPriority {
|
|||
} android_LogPriority;
|
||||
|
||||
/**
|
||||
* Writes the constant string `text` to the log, with priority `prio` and tag
|
||||
* `tag`.
|
||||
* Writes the constant string `text` to the log,
|
||||
* with priority `prio` (one of the `android_LogPriority` values) and tag `tag`.
|
||||
*
|
||||
* @return 1 if the message was written to the log, or -EPERM if it was not; see
|
||||
* __android_log_is_loggable().
|
||||
*/
|
||||
int __android_log_write(int prio, const char* tag, const char* text);
|
||||
|
||||
/**
|
||||
* Writes a formatted string to the log, with priority `prio` and tag `tag`.
|
||||
* Writes a formatted string to the log,
|
||||
* with priority `prio` (one of the `android_LogPriority` values) and tag `tag`.
|
||||
*
|
||||
* The details of formatting are the same as for
|
||||
* [printf(3)](http://man7.org/linux/man-pages/man3/printf.3.html).
|
||||
*
|
||||
* @return 1 if the message was written to the log, or -EPERM if it was not; see
|
||||
* __android_log_is_loggable().
|
||||
*/
|
||||
int __android_log_print(int prio, const char* tag, const char* fmt, ...)
|
||||
__attribute__((__format__(printf, 3, 4)));
|
||||
|
||||
/**
|
||||
* Equivalent to `__android_log_print`, but taking a `va_list`.
|
||||
* (If `__android_log_print` is like `printf`, this is like `vprintf`.)
|
||||
* Equivalent to __android_log_print(), but taking a `va_list`.
|
||||
* (If __android_log_print() is like printf(), this is like vprintf().)
|
||||
*
|
||||
* @return 1 if the message was written to the log, or -EPERM if it was not; see
|
||||
* __android_log_is_loggable().
|
||||
*/
|
||||
int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap)
|
||||
__attribute__((__format__(printf, 3, 0)));
|
||||
|
|
@ -161,23 +174,34 @@ typedef enum log_id {
|
|||
LOG_ID_DEFAULT = 0x7FFFFFFF
|
||||
} log_id_t;
|
||||
|
||||
/**
|
||||
* Writes the constant string `text` to the log buffer `id`,
|
||||
* with priority `prio` and tag `tag`.
|
||||
*
|
||||
* Apps should use __android_log_write() instead.
|
||||
*/
|
||||
int __android_log_buf_write(int bufID, int prio, const char* tag, const char* text);
|
||||
static inline bool __android_log_id_is_valid(log_id_t log_id) {
|
||||
return log_id >= LOG_ID_MIN && log_id < LOG_ID_MAX;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a formatted string to log buffer `id`,
|
||||
* with priority `prio` and tag `tag`.
|
||||
* Writes the string `text` to the log buffer `log_id` (one of the `log_id_t` values),
|
||||
* with priority `prio` (one of the `android_LogPriority` values) and tag `tag`.
|
||||
*
|
||||
* Apps should use __android_log_write() instead.
|
||||
*
|
||||
* @return 1 if the message was written to the log, or -EPERM if it was not; see
|
||||
* __android_log_is_loggable().
|
||||
*/
|
||||
int __android_log_buf_write(int log_id, int prio, const char* tag, const char* text);
|
||||
|
||||
/**
|
||||
* Writes a formatted string to the log buffer `log_id` (one of the `log_id_t` values),
|
||||
* with priority `prio` (one of the `android_LogPriority` values) and tag `tag`.
|
||||
*
|
||||
* The details of formatting are the same as for
|
||||
* [printf(3)](http://man7.org/linux/man-pages/man3/printf.3.html).
|
||||
*
|
||||
* Apps should use __android_log_print() instead.
|
||||
*
|
||||
* @return 1 if the message was written to the log, or -EPERM if it was not; see
|
||||
* __android_log_is_loggable().
|
||||
*/
|
||||
int __android_log_buf_print(int bufID, int prio, const char* tag, const char* fmt, ...)
|
||||
int __android_log_buf_print(int log_id, int prio, const char* tag, const char* fmt, ...)
|
||||
__attribute__((__format__(printf, 4, 5)));
|
||||
|
||||
/**
|
||||
|
|
@ -185,7 +209,7 @@ int __android_log_buf_print(int bufID, int prio, const char* tag, const char* fm
|
|||
* and sending log messages to user defined loggers specified in __android_log_set_logger().
|
||||
*/
|
||||
struct __android_log_message {
|
||||
/** Must be set to sizeof(__android_log_message) and is used for versioning. */
|
||||
/** Must be set to `sizeof(__android_log_message)` and is used for versioning. */
|
||||
size_t struct_size;
|
||||
|
||||
/** {@link log_id_t} values. */
|
||||
|
|
@ -226,7 +250,7 @@ typedef void (*__android_aborter_function)(const char* abort_message);
|
|||
* buffers, then pass the message to liblog via this function, and therefore we do not want to
|
||||
* duplicate the loggability check here.
|
||||
*
|
||||
* @param log_message the log message itself, see __android_log_message.
|
||||
* @param log_message the log message itself, see {@link __android_log_message}.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*/
|
||||
|
|
@ -245,20 +269,32 @@ void __android_log_write_log_message(struct __android_log_message* log_message)
|
|||
void __android_log_set_logger(__android_logger_function logger) __INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* Writes the log message to logd. This is an __android_logger_function and can be provided to
|
||||
* Writes the log message to logd. This is an {@link __android_logger_function} and can be provided to
|
||||
* __android_log_set_logger(). It is the default logger when running liblog on a device.
|
||||
*
|
||||
* @param log_message the log message to write, see __android_log_message.
|
||||
* @param log_message the log message to write, see {@link __android_log_message}.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*/
|
||||
void __android_log_logd_logger(const struct __android_log_message* log_message) __INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* Writes the log message to stderr. This is an __android_logger_function and can be provided to
|
||||
* Writes the log message to logd using the passed in timestamp.
|
||||
*
|
||||
* @param log_message the log message to write, see {@link __android_log_message}.
|
||||
* @param timestamp the time to use for this log message. The value is interpreted as a
|
||||
* CLOCK_REALTIME value.
|
||||
*
|
||||
* Available since API level 37.
|
||||
*/
|
||||
void __android_log_logd_logger_with_timestamp(const struct __android_log_message* log_message,
|
||||
const struct timespec* timestamp) __INTRODUCED_IN(37);
|
||||
|
||||
/**
|
||||
* Writes the log message to stderr. This is an {@link __android_logger_function} and can be provided to
|
||||
* __android_log_set_logger(). It is the default logger when running liblog on host.
|
||||
*
|
||||
* @param log_message the log message to write, see __android_log_message.
|
||||
* @param log_message the log message to write, see {@link __android_log_message}.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*/
|
||||
|
|
@ -270,7 +306,7 @@ void __android_log_stderr_logger(const struct __android_log_message* log_message
|
|||
* user defined aborter function is highly recommended to abort and be noreturn, but is not strictly
|
||||
* required to.
|
||||
*
|
||||
* @param aborter the new aborter function, see __android_aborter_function.
|
||||
* @param aborter the new aborter function, see {@link __android_aborter_function}.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*/
|
||||
|
|
@ -308,7 +344,7 @@ __INTRODUCED_IN(30);
|
|||
* minimum priority needed to log. If only one is set, then that value is used to determine the
|
||||
* minimum priority needed. If none are set, then default_priority is used.
|
||||
*
|
||||
* @param prio the priority to test, takes android_LogPriority values.
|
||||
* @param prio the priority to test, takes {@link android_LogPriority} values.
|
||||
* @param tag the tag to test.
|
||||
* @param default_prio the default priority to use if no properties or minimum priority are set.
|
||||
* @return an integer where 1 indicates that the message is loggable and 0 indicates that it is not.
|
||||
|
|
@ -327,7 +363,7 @@ int __android_log_is_loggable(int prio, const char* tag, int default_prio) __INT
|
|||
* minimum priority needed to log. If only one is set, then that value is used to determine the
|
||||
* minimum priority needed. If none are set, then default_priority is used.
|
||||
*
|
||||
* @param prio the priority to test, takes android_LogPriority values.
|
||||
* @param prio the priority to test, takes {@link android_LogPriority} values.
|
||||
* @param tag the tag to test.
|
||||
* @param len the length of the tag.
|
||||
* @param default_prio the default priority to use if no properties or minimum priority are set.
|
||||
|
|
@ -341,20 +377,17 @@ int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int def
|
|||
/**
|
||||
* Sets the minimum priority that will be logged for this process.
|
||||
*
|
||||
* @param priority the new minimum priority to set, takes android_LogPriority values.
|
||||
* @return the previous set minimum priority as android_LogPriority values, or
|
||||
* ANDROID_LOG_DEFAULT if none was set.
|
||||
* @param priority the new minimum priority to set, takes {@link android_LogPriority} values.
|
||||
* @return the previous set minimum priority, or `ANDROID_LOG_DEFAULT` if none was set.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*/
|
||||
int32_t __android_log_set_minimum_priority(int32_t priority) __INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* Gets the minimum priority that will be logged for this process. If none has been set by a
|
||||
* previous __android_log_set_minimum_priority() call, this returns ANDROID_LOG_DEFAULT.
|
||||
* Gets the minimum priority that will be logged for this process.
|
||||
*
|
||||
* @return the current minimum priority as android_LogPriority values, or
|
||||
* ANDROID_LOG_DEFAULT if none is set.
|
||||
* @return the current minimum priority, or `ANDROID_LOG_DEFAULT` if none is set.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#define ANDROID_NATIVE_WINDOW_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <android/data_space.h>
|
||||
|
|
@ -156,6 +157,7 @@ int32_t ANativeWindow_getFormat(ANativeWindow* window);
|
|||
* For all of these parameters, if 0 is supplied then the window's base
|
||||
* value will come back in force.
|
||||
*
|
||||
* \param window pointer to an ANativeWindow object.
|
||||
* \param width width of the buffers in pixels.
|
||||
* \param height height of the buffers in pixels.
|
||||
* \param format one of the AHardwareBuffer_Format constants.
|
||||
|
|
@ -190,6 +192,7 @@ int32_t ANativeWindow_unlockAndPost(ANativeWindow* window);
|
|||
*
|
||||
* Available since API level 26.
|
||||
*
|
||||
* \param window pointer to an ANativeWindow object.
|
||||
* \param transform combination of {@link ANativeWindowTransform} flags
|
||||
* \return 0 for success, or -EINVAL if \p transform is invalid
|
||||
*/
|
||||
|
|
@ -207,6 +210,7 @@ int32_t ANativeWindow_setBuffersTransform(ANativeWindow* window, int32_t transfo
|
|||
*
|
||||
* Available since API level 28.
|
||||
*
|
||||
* \param window pointer to an ANativeWindow object.
|
||||
* \param dataSpace data space of all buffers queued after this call.
|
||||
* \return 0 for success, -EINVAL if window is invalid or the dataspace is not
|
||||
* supported.
|
||||
|
|
@ -223,14 +227,23 @@ int32_t ANativeWindow_setBuffersDataSpace(ANativeWindow* window, int32_t dataSpa
|
|||
*/
|
||||
int32_t ANativeWindow_getBuffersDataSpace(ANativeWindow* window) __INTRODUCED_IN(28);
|
||||
|
||||
/**
|
||||
* Get the default dataspace of the buffers in window as set by the consumer.
|
||||
*
|
||||
* Available since API level 34.
|
||||
*
|
||||
* \return the dataspace of buffers in window, ADATASPACE_UNKNOWN is returned if
|
||||
* dataspace is unknown, or -EINVAL if window is invalid.
|
||||
*/
|
||||
int32_t ANativeWindow_getBuffersDefaultDataSpace(ANativeWindow* window) __INTRODUCED_IN(34);
|
||||
|
||||
/** Compatibility value for ANativeWindow_setFrameRate. */
|
||||
enum ANativeWindow_FrameRateCompatibility {
|
||||
/**
|
||||
* There are no inherent restrictions on the frame rate of this window. When
|
||||
* the system selects a frame rate other than what the app requested, the
|
||||
* app will be able to run at the system frame rate without requiring pull
|
||||
* down. This value should be used when displaying game content, UIs, and
|
||||
* anything that isn't video.
|
||||
* down. This value should be used when displaying game content.
|
||||
*/
|
||||
ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT = 0,
|
||||
/**
|
||||
|
|
@ -242,9 +255,51 @@ enum ANativeWindow_FrameRateCompatibility {
|
|||
* stuttering) than it would be if the system had chosen the app's requested
|
||||
* frame rate. This value should be used for video content.
|
||||
*/
|
||||
ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1
|
||||
ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1,
|
||||
|
||||
/**
|
||||
* The window requests a frame rate that is greater than or equal to the specified frame rate.
|
||||
* This value should be used for UIs, animations, scrolling, and anything that is not a game
|
||||
* or video.
|
||||
*/
|
||||
ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_GTE = 2
|
||||
};
|
||||
|
||||
/**
|
||||
* Same as ANativeWindow_setFrameRateWithChangeStrategy(window, frameRate, compatibility,
|
||||
* ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS).
|
||||
*
|
||||
* See ANativeWindow_setFrameRateWithChangeStrategy().
|
||||
*
|
||||
* Available since API level 30.
|
||||
*/
|
||||
int32_t ANativeWindow_setFrameRate(ANativeWindow* window, float frameRate, int8_t compatibility)
|
||||
__INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* Provides a hint to the window that buffers should be preallocated ahead of
|
||||
* time. Note that the window implementation is not guaranteed to preallocate
|
||||
* any buffers, for instance if an implementation disallows allocation of new
|
||||
* buffers, or if there is insufficient memory in the system to preallocate
|
||||
* additional buffers
|
||||
*
|
||||
* Available since API level 30.
|
||||
*/
|
||||
void ANativeWindow_tryAllocateBuffers(ANativeWindow* window) __INTRODUCED_IN(30);
|
||||
|
||||
/** Change frame rate strategy value for ANativeWindow_setFrameRate. */
|
||||
enum ANativeWindow_ChangeFrameRateStrategy {
|
||||
/**
|
||||
* Change the frame rate only if the transition is going to be seamless.
|
||||
*/
|
||||
ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS = 0,
|
||||
/**
|
||||
* Change the frame rate even if the transition is going to be non-seamless,
|
||||
* i.e. with visual interruptions for the user.
|
||||
*/
|
||||
ANATIVEWINDOW_CHANGE_FRAME_RATE_ALWAYS = 1
|
||||
} __INTRODUCED_IN(31);
|
||||
|
||||
/**
|
||||
* Sets the intended frame rate for this window.
|
||||
*
|
||||
|
|
@ -261,7 +316,14 @@ enum ANativeWindow_FrameRateCompatibility {
|
|||
* this ANativeWindow is consumed by something other than the system compositor,
|
||||
* e.g. a media codec, this call has no effect.
|
||||
*
|
||||
* Available since API level 30.
|
||||
* You can register for changes in the refresh rate using
|
||||
* \a AChoreographer_registerRefreshRateCallback.
|
||||
*
|
||||
* See ANativeWindow_clearFrameRate().
|
||||
*
|
||||
* Available since API level 31.
|
||||
*
|
||||
* \param window pointer to an ANativeWindow object.
|
||||
*
|
||||
* \param frameRate The intended frame rate of this window, in frames per
|
||||
* second. 0 is a special value that indicates the app will accept the system's
|
||||
|
|
@ -273,26 +335,57 @@ enum ANativeWindow_FrameRateCompatibility {
|
|||
* \param compatibility The frame rate compatibility of this window. The
|
||||
* compatibility value may influence the system's choice of display refresh
|
||||
* rate. See the ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_* values for more info.
|
||||
* This parameter is ignored when frameRate is 0.
|
||||
*
|
||||
* \param changeFrameRateStrategy Whether display refresh rate transitions caused by this
|
||||
* window should be seamless.
|
||||
* A seamless transition is one that doesn't have any visual interruptions, such as a black
|
||||
* screen for a second or two. See the ANATIVEWINDOW_CHANGE_FRAME_RATE_* values.
|
||||
* This parameter is ignored when frameRate is 0.
|
||||
*
|
||||
* \return 0 for success, -EINVAL if the window, frame rate, or compatibility
|
||||
* value are invalid.
|
||||
*/
|
||||
int32_t ANativeWindow_setFrameRate(ANativeWindow* window, float frameRate, int8_t compatibility)
|
||||
__INTRODUCED_IN(30);
|
||||
int32_t ANativeWindow_setFrameRateWithChangeStrategy(ANativeWindow* window, float frameRate,
|
||||
int8_t compatibility, int8_t changeFrameRateStrategy)
|
||||
__INTRODUCED_IN(31);
|
||||
|
||||
/**
|
||||
* Provides a hint to the window that buffers should be preallocated ahead of
|
||||
* time. Note that the window implementation is not guaranteed to preallocate
|
||||
* any buffers, for instance if an implementation disallows allocation of new
|
||||
* buffers, or if there is insufficient memory in the system to preallocate
|
||||
* additional buffers
|
||||
* Clears the frame rate which is set for this window.
|
||||
*
|
||||
* Available since API level 30.
|
||||
* This is equivalent to calling
|
||||
* ANativeWindow_setFrameRateWithChangeStrategy(window, 0, compatibility, changeFrameRateStrategy).
|
||||
*
|
||||
* Usage of this API won't introduce frame rate throttling,
|
||||
* or affect other aspects of the application's frame production
|
||||
* pipeline. However, because the system may change the display refresh rate,
|
||||
* calls to this function may result in changes to Choreographer callback
|
||||
* timings, and changes to the time interval at which the system releases
|
||||
* buffers back to the application.
|
||||
*
|
||||
* Note that this only has an effect for windows presented on the display. If
|
||||
* this ANativeWindow is consumed by something other than the system compositor,
|
||||
* e.g. a media codec, this call has no effect.
|
||||
*
|
||||
* You can register for changes in the refresh rate using
|
||||
* \a AChoreographer_registerRefreshRateCallback.
|
||||
*
|
||||
* See ANativeWindow_setFrameRateWithChangeStrategy().
|
||||
*
|
||||
* Available since API level 31.
|
||||
*
|
||||
* \param window pointer to an ANativeWindow object.
|
||||
*
|
||||
* \return 0 for success, -EINVAL if the window value is invalid.
|
||||
*/
|
||||
void ANativeWindow_tryAllocateBuffers(ANativeWindow* window);
|
||||
inline int32_t ANativeWindow_clearFrameRate(ANativeWindow* window) __INTRODUCED_IN(31) {
|
||||
return ANativeWindow_setFrameRateWithChangeStrategy(window, 0,
|
||||
ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT,
|
||||
ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // ANDROID_NATIVE_WINDOW_H
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ typedef struct ARect {
|
|||
} ARect;
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // ANDROID_RECT_H
|
||||
|
|
|
|||
|
|
@ -49,18 +49,28 @@ typedef struct native_handle
|
|||
typedef const native_handle_t* buffer_handle_t;
|
||||
|
||||
/*
|
||||
* native_handle_close
|
||||
*
|
||||
* closes the file descriptors contained in this native_handle_t
|
||||
*
|
||||
* Closes the file descriptors contained in this native_handle_t, which may
|
||||
* either be untagged or tagged for ownership by this native_handle_t via
|
||||
* native_handle_set_tag(). Mixing untagged and tagged fds in the same
|
||||
* native_handle_t is not permitted and triggers an fdsan exception, but
|
||||
* native_handle_set_fdsan_tag() can be used to bring consistency if this is
|
||||
* intentional.
|
||||
*
|
||||
* If it's known that fds are tagged, prefer native_handle_close_with_tag() for
|
||||
* better safety.
|
||||
*
|
||||
* return 0 on success, or a negative error code on failure
|
||||
*
|
||||
*/
|
||||
int native_handle_close(const native_handle_t* h);
|
||||
|
||||
/*
|
||||
* native_handle_init
|
||||
*
|
||||
* Equivalent to native_handle_close(), but throws an fdsan exception if the fds
|
||||
* are untagged. Use if it's known that the fds in this native_handle_t were
|
||||
* previously tagged via native_handle_set_tag().
|
||||
*/
|
||||
int native_handle_close_with_tag(const native_handle_t* h);
|
||||
|
||||
/*
|
||||
* Initializes a native_handle_t from storage. storage must be declared with
|
||||
* NATIVE_HANDLE_DECLARE_STORAGE. numFds and numInts must not respectively
|
||||
* exceed maxFds and maxInts used to declare the storage.
|
||||
|
|
@ -68,33 +78,42 @@ int native_handle_close(const native_handle_t* h);
|
|||
native_handle_t* native_handle_init(char* storage, int numFds, int numInts);
|
||||
|
||||
/*
|
||||
* native_handle_create
|
||||
*
|
||||
* creates a native_handle_t and initializes it. must be destroyed with
|
||||
* Creates a native_handle_t and initializes it. Must be destroyed with
|
||||
* native_handle_delete(). Note that numFds must be <= NATIVE_HANDLE_MAX_FDS,
|
||||
* numInts must be <= NATIVE_HANDLE_MAX_INTS, and both must be >= 0.
|
||||
*
|
||||
*/
|
||||
native_handle_t* native_handle_create(int numFds, int numInts);
|
||||
|
||||
/*
|
||||
* native_handle_clone
|
||||
*
|
||||
* creates a native_handle_t and initializes it from another native_handle_t.
|
||||
* Updates the fdsan tag for any file descriptors contained in the supplied
|
||||
* handle to indicate that they are owned by this handle and should only be
|
||||
* closed via native_handle_close()/native_handle_close_with_tag(). Each fd in
|
||||
* the handle must have a tag of either 0 (unset) or the tag associated with
|
||||
* this handle, otherwise an fdsan exception will be triggered.
|
||||
*/
|
||||
void native_handle_set_fdsan_tag(const native_handle_t* handle);
|
||||
|
||||
/*
|
||||
* Clears the fdsan tag for any file descriptors contained in the supplied
|
||||
* native_handle_t. Use if this native_handle_t is giving up ownership of its
|
||||
* fds, but the fdsan tags were previously set. Each fd in the handle must have
|
||||
* a tag of either 0 (unset) or the tag associated with this handle, otherwise
|
||||
* an fdsan exception will be triggered.
|
||||
*/
|
||||
void native_handle_unset_fdsan_tag(const native_handle_t* handle);
|
||||
|
||||
/*
|
||||
* Creates a native_handle_t and initializes it from another native_handle_t.
|
||||
* Must be destroyed with native_handle_delete().
|
||||
*
|
||||
*/
|
||||
native_handle_t* native_handle_clone(const native_handle_t* handle);
|
||||
|
||||
/*
|
||||
* native_handle_delete
|
||||
*
|
||||
* frees a native_handle_t allocated with native_handle_create().
|
||||
* Frees a native_handle_t allocated with native_handle_create().
|
||||
* This ONLY frees the memory allocated for the native_handle_t, but doesn't
|
||||
* close the file descriptors; which can be achieved with native_handle_close().
|
||||
*
|
||||
*
|
||||
* return 0 on success, or a negative error code on failure
|
||||
*
|
||||
*/
|
||||
int native_handle_delete(native_handle_t* h);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,8 +54,9 @@ typedef union {
|
|||
/* A hwvulkan_device_t corresponds to an ICD on other systems. Currently there
|
||||
* can only be one on a system (HWVULKAN_DEVICE_0). It is opened once per
|
||||
* process when the Vulkan API is first used; the hw_device_t::close() function
|
||||
* is never called. Any non-trivial resource allocation should be done when
|
||||
* the VkInstance is created rather than when the hwvulkan_device_t is opened.
|
||||
* is called upon driver unloading. Any non-trivial resource allocation should
|
||||
* be done when the VkInstance is created rather than when the hwvulkan_device_t
|
||||
* is opened.
|
||||
*/
|
||||
typedef struct hwvulkan_device_t {
|
||||
struct hw_device_t common;
|
||||
|
|
|
|||
|
|
@ -14,12 +14,16 @@ typedef enum {
|
|||
} android_hdr_v1_2_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_DATASPACE_DISPLAY_BT2020 = 142999552 /* ((STANDARD_BT2020 | TRANSFER_SRGB) | RANGE_FULL) */,
|
||||
HAL_DATASPACE_DISPLAY_BT2020 = 142999552 /* STANDARD_BT2020 | TRANSFER_SRGB | RANGE_FULL */,
|
||||
HAL_DATASPACE_DYNAMIC_DEPTH = 4098 /* 0x1002 */,
|
||||
HAL_DATASPACE_JPEG_APP_SEGMENTS = 4099 /* 0x1003 */,
|
||||
HAL_DATASPACE_HEIF = 4100 /* 0x1004 */,
|
||||
} android_dataspace_v1_2_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_COLOR_MODE_DISPLAY_BT2020 = 13,
|
||||
} android_color_mode_v1_2_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_PIXEL_FORMAT_HSV_888 = 55 /* 0x37 */,
|
||||
} android_pixel_format_v1_2_t;
|
||||
|
|
|
|||
|
|
@ -59,12 +59,14 @@ typedef android_hdr_t android_hdr;
|
|||
|
||||
/*
|
||||
* Structure for describing YCbCr formats for consumption by applications.
|
||||
* This is used with HAL_PIXEL_FORMAT_YCbCr_*_888.
|
||||
* This is used with HAL_PIXEL_FORMAT_YCbCr_*.
|
||||
*
|
||||
* Buffer chroma subsampling is defined in the format.
|
||||
* e.g. HAL_PIXEL_FORMAT_YCbCr_420_888 has subsampling 4:2:0.
|
||||
*
|
||||
* Buffers must have a 8 bit depth.
|
||||
* Buffers must have a byte aligned channel depth or a byte aligned packed
|
||||
* channel depth (e.g. 10 bits packed into 16 bits for
|
||||
* HAL_PIXEL_FORMAT_YCbCr_P010).
|
||||
*
|
||||
* y, cb, and cr point to the first byte of their respective planes.
|
||||
*
|
||||
|
|
@ -75,8 +77,8 @@ typedef android_hdr_t android_hdr;
|
|||
* cstride is the stride of the chroma planes.
|
||||
*
|
||||
* chroma_step is the distance in bytes from one chroma pixel value to the
|
||||
* next. This is 2 bytes for semiplanar (because chroma values are interleaved
|
||||
* and each chroma value is one byte) and 1 for planar.
|
||||
* next. This is `2 * channel depth` bytes for semiplanar (because chroma
|
||||
* values are interleaved) and `1 * channel depth` bytes for planar.
|
||||
*/
|
||||
|
||||
struct android_ycbcr {
|
||||
|
|
|
|||
|
|
@ -21,10 +21,18 @@
|
|||
#include <android/hardware_buffer.h>
|
||||
|
||||
#include <cutils/native_handle.h>
|
||||
#include <errno.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
const native_handle_t* AHardwareBuffer_getNativeHandle(const AHardwareBuffer* buffer);
|
||||
/**
|
||||
* Get the native handle from an AHardwareBuffer.
|
||||
*
|
||||
* \return a non-NULL native handle on success, NULL if \a buffer is nullptr or the operation fails
|
||||
* for any reason.
|
||||
*/
|
||||
const native_handle_t* _Nullable AHardwareBuffer_getNativeHandle(
|
||||
const AHardwareBuffer* _Nonnull buffer);
|
||||
|
||||
enum CreateFromHandleMethod {
|
||||
// enum values chosen to match internal GraphicBuffer::HandleWrapMethod
|
||||
|
|
@ -33,9 +41,9 @@ enum CreateFromHandleMethod {
|
|||
};
|
||||
|
||||
/**
|
||||
* Create a AHardwareBuffer from a native handle.
|
||||
* Create an AHardwareBuffer from a native handle.
|
||||
*
|
||||
* This function wraps a native handle in a AHardwareBuffer suitable for use by applications or
|
||||
* This function wraps a native handle in an AHardwareBuffer suitable for use by applications or
|
||||
* other parts of the system. The contents of desc will be returned by AHardwareBuffer_describe().
|
||||
*
|
||||
* If method is AHARDWAREBUFFER_CREATE_FROM_HANDLE_METHOD_REGISTER, the handle is assumed to be
|
||||
|
|
@ -44,10 +52,13 @@ enum CreateFromHandleMethod {
|
|||
*
|
||||
* If method is AHARDWAREBUFFER_CREATE_FROM_HANDLE_METHOD_CLONE, the handle will be cloned and the
|
||||
* clone registered. The AHardwareBuffer will own the cloned handle but not the original.
|
||||
*
|
||||
* \return 0 on success, -EINVAL if \a desc or \a handle or outBuffer is NULL, or an error number if
|
||||
* the operation fails for any reason.
|
||||
*/
|
||||
int AHardwareBuffer_createFromHandle(const AHardwareBuffer_Desc* desc,
|
||||
const native_handle_t* handle, int32_t method,
|
||||
AHardwareBuffer** outBuffer);
|
||||
int AHardwareBuffer_createFromHandle(const AHardwareBuffer_Desc* _Nonnull desc,
|
||||
const native_handle_t* _Nonnull handle, int32_t method,
|
||||
AHardwareBuffer* _Nullable* _Nonnull outBuffer);
|
||||
|
||||
/**
|
||||
* Buffer pixel formats.
|
||||
|
|
@ -95,6 +106,76 @@ enum {
|
|||
AHARDWAREBUFFER_USAGE_CAMERA_MASK = 6UL << 16,
|
||||
};
|
||||
|
||||
/**
|
||||
* Additional options for AHardwareBuffer_allocateWithOptions. These correspond to
|
||||
* android.hardware.graphics.common.ExtendableType
|
||||
*/
|
||||
typedef struct {
|
||||
const char* _Nonnull name;
|
||||
int64_t value;
|
||||
} AHardwareBufferLongOptions;
|
||||
|
||||
enum AHardwareBufferStatus : int32_t {
|
||||
/* Success, no error */
|
||||
AHARDWAREBUFFER_STATUS_OK = 0,
|
||||
/* There's insufficient memory to satisfy the request */
|
||||
AHARDWAREBUFFER_STATUS_NO_MEMORY = -ENOMEM,
|
||||
/* The given argument is invalid */
|
||||
AHARDWAREBUFFER_STATUS_BAD_VALUE = -EINVAL,
|
||||
/* The requested operation is not supported by the device */
|
||||
AHARDWAREBUFFER_STATUS_UNSUPPORTED = -ENOSYS,
|
||||
/* An unknown error occurred */
|
||||
AHARDWAREBUFFER_STATUS_UNKNOWN_ERROR = (-2147483647 - 1),
|
||||
};
|
||||
|
||||
/**
|
||||
* Allocates a buffer that matches the passed AHardwareBuffer_Desc with additional options
|
||||
*
|
||||
* If allocation succeeds, the buffer can be used according to the
|
||||
* usage flags specified in its description. If a buffer is used in ways
|
||||
* not compatible with its usage flags, the results are undefined and
|
||||
* may include program termination.
|
||||
*
|
||||
* @param desc The AHardwareBuffer_Desc that describes the allocation to request. Note that `stride`
|
||||
* is ignored.
|
||||
* @param additionalOptions A pointer to an array of AHardwareBufferLongOptions with additional
|
||||
* string key + long value options that may be specified. May be null if
|
||||
* `additionalOptionsSize` is 0
|
||||
* @param additionalOptionsSize The number of additional options to pass
|
||||
* @param outBuffer The resulting buffer allocation
|
||||
* @return AHARDWAREBUFFER_STATUS_OK on success
|
||||
* AHARDWAREBUFFER_STATUS_NO_MEMORY if there's insufficient resources for the allocation
|
||||
* AHARDWAREBUFFER_STATUS_BAD_VALUE if the provided description & options are not supported
|
||||
* by the device
|
||||
* AHARDWAREBUFFER_STATUS_UNKNOWN_ERROR for any other error
|
||||
* any reason. The returned buffer has a reference count of 1.
|
||||
*/
|
||||
enum AHardwareBufferStatus AHardwareBuffer_allocateWithOptions(
|
||||
const AHardwareBuffer_Desc* _Nonnull desc,
|
||||
const AHardwareBufferLongOptions* _Nullable additionalOptions, size_t additionalOptionsSize,
|
||||
AHardwareBuffer* _Nullable* _Nonnull outBuffer) __INTRODUCED_IN(__ANDROID_API_V__);
|
||||
|
||||
/**
|
||||
* Queries the dataspace of the given AHardwareBuffer.
|
||||
*
|
||||
* @param buffer The non-null buffer for which to query the Dataspace
|
||||
* @return The dataspace of the buffer, or ADATASPACE_UNKNOWN if one hasn't been set
|
||||
*/
|
||||
enum ADataSpace AHardwareBuffer_getDataSpace(const AHardwareBuffer* _Nonnull buffer)
|
||||
__INTRODUCED_IN(__ANDROID_API_V__);
|
||||
|
||||
/**
|
||||
* Sets the dataspace of the given AHardwareBuffer
|
||||
* @param buffer The non-null buffer for which to set the dataspace
|
||||
* @param dataSpace The dataspace to set
|
||||
* @return AHARDWAREBUFFER_STATUS_OK on success,
|
||||
* AHARDWAREBUFFER_STATUS_UNSUPPORTED if the device doesn't support setting the dataspace,
|
||||
* AHARDWAREBUFFER_STATUS_UNKNOWN_ERROR for any other failure.
|
||||
*/
|
||||
enum AHardwareBufferStatus AHardwareBuffer_setDataSpace(AHardwareBuffer* _Nonnull buffer,
|
||||
enum ADataSpace dataSpace)
|
||||
__INTRODUCED_IN(__ANDROID_API_V__);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ANDROID_VNDK_NATIVEWINDOW_AHARDWAREBUFFER_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue