1*4d7e907cSAndroid Build Coastguard Worker/* 2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2018 The Android Open Source Project 3*4d7e907cSAndroid Build Coastguard Worker * 4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*4d7e907cSAndroid Build Coastguard Worker * 8*4d7e907cSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*4d7e907cSAndroid Build Coastguard Worker * 10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License. 15*4d7e907cSAndroid Build Coastguard Worker */ 16*4d7e907cSAndroid Build Coastguard Worker 17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected]; 18*4d7e907cSAndroid Build Coastguard Worker 19*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::RenderIntent; 20*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::PixelFormat; 21*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::ColorMode; 22*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::Dataspace; 23*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::Hdr; 24*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::IComposerClient.Command; 25*4d7e907cSAndroid Build Coastguard Workerimport @2.2::IComposerClient; 26*4d7e907cSAndroid Build Coastguard Workerimport @2.1::Display; 27*4d7e907cSAndroid Build Coastguard Workerimport @2.1::Error; 28*4d7e907cSAndroid Build Coastguard Worker 29*4d7e907cSAndroid Build Coastguard Workerinterface IComposerClient extends @2.2::IComposerClient { 30*4d7e907cSAndroid Build Coastguard Worker 31*4d7e907cSAndroid Build Coastguard Worker /** 32*4d7e907cSAndroid Build Coastguard Worker * Required capabilities which are supported by the display. The 33*4d7e907cSAndroid Build Coastguard Worker * particular set of supported capabilities for a given display may be 34*4d7e907cSAndroid Build Coastguard Worker * retrieved using getDisplayCapabilities. 35*4d7e907cSAndroid Build Coastguard Worker */ 36*4d7e907cSAndroid Build Coastguard Worker enum DisplayCapability : uint32_t { 37*4d7e907cSAndroid Build Coastguard Worker INVALID = 0, 38*4d7e907cSAndroid Build Coastguard Worker 39*4d7e907cSAndroid Build Coastguard Worker /** 40*4d7e907cSAndroid Build Coastguard Worker * Indicates that the display must apply a color transform even when 41*4d7e907cSAndroid Build Coastguard Worker * either the client or the device has chosen that all layers should 42*4d7e907cSAndroid Build Coastguard Worker * be composed by the client. This prevents the client from applying 43*4d7e907cSAndroid Build Coastguard Worker * the color transform during its composition step. 44*4d7e907cSAndroid Build Coastguard Worker * If getDisplayCapabilities is supported, the global capability 45*4d7e907cSAndroid Build Coastguard Worker * SKIP_CLIENT_COLOR_TRANSFORM is ignored. 46*4d7e907cSAndroid Build Coastguard Worker * If getDisplayCapabilities is not supported, and the global capability 47*4d7e907cSAndroid Build Coastguard Worker * SKIP_CLIENT_COLOR_TRANSFORM is returned by getCapabilities, 48*4d7e907cSAndroid Build Coastguard Worker * then all displays must be treated as having 49*4d7e907cSAndroid Build Coastguard Worker * SKIP_CLIENT_COLOR_TRANSFORM. 50*4d7e907cSAndroid Build Coastguard Worker */ 51*4d7e907cSAndroid Build Coastguard Worker SKIP_CLIENT_COLOR_TRANSFORM = 1, 52*4d7e907cSAndroid Build Coastguard Worker 53*4d7e907cSAndroid Build Coastguard Worker /** 54*4d7e907cSAndroid Build Coastguard Worker * Indicates that the display supports PowerMode::DOZE and 55*4d7e907cSAndroid Build Coastguard Worker * PowerMode::DOZE_SUSPEND. DOZE_SUSPEND may not provide any benefit 56*4d7e907cSAndroid Build Coastguard Worker * over DOZE (see the definition of PowerMode for more information), 57*4d7e907cSAndroid Build Coastguard Worker * but if both DOZE and DOZE_SUSPEND are no different from 58*4d7e907cSAndroid Build Coastguard Worker * PowerMode::ON, the device must not claim support. 59*4d7e907cSAndroid Build Coastguard Worker * Must be returned by getDisplayCapabilities when getDozeSupport 60*4d7e907cSAndroid Build Coastguard Worker * indicates the display supports PowerMode::DOZE and 61*4d7e907cSAndroid Build Coastguard Worker * PowerMode::DOZE_SUSPEND. 62*4d7e907cSAndroid Build Coastguard Worker */ 63*4d7e907cSAndroid Build Coastguard Worker DOZE = 2, 64*4d7e907cSAndroid Build Coastguard Worker 65*4d7e907cSAndroid Build Coastguard Worker /** 66*4d7e907cSAndroid Build Coastguard Worker * Indicates that the display supports brightness operations. 67*4d7e907cSAndroid Build Coastguard Worker */ 68*4d7e907cSAndroid Build Coastguard Worker BRIGHTNESS = 3, 69*4d7e907cSAndroid Build Coastguard Worker }; 70*4d7e907cSAndroid Build Coastguard Worker 71*4d7e907cSAndroid Build Coastguard Worker /** 72*4d7e907cSAndroid Build Coastguard Worker * PerFrameMetadataKey 73*4d7e907cSAndroid Build Coastguard Worker * 74*4d7e907cSAndroid Build Coastguard Worker * A set of PerFrameMetadataKey pertains specifically to blob-formatted 75*4d7e907cSAndroid Build Coastguard Worker * metadata (as opposed to float-valued metadata). 76*4d7e907cSAndroid Build Coastguard Worker * The list of keys that represent blobs are: 77*4d7e907cSAndroid Build Coastguard Worker * 1. HDR10_PLUS_SEI 78*4d7e907cSAndroid Build Coastguard Worker */ 79*4d7e907cSAndroid Build Coastguard Worker enum PerFrameMetadataKey : @2.2::IComposerClient.PerFrameMetadataKey { 80*4d7e907cSAndroid Build Coastguard Worker /**HDR10+ metadata 81*4d7e907cSAndroid Build Coastguard Worker * Specifies a metadata blob adhering to 82*4d7e907cSAndroid Build Coastguard Worker * the ST2094-40 SEI message spec, Version 1.0 83*4d7e907cSAndroid Build Coastguard Worker */ 84*4d7e907cSAndroid Build Coastguard Worker HDR10_PLUS_SEI, 85*4d7e907cSAndroid Build Coastguard Worker }; 86*4d7e907cSAndroid Build Coastguard Worker 87*4d7e907cSAndroid Build Coastguard Worker /** 88*4d7e907cSAndroid Build Coastguard Worker * PerFrameMetadata 89*4d7e907cSAndroid Build Coastguard Worker * This struct encapsulates float-valued 90*4d7e907cSAndroid Build Coastguard Worker * metadata - key must not be in the list 91*4d7e907cSAndroid Build Coastguard Worker * of keys representing blob-formatted metadata 92*4d7e907cSAndroid Build Coastguard Worker * (see PerFrameMetadataKey) 93*4d7e907cSAndroid Build Coastguard Worker */ 94*4d7e907cSAndroid Build Coastguard Worker struct PerFrameMetadata { 95*4d7e907cSAndroid Build Coastguard Worker PerFrameMetadataKey key; 96*4d7e907cSAndroid Build Coastguard Worker float value; 97*4d7e907cSAndroid Build Coastguard Worker }; 98*4d7e907cSAndroid Build Coastguard Worker 99*4d7e907cSAndroid Build Coastguard Worker /** 100*4d7e907cSAndroid Build Coastguard Worker * PerFrameMetadataBlob 101*4d7e907cSAndroid Build Coastguard Worker * This struct encapsulates blob 102*4d7e907cSAndroid Build Coastguard Worker * metadata - key must be one of the list of keys 103*4d7e907cSAndroid Build Coastguard Worker * associated with blob-type metadata key 104*4d7e907cSAndroid Build Coastguard Worker * and the blob must adhere to the format specified by 105*4d7e907cSAndroid Build Coastguard Worker * that key (See PerFrameMetadataKey). 106*4d7e907cSAndroid Build Coastguard Worker */ 107*4d7e907cSAndroid Build Coastguard Worker struct PerFrameMetadataBlob { 108*4d7e907cSAndroid Build Coastguard Worker PerFrameMetadataKey key; 109*4d7e907cSAndroid Build Coastguard Worker vec<uint8_t> blob; 110*4d7e907cSAndroid Build Coastguard Worker }; 111*4d7e907cSAndroid Build Coastguard Worker 112*4d7e907cSAndroid Build Coastguard Worker enum Command : @2.2::IComposerClient.Command { 113*4d7e907cSAndroid Build Coastguard Worker /** 114*4d7e907cSAndroid Build Coastguard Worker * SET_LAYER_COLOR_TRANSFORM has this pseudo prototype 115*4d7e907cSAndroid Build Coastguard Worker * 116*4d7e907cSAndroid Build Coastguard Worker * setLayerColorTransform(float[16] matrix); 117*4d7e907cSAndroid Build Coastguard Worker * 118*4d7e907cSAndroid Build Coastguard Worker * This command has the following binary layout in bytes: 119*4d7e907cSAndroid Build Coastguard Worker * 120*4d7e907cSAndroid Build Coastguard Worker * 0 - 16 * 4: matrix 121*4d7e907cSAndroid Build Coastguard Worker * 122*4d7e907cSAndroid Build Coastguard Worker * Sets a matrix for color transform which will be applied on this layer 123*4d7e907cSAndroid Build Coastguard Worker * before composition. 124*4d7e907cSAndroid Build Coastguard Worker * 125*4d7e907cSAndroid Build Coastguard Worker * If the device is not capable of apply the matrix on this layer, it must force 126*4d7e907cSAndroid Build Coastguard Worker * this layer to client composition during VALIDATE_DISPLAY. 127*4d7e907cSAndroid Build Coastguard Worker * 128*4d7e907cSAndroid Build Coastguard Worker * The matrix provided is an affine color transformation of the following 129*4d7e907cSAndroid Build Coastguard Worker * form: 130*4d7e907cSAndroid Build Coastguard Worker * 131*4d7e907cSAndroid Build Coastguard Worker * |r.r r.g r.b 0| 132*4d7e907cSAndroid Build Coastguard Worker * |g.r g.g g.b 0| 133*4d7e907cSAndroid Build Coastguard Worker * |b.r b.g b.b 0| 134*4d7e907cSAndroid Build Coastguard Worker * |Tr Tg Tb 1| 135*4d7e907cSAndroid Build Coastguard Worker * 136*4d7e907cSAndroid Build Coastguard Worker * This matrix must be provided in row-major form: 137*4d7e907cSAndroid Build Coastguard Worker * 138*4d7e907cSAndroid Build Coastguard Worker * {r.r, r.g, r.b, 0, g.r, ...}. 139*4d7e907cSAndroid Build Coastguard Worker * 140*4d7e907cSAndroid Build Coastguard Worker * Given a matrix of this form and an input color [R_in, G_in, B_in], 141*4d7e907cSAndroid Build Coastguard Worker * the input color must first be converted to linear space 142*4d7e907cSAndroid Build Coastguard Worker * [R_linear, G_linear, B_linear], then the output linear color 143*4d7e907cSAndroid Build Coastguard Worker * [R_out_linear, G_out_linear, B_out_linear] will be: 144*4d7e907cSAndroid Build Coastguard Worker * 145*4d7e907cSAndroid Build Coastguard Worker * R_out_linear = R_linear * r.r + G_linear * g.r + B_linear * b.r + Tr 146*4d7e907cSAndroid Build Coastguard Worker * G_out_linear = R_linear * r.g + G_linear * g.g + B_linear * b.g + Tg 147*4d7e907cSAndroid Build Coastguard Worker * B_out_linear = R_linear * r.b + G_linear * g.b + B_linear * b.b + Tb 148*4d7e907cSAndroid Build Coastguard Worker * 149*4d7e907cSAndroid Build Coastguard Worker * [R_out_linear, G_out_linear, B_out_linear] must then be converted to 150*4d7e907cSAndroid Build Coastguard Worker * gamma space: [R_out, G_out, B_out] before blending. 151*4d7e907cSAndroid Build Coastguard Worker * 152*4d7e907cSAndroid Build Coastguard Worker * @param matrix is a 4x4 transform matrix (16 floats) as described above. 153*4d7e907cSAndroid Build Coastguard Worker */ 154*4d7e907cSAndroid Build Coastguard Worker SET_LAYER_COLOR_TRANSFORM = 0x40d << @2.1::IComposerClient.Command:OPCODE_SHIFT, 155*4d7e907cSAndroid Build Coastguard Worker 156*4d7e907cSAndroid Build Coastguard Worker /* SET_LAYER_PER_FRAME_METADATA_BLOBS has this pseudo prototype 157*4d7e907cSAndroid Build Coastguard Worker * 158*4d7e907cSAndroid Build Coastguard Worker * setLayerPerFrameMetadataBlobs(Display display, Layer layer, 159*4d7e907cSAndroid Build Coastguard Worker * vec<PerFrameMetadataBlob> metadata); 160*4d7e907cSAndroid Build Coastguard Worker * 161*4d7e907cSAndroid Build Coastguard Worker * This command sends metadata that may be used for tone-mapping the 162*4d7e907cSAndroid Build Coastguard Worker * associated layer. The metadata structure follows a {key, blob} 163*4d7e907cSAndroid Build Coastguard Worker * format (see the PerFrameMetadataBlob struct). All keys must be 164*4d7e907cSAndroid Build Coastguard Worker * returned by a prior call to getPerFrameMetadataKeys and must 165*4d7e907cSAndroid Build Coastguard Worker * be part of the list of keys associated with blob-type metadata 166*4d7e907cSAndroid Build Coastguard Worker * (see PerFrameMetadataKey). 167*4d7e907cSAndroid Build Coastguard Worker * 168*4d7e907cSAndroid Build Coastguard Worker * This method may be called every frame. 169*4d7e907cSAndroid Build Coastguard Worker */ 170*4d7e907cSAndroid Build Coastguard Worker SET_LAYER_PER_FRAME_METADATA_BLOBS = 0x304 << @2.1::IComposerClient.Command:OPCODE_SHIFT, 171*4d7e907cSAndroid Build Coastguard Worker }; 172*4d7e907cSAndroid Build Coastguard Worker 173*4d7e907cSAndroid Build Coastguard Worker /** 174*4d7e907cSAndroid Build Coastguard Worker * Returns the port and data that describe a physical display. The port is 175*4d7e907cSAndroid Build Coastguard Worker * a unique number that identifies a physical connector (e.g. eDP, HDMI) 176*4d7e907cSAndroid Build Coastguard Worker * for display output. The data blob is parsed to determine its format, 177*4d7e907cSAndroid Build Coastguard Worker * typically EDID 1.3 as specified in VESA E-EDID Standard Release A 178*4d7e907cSAndroid Build Coastguard Worker * Revision 1. 179*4d7e907cSAndroid Build Coastguard Worker * 180*4d7e907cSAndroid Build Coastguard Worker * @param display is the display to query. 181*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 182*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when an invalid display handle was passed in. 183*4d7e907cSAndroid Build Coastguard Worker * UNSUPPORTED when identification data is unavailable. 184*4d7e907cSAndroid Build Coastguard Worker * @return port is the connector to which the display is connected. 185*4d7e907cSAndroid Build Coastguard Worker * @return data is the EDID 1.3 blob identifying the display. 186*4d7e907cSAndroid Build Coastguard Worker */ 187*4d7e907cSAndroid Build Coastguard Worker @callflow(next="*") 188*4d7e907cSAndroid Build Coastguard Worker getDisplayIdentificationData(Display display) 189*4d7e907cSAndroid Build Coastguard Worker generates (Error error, 190*4d7e907cSAndroid Build Coastguard Worker uint8_t port, 191*4d7e907cSAndroid Build Coastguard Worker vec<uint8_t> data); 192*4d7e907cSAndroid Build Coastguard Worker /** 193*4d7e907cSAndroid Build Coastguard Worker * getReadbackBufferAttributes_2_3 194*4d7e907cSAndroid Build Coastguard Worker * Returns the format which should be used when allocating a buffer for use by 195*4d7e907cSAndroid Build Coastguard Worker * device readback as well as the dataspace in which its contents must be 196*4d7e907cSAndroid Build Coastguard Worker * interpreted. 197*4d7e907cSAndroid Build Coastguard Worker * 198*4d7e907cSAndroid Build Coastguard Worker * The width and height of this buffer must be those of the currently-active 199*4d7e907cSAndroid Build Coastguard Worker * display configuration, and the usage flags must consist of the following: 200*4d7e907cSAndroid Build Coastguard Worker * BufferUsage::CPU_READ | BufferUsage::GPU_TEXTURE | 201*4d7e907cSAndroid Build Coastguard Worker * BufferUsage::COMPOSER_OUTPUT 202*4d7e907cSAndroid Build Coastguard Worker * 203*4d7e907cSAndroid Build Coastguard Worker * The format and dataspace provided must be sufficient such that if a 204*4d7e907cSAndroid Build Coastguard Worker * correctly-configured buffer is passed into setReadbackBuffer, filled by 205*4d7e907cSAndroid Build Coastguard Worker * the device, and then displayed by the client as a full-screen buffer, the 206*4d7e907cSAndroid Build Coastguard Worker * output of the display remains the same (subject to the note about protected 207*4d7e907cSAndroid Build Coastguard Worker * content in the description of setReadbackBuffer). 208*4d7e907cSAndroid Build Coastguard Worker * 209*4d7e907cSAndroid Build Coastguard Worker * If the active configuration or color mode of this display has changed 210*4d7e907cSAndroid Build Coastguard Worker * since a previous call to this function, it must be called again prior to 211*4d7e907cSAndroid Build Coastguard Worker * setting a readback buffer such that the returned format and dataspace will 212*4d7e907cSAndroid Build Coastguard Worker * be updated accordingly. 213*4d7e907cSAndroid Build Coastguard Worker * 214*4d7e907cSAndroid Build Coastguard Worker * Parameters: 215*4d7e907cSAndroid Build Coastguard Worker * @param display - the display on which to create the layer. 216*4d7e907cSAndroid Build Coastguard Worker * 217*4d7e907cSAndroid Build Coastguard Worker * @return format - the format the client should use when allocating a device 218*4d7e907cSAndroid Build Coastguard Worker * readback buffer 219*4d7e907cSAndroid Build Coastguard Worker * @return dataspace - the dataspace to use when interpreting the 220*4d7e907cSAndroid Build Coastguard Worker * contents of a device readback buffer 221*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 222*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when an invalid display handle was passed in. 223*4d7e907cSAndroid Build Coastguard Worker * UNSUPPORTED if not supported on underlying HAL 224*4d7e907cSAndroid Build Coastguard Worker * 225*4d7e907cSAndroid Build Coastguard Worker * See also: 226*4d7e907cSAndroid Build Coastguard Worker * setReadbackBuffer 227*4d7e907cSAndroid Build Coastguard Worker * getReadbackBufferFence 228*4d7e907cSAndroid Build Coastguard Worker */ 229*4d7e907cSAndroid Build Coastguard Worker getReadbackBufferAttributes_2_3(Display display) 230*4d7e907cSAndroid Build Coastguard Worker generates (Error error, 231*4d7e907cSAndroid Build Coastguard Worker PixelFormat format, 232*4d7e907cSAndroid Build Coastguard Worker Dataspace dataspace); 233*4d7e907cSAndroid Build Coastguard Worker 234*4d7e907cSAndroid Build Coastguard Worker /** 235*4d7e907cSAndroid Build Coastguard Worker * getClientTargetSupport_2_3 236*4d7e907cSAndroid Build Coastguard Worker * Returns whether a client target with the given properties can be 237*4d7e907cSAndroid Build Coastguard Worker * handled by the device. 238*4d7e907cSAndroid Build Coastguard Worker * 239*4d7e907cSAndroid Build Coastguard Worker * This function must return true for a client target with width and 240*4d7e907cSAndroid Build Coastguard Worker * height equal to the active display configuration dimensions, 241*4d7e907cSAndroid Build Coastguard Worker * PixelFormat::RGBA_8888, and Dataspace::UNKNOWN. It is not required to 242*4d7e907cSAndroid Build Coastguard Worker * return true for any other configuration. 243*4d7e907cSAndroid Build Coastguard Worker * 244*4d7e907cSAndroid Build Coastguard Worker * @param display is the display to query. 245*4d7e907cSAndroid Build Coastguard Worker * @param width is the client target width in pixels. 246*4d7e907cSAndroid Build Coastguard Worker * @param height is the client target height in pixels. 247*4d7e907cSAndroid Build Coastguard Worker * @param format is the client target format. 248*4d7e907cSAndroid Build Coastguard Worker * @param dataspace is the client target dataspace, as described in 249*4d7e907cSAndroid Build Coastguard Worker * setLayerDataspace. 250*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 251*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when an invalid display handle was passed in. 252*4d7e907cSAndroid Build Coastguard Worker * UNSUPPORTED when the given configuration is not supported. 253*4d7e907cSAndroid Build Coastguard Worker */ 254*4d7e907cSAndroid Build Coastguard Worker @callflow(next="*") 255*4d7e907cSAndroid Build Coastguard Worker getClientTargetSupport_2_3(Display display, 256*4d7e907cSAndroid Build Coastguard Worker uint32_t width, 257*4d7e907cSAndroid Build Coastguard Worker uint32_t height, 258*4d7e907cSAndroid Build Coastguard Worker PixelFormat format, 259*4d7e907cSAndroid Build Coastguard Worker Dataspace dataspace) 260*4d7e907cSAndroid Build Coastguard Worker generates (Error error); 261*4d7e907cSAndroid Build Coastguard Worker 262*4d7e907cSAndroid Build Coastguard Worker enum FormatColorComponent : uint8_t { 263*4d7e907cSAndroid Build Coastguard Worker /* The first component (eg, for RGBA_8888, this is R) */ 264*4d7e907cSAndroid Build Coastguard Worker FORMAT_COMPONENT_0 = 1 << 0, 265*4d7e907cSAndroid Build Coastguard Worker /* The second component (eg, for RGBA_8888, this is G) */ 266*4d7e907cSAndroid Build Coastguard Worker FORMAT_COMPONENT_1 = 1 << 1, 267*4d7e907cSAndroid Build Coastguard Worker /* The third component (eg, for RGBA_8888, this is B) */ 268*4d7e907cSAndroid Build Coastguard Worker FORMAT_COMPONENT_2 = 1 << 2, 269*4d7e907cSAndroid Build Coastguard Worker /* The fourth component (eg, for RGBA_8888, this is A) */ 270*4d7e907cSAndroid Build Coastguard Worker FORMAT_COMPONENT_3 = 1 << 3, 271*4d7e907cSAndroid Build Coastguard Worker }; 272*4d7e907cSAndroid Build Coastguard Worker 273*4d7e907cSAndroid Build Coastguard Worker /** 274*4d7e907cSAndroid Build Coastguard Worker * Query for what types of color sampling the hardware supports. 275*4d7e907cSAndroid Build Coastguard Worker * 276*4d7e907cSAndroid Build Coastguard Worker * @param display is the display where the samples are collected. 277*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 278*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when an invalid display was passed in, or 279*4d7e907cSAndroid Build Coastguard Worker * UNSUPPORTED when there is no efficient way to sample. 280*4d7e907cSAndroid Build Coastguard Worker * @return format The format of the sampled pixels. 281*4d7e907cSAndroid Build Coastguard Worker * @return dataspace The dataspace of the sampled pixels. 282*4d7e907cSAndroid Build Coastguard Worker * @return componentMask The mask of which components can be sampled. 283*4d7e907cSAndroid Build Coastguard Worker */ 284*4d7e907cSAndroid Build Coastguard Worker getDisplayedContentSamplingAttributes(Display display) 285*4d7e907cSAndroid Build Coastguard Worker generates (Error error, 286*4d7e907cSAndroid Build Coastguard Worker PixelFormat format, 287*4d7e907cSAndroid Build Coastguard Worker Dataspace dataspace, 288*4d7e907cSAndroid Build Coastguard Worker bitfield<FormatColorComponent> componentMask); 289*4d7e907cSAndroid Build Coastguard Worker 290*4d7e907cSAndroid Build Coastguard Worker /** DisplayedContentSampling values passed to setDisplayedContentSamplingEnabled. */ 291*4d7e907cSAndroid Build Coastguard Worker enum DisplayedContentSampling : int32_t { 292*4d7e907cSAndroid Build Coastguard Worker INVALID = 0, 293*4d7e907cSAndroid Build Coastguard Worker 294*4d7e907cSAndroid Build Coastguard Worker /** Enable content sampling. */ 295*4d7e907cSAndroid Build Coastguard Worker ENABLE = 1, 296*4d7e907cSAndroid Build Coastguard Worker 297*4d7e907cSAndroid Build Coastguard Worker /** Disable content sampling. */ 298*4d7e907cSAndroid Build Coastguard Worker DISABLE = 2, 299*4d7e907cSAndroid Build Coastguard Worker }; 300*4d7e907cSAndroid Build Coastguard Worker 301*4d7e907cSAndroid Build Coastguard Worker /** 302*4d7e907cSAndroid Build Coastguard Worker * Enables or disables the collection of color content statistics 303*4d7e907cSAndroid Build Coastguard Worker * on this display. 304*4d7e907cSAndroid Build Coastguard Worker * 305*4d7e907cSAndroid Build Coastguard Worker * Sampling occurs on the contents of the final composition on this display 306*4d7e907cSAndroid Build Coastguard Worker * (i.e., the contents presented on screen). Samples should be collected after all 307*4d7e907cSAndroid Build Coastguard Worker * color transforms have been applied. 308*4d7e907cSAndroid Build Coastguard Worker * 309*4d7e907cSAndroid Build Coastguard Worker * Sampling support is optional, and is set to DISABLE by default. 310*4d7e907cSAndroid Build Coastguard Worker * On each call to ENABLE, all collected statistics must be reset. 311*4d7e907cSAndroid Build Coastguard Worker * 312*4d7e907cSAndroid Build Coastguard Worker * Sample data can be queried via getDisplayedContentSample(). 313*4d7e907cSAndroid Build Coastguard Worker * 314*4d7e907cSAndroid Build Coastguard Worker * @param display is the display to which the sampling mode is set. 315*4d7e907cSAndroid Build Coastguard Worker * @param enabled indicates whether to enable or disable sampling. 316*4d7e907cSAndroid Build Coastguard Worker * @param componentMask The mask of which components should be sampled. If zero, all supported 317*4d7e907cSAndroid Build Coastguard Worker * components are to be enabled. 318*4d7e907cSAndroid Build Coastguard Worker * @param maxFrames is the maximum number of frames that should be stored before discard. 319*4d7e907cSAndroid Build Coastguard Worker * The sample represents the most-recently posted frames. 320*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 321*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when an invalid display handle was passed in, 322*4d7e907cSAndroid Build Coastguard Worker * BAD_PARAMETER when enabled was an invalid value, or 323*4d7e907cSAndroid Build Coastguard Worker * NO_RESOURCES when the requested ringbuffer size via maxFrames was 324*4d7e907cSAndroid Build Coastguard Worker * not available. 325*4d7e907cSAndroid Build Coastguard Worker * UNSUPPORTED when there is no efficient way to sample. 326*4d7e907cSAndroid Build Coastguard Worker */ 327*4d7e907cSAndroid Build Coastguard Worker setDisplayedContentSamplingEnabled( 328*4d7e907cSAndroid Build Coastguard Worker Display display, DisplayedContentSampling enable, 329*4d7e907cSAndroid Build Coastguard Worker bitfield<FormatColorComponent> componentMask, uint64_t maxFrames) 330*4d7e907cSAndroid Build Coastguard Worker generates (Error error); 331*4d7e907cSAndroid Build Coastguard Worker 332*4d7e907cSAndroid Build Coastguard Worker /** 333*4d7e907cSAndroid Build Coastguard Worker * Collects the results of display content color sampling for display. 334*4d7e907cSAndroid Build Coastguard Worker * 335*4d7e907cSAndroid Build Coastguard Worker * Collection of data can occur whether the sampling is in ENABLE or 336*4d7e907cSAndroid Build Coastguard Worker * DISABLE state. 337*4d7e907cSAndroid Build Coastguard Worker * 338*4d7e907cSAndroid Build Coastguard Worker * @param display is the display to which the sampling is collected. 339*4d7e907cSAndroid Build Coastguard Worker * @param maxFrames is the maximum number of frames that should be represented in the sample. 340*4d7e907cSAndroid Build Coastguard Worker * The sample represents the most-recently posted frames. 341*4d7e907cSAndroid Build Coastguard Worker * If maxFrames is 0, all frames are to be represented by the sample. 342*4d7e907cSAndroid Build Coastguard Worker * @param timestamp is the timestamp after which any frames were posted that should be 343*4d7e907cSAndroid Build Coastguard Worker * included in the sample. Timestamp is CLOCK_MONOTONIC. 344*4d7e907cSAndroid Build Coastguard Worker * If timestamp is 0, do not filter from the sample by time. 345*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 346*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when an invalid display was passed in, or 347*4d7e907cSAndroid Build Coastguard Worker * UNSUPPORTED when there is no efficient way to sample, or 348*4d7e907cSAndroid Build Coastguard Worker * BAD_PARAMETER when the component is not supported by the hardware. 349*4d7e907cSAndroid Build Coastguard Worker * @return frameCount The number of frames represented by this sample. 350*4d7e907cSAndroid Build Coastguard Worker * @return sampleComponent0 is a histogram counting how many times a pixel of a given value 351*4d7e907cSAndroid Build Coastguard Worker * was displayed onscreen for FORMAT_COMPONENT_0. 352*4d7e907cSAndroid Build Coastguard Worker * The buckets of the histogram are evenly weighted, the number of buckets 353*4d7e907cSAndroid Build Coastguard Worker * is device specific. 354*4d7e907cSAndroid Build Coastguard Worker * eg, for RGBA_8888, if sampleComponent0 is {10, 6, 4, 1} this means that 355*4d7e907cSAndroid Build Coastguard Worker * 10 red pixels were displayed onscreen in range 0x00->0x3F, 6 red pixels 356*4d7e907cSAndroid Build Coastguard Worker * were displayed onscreen in range 0x40->0x7F, etc. 357*4d7e907cSAndroid Build Coastguard Worker * @return sampleComponent1 is the same sample definition as sampleComponent0, 358*4d7e907cSAndroid Build Coastguard Worker * but for FORMAT_COMPONENT_1. 359*4d7e907cSAndroid Build Coastguard Worker * @return sampleComponent2 is the same sample definition as sampleComponent0, 360*4d7e907cSAndroid Build Coastguard Worker * but for FORMAT_COMPONENT_2. 361*4d7e907cSAndroid Build Coastguard Worker * @return sampleComponent3 is the same sample definition as sampleComponent0, 362*4d7e907cSAndroid Build Coastguard Worker * but for FORMAT_COMPONENT_3. 363*4d7e907cSAndroid Build Coastguard Worker */ 364*4d7e907cSAndroid Build Coastguard Worker getDisplayedContentSample(Display display, uint64_t maxFrames, uint64_t timestamp) 365*4d7e907cSAndroid Build Coastguard Worker generates (Error error, 366*4d7e907cSAndroid Build Coastguard Worker uint64_t frameCount, 367*4d7e907cSAndroid Build Coastguard Worker vec<uint64_t> sampleComponent0, 368*4d7e907cSAndroid Build Coastguard Worker vec<uint64_t> sampleComponent1, 369*4d7e907cSAndroid Build Coastguard Worker vec<uint64_t> sampleComponent2, 370*4d7e907cSAndroid Build Coastguard Worker vec<uint64_t> sampleComponent3); 371*4d7e907cSAndroid Build Coastguard Worker 372*4d7e907cSAndroid Build Coastguard Worker /** 373*4d7e907cSAndroid Build Coastguard Worker * Executes commands from the input command message queue. Return values 374*4d7e907cSAndroid Build Coastguard Worker * generated by the input commands are written to the output command 375*4d7e907cSAndroid Build Coastguard Worker * message queue in the form of value commands. 376*4d7e907cSAndroid Build Coastguard Worker * 377*4d7e907cSAndroid Build Coastguard Worker * @param inLength is the length of input commands. 378*4d7e907cSAndroid Build Coastguard Worker * @param inHandles is an array of handles referenced by the input 379*4d7e907cSAndroid Build Coastguard Worker * commands. 380*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 381*4d7e907cSAndroid Build Coastguard Worker * BAD_PARAMETER when inLength is not equal to the length of 382*4d7e907cSAndroid Build Coastguard Worker * commands in the input command message queue. 383*4d7e907cSAndroid Build Coastguard Worker * NO_RESOURCES when the output command message queue was not 384*4d7e907cSAndroid Build Coastguard Worker * properly drained. 385*4d7e907cSAndroid Build Coastguard Worker * @param outQueueChanged indicates whether the output command message 386*4d7e907cSAndroid Build Coastguard Worker * queue has changed. 387*4d7e907cSAndroid Build Coastguard Worker * @param outLength is the length of output commands. 388*4d7e907cSAndroid Build Coastguard Worker * @param outHandles is an array of handles referenced by the output 389*4d7e907cSAndroid Build Coastguard Worker * commands. 390*4d7e907cSAndroid Build Coastguard Worker */ 391*4d7e907cSAndroid Build Coastguard Worker executeCommands_2_3(uint32_t inLength, 392*4d7e907cSAndroid Build Coastguard Worker vec<handle> inHandles) 393*4d7e907cSAndroid Build Coastguard Worker generates (Error error, 394*4d7e907cSAndroid Build Coastguard Worker bool outQueueChanged, 395*4d7e907cSAndroid Build Coastguard Worker uint32_t outLength, 396*4d7e907cSAndroid Build Coastguard Worker vec<handle> outHandles); 397*4d7e907cSAndroid Build Coastguard Worker 398*4d7e907cSAndroid Build Coastguard Worker /** 399*4d7e907cSAndroid Build Coastguard Worker * Returns the render intents supported by the specified display and color 400*4d7e907cSAndroid Build Coastguard Worker * mode. 401*4d7e907cSAndroid Build Coastguard Worker * 402*4d7e907cSAndroid Build Coastguard Worker * For SDR color modes, RenderIntent::COLORIMETRIC must be supported. For 403*4d7e907cSAndroid Build Coastguard Worker * HDR color modes, RenderIntent::TONE_MAP_COLORIMETRIC must be supported. 404*4d7e907cSAndroid Build Coastguard Worker * 405*4d7e907cSAndroid Build Coastguard Worker * @param display is the display to query. 406*4d7e907cSAndroid Build Coastguard Worker * @param mode is the color mode to query. 407*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 408*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when an invalid display handle was passed in. 409*4d7e907cSAndroid Build Coastguard Worker * BAD_PARAMETER when an invalid color mode was passed in. 410*4d7e907cSAndroid Build Coastguard Worker * @return intents is an array of render intents. 411*4d7e907cSAndroid Build Coastguard Worker */ 412*4d7e907cSAndroid Build Coastguard Worker getRenderIntents_2_3(Display display, ColorMode mode) 413*4d7e907cSAndroid Build Coastguard Worker generates (Error error, 414*4d7e907cSAndroid Build Coastguard Worker vec<RenderIntent> intents); 415*4d7e907cSAndroid Build Coastguard Worker 416*4d7e907cSAndroid Build Coastguard Worker /** 417*4d7e907cSAndroid Build Coastguard Worker * Returns the color modes supported on this display. 418*4d7e907cSAndroid Build Coastguard Worker * 419*4d7e907cSAndroid Build Coastguard Worker * All devices must support at least ColorMode::NATIVE. 420*4d7e907cSAndroid Build Coastguard Worker * 421*4d7e907cSAndroid Build Coastguard Worker * @param display is the display to query. 422*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 423*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when an invalid display handle was passed in. 424*4d7e907cSAndroid Build Coastguard Worker * @return modes is an array of color modes. 425*4d7e907cSAndroid Build Coastguard Worker */ 426*4d7e907cSAndroid Build Coastguard Worker getColorModes_2_3(Display display) 427*4d7e907cSAndroid Build Coastguard Worker generates (Error error, 428*4d7e907cSAndroid Build Coastguard Worker vec<ColorMode> modes); 429*4d7e907cSAndroid Build Coastguard Worker 430*4d7e907cSAndroid Build Coastguard Worker /** 431*4d7e907cSAndroid Build Coastguard Worker * Sets the color mode and render intent of the given display. 432*4d7e907cSAndroid Build Coastguard Worker * 433*4d7e907cSAndroid Build Coastguard Worker * The color mode and render intent change must take effect on next 434*4d7e907cSAndroid Build Coastguard Worker * presentDisplay. 435*4d7e907cSAndroid Build Coastguard Worker * 436*4d7e907cSAndroid Build Coastguard Worker * All devices must support at least ColorMode::NATIVE and 437*4d7e907cSAndroid Build Coastguard Worker * RenderIntent::COLORIMETRIC, and displays are assumed to be in this mode 438*4d7e907cSAndroid Build Coastguard Worker * upon hotplug. 439*4d7e907cSAndroid Build Coastguard Worker * 440*4d7e907cSAndroid Build Coastguard Worker * @param display is the display to which the color mode is set. 441*4d7e907cSAndroid Build Coastguard Worker * @param mode is the color mode to set to. 442*4d7e907cSAndroid Build Coastguard Worker * @param intent is the render intent to set to. 443*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 444*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when an invalid display handle was passed in. 445*4d7e907cSAndroid Build Coastguard Worker * BAD_PARAMETER when mode or intent is invalid 446*4d7e907cSAndroid Build Coastguard Worker * UNSUPPORTED when mode or intent is not supported on this 447*4d7e907cSAndroid Build Coastguard Worker * display. 448*4d7e907cSAndroid Build Coastguard Worker */ 449*4d7e907cSAndroid Build Coastguard Worker setColorMode_2_3(Display display, ColorMode mode, RenderIntent intent) 450*4d7e907cSAndroid Build Coastguard Worker generates (Error error); 451*4d7e907cSAndroid Build Coastguard Worker 452*4d7e907cSAndroid Build Coastguard Worker /** 453*4d7e907cSAndroid Build Coastguard Worker * Provides a list of supported capabilities (as described in the 454*4d7e907cSAndroid Build Coastguard Worker * definition of DisplayCapability above). This list must not change after 455*4d7e907cSAndroid Build Coastguard Worker * initialization. 456*4d7e907cSAndroid Build Coastguard Worker * 457*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 458*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when an invalid display handle was passed in. 459*4d7e907cSAndroid Build Coastguard Worker * @return capabilities is a list of supported capabilities. 460*4d7e907cSAndroid Build Coastguard Worker */ 461*4d7e907cSAndroid Build Coastguard Worker getDisplayCapabilities(Display display) 462*4d7e907cSAndroid Build Coastguard Worker generates (Error error, 463*4d7e907cSAndroid Build Coastguard Worker vec<DisplayCapability> capabilities); 464*4d7e907cSAndroid Build Coastguard Worker 465*4d7e907cSAndroid Build Coastguard Worker /** 466*4d7e907cSAndroid Build Coastguard Worker * Returns the PerFrameMetadataKeys that are supported by this device. 467*4d7e907cSAndroid Build Coastguard Worker * 468*4d7e907cSAndroid Build Coastguard Worker * @param display is the display on which to create the layer. 469*4d7e907cSAndroid Build Coastguard Worker * @return keys is the vector of PerFrameMetadataKey keys that are 470*4d7e907cSAndroid Build Coastguard Worker * supported by this device. 471*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 472*4d7e907cSAndroid Build Coastguard Worker * UNSUPPORTED if not supported on underlying HAL 473*4d7e907cSAndroid Build Coastguard Worker */ 474*4d7e907cSAndroid Build Coastguard Worker getPerFrameMetadataKeys_2_3(Display display) 475*4d7e907cSAndroid Build Coastguard Worker generates (Error error, 476*4d7e907cSAndroid Build Coastguard Worker vec<PerFrameMetadataKey> keys); 477*4d7e907cSAndroid Build Coastguard Worker 478*4d7e907cSAndroid Build Coastguard Worker /** 479*4d7e907cSAndroid Build Coastguard Worker * Returns the high dynamic range (HDR) capabilities of the given display, 480*4d7e907cSAndroid Build Coastguard Worker * which are invariant with regard to the active configuration. 481*4d7e907cSAndroid Build Coastguard Worker * 482*4d7e907cSAndroid Build Coastguard Worker * Displays which are not HDR-capable must return no types. 483*4d7e907cSAndroid Build Coastguard Worker * 484*4d7e907cSAndroid Build Coastguard Worker * @param display is the display to query. 485*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 486*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when an invalid display handle was passed in. 487*4d7e907cSAndroid Build Coastguard Worker * @return types is an array of HDR types, may have 0 elements if the 488*4d7e907cSAndroid Build Coastguard Worker * display is not HDR-capable. 489*4d7e907cSAndroid Build Coastguard Worker * @return maxLuminance is the desired content maximum luminance for this 490*4d7e907cSAndroid Build Coastguard Worker * display in cd/m^2. 491*4d7e907cSAndroid Build Coastguard Worker * @return maxAverageLuminance - the desired content maximum frame-average 492*4d7e907cSAndroid Build Coastguard Worker * luminance for this display in cd/m^2. 493*4d7e907cSAndroid Build Coastguard Worker * @return minLuminance is the desired content minimum luminance for this 494*4d7e907cSAndroid Build Coastguard Worker * display in cd/m^2. 495*4d7e907cSAndroid Build Coastguard Worker */ 496*4d7e907cSAndroid Build Coastguard Worker @callflow(next="*") 497*4d7e907cSAndroid Build Coastguard Worker getHdrCapabilities_2_3(Display display) 498*4d7e907cSAndroid Build Coastguard Worker generates (Error error, 499*4d7e907cSAndroid Build Coastguard Worker vec<Hdr> types, 500*4d7e907cSAndroid Build Coastguard Worker float maxLuminance, 501*4d7e907cSAndroid Build Coastguard Worker float maxAverageLuminance, 502*4d7e907cSAndroid Build Coastguard Worker float minLuminance); 503*4d7e907cSAndroid Build Coastguard Worker 504*4d7e907cSAndroid Build Coastguard Worker /** 505*4d7e907cSAndroid Build Coastguard Worker * Use getDisplayCapabilities instead. If brightness is supported, must return 506*4d7e907cSAndroid Build Coastguard Worker * DisplayCapability::BRIGHTNESS as one of the display capabilities via getDisplayCapabilities. 507*4d7e907cSAndroid Build Coastguard Worker * Only use getDisplayCapabilities as the source of truth to query brightness support. 508*4d7e907cSAndroid Build Coastguard Worker * 509*4d7e907cSAndroid Build Coastguard Worker * Gets whether brightness operations are supported on a display. 510*4d7e907cSAndroid Build Coastguard Worker * 511*4d7e907cSAndroid Build Coastguard Worker * @param display 512*4d7e907cSAndroid Build Coastguard Worker * The display. 513*4d7e907cSAndroid Build Coastguard Worker * 514*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 515*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when the display is invalid, or 516*4d7e907cSAndroid Build Coastguard Worker * BAD_PARAMETER when the output parameter is invalid. 517*4d7e907cSAndroid Build Coastguard Worker * @return support 518*4d7e907cSAndroid Build Coastguard Worker * Whether brightness operations are supported on the display. 519*4d7e907cSAndroid Build Coastguard Worker */ 520*4d7e907cSAndroid Build Coastguard Worker getDisplayBrightnessSupport(Display display) generates (Error error, bool support); 521*4d7e907cSAndroid Build Coastguard Worker 522*4d7e907cSAndroid Build Coastguard Worker /** 523*4d7e907cSAndroid Build Coastguard Worker * Sets the brightness of a display. 524*4d7e907cSAndroid Build Coastguard Worker * 525*4d7e907cSAndroid Build Coastguard Worker * Ideally, the brightness change should take effect in the next frame post (so that it can be 526*4d7e907cSAndroid Build Coastguard Worker * aligned with color transforms). 527*4d7e907cSAndroid Build Coastguard Worker * 528*4d7e907cSAndroid Build Coastguard Worker * @param display 529*4d7e907cSAndroid Build Coastguard Worker * The display whose brightness is set. 530*4d7e907cSAndroid Build Coastguard Worker * @param brightness 531*4d7e907cSAndroid Build Coastguard Worker * A number between 0.0f (minimum brightness) and 1.0f (maximum brightness), or -1.0 to 532*4d7e907cSAndroid Build Coastguard Worker * turn the backlight off. 533*4d7e907cSAndroid Build Coastguard Worker * 534*4d7e907cSAndroid Build Coastguard Worker * @return error is NONE upon success. Otherwise, 535*4d7e907cSAndroid Build Coastguard Worker * BAD_DISPLAY when the display is invalid, or 536*4d7e907cSAndroid Build Coastguard Worker * UNSUPPORTED when brightness operations are not supported, or 537*4d7e907cSAndroid Build Coastguard Worker * BAD_PARAMETER when the brightness is invalid, or 538*4d7e907cSAndroid Build Coastguard Worker * NO_RESOURCES when the brightness cannot be applied. 539*4d7e907cSAndroid Build Coastguard Worker */ 540*4d7e907cSAndroid Build Coastguard Worker setDisplayBrightness(Display display, float brightness) generates (Error error); 541*4d7e907cSAndroid Build Coastguard Worker}; 542