blob: dec3b25b25f3c5a2324116f5dcb2257099eed43d [file] [log] [blame]
Dominik Laskowskicd2e9f52018-03-12 19:41:03 -07001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.graphics.composer@2.3;
18
Valerie Hauec983062018-10-09 16:09:12 -070019import android.hardware.graphics.common@1.1::RenderIntent;
20import android.hardware.graphics.common@1.1::PixelFormat;
21import android.hardware.graphics.common@1.2::ColorMode;
22import android.hardware.graphics.common@1.2::Dataspace;
Peiyong Lin830137f2018-09-13 17:19:38 -070023import android.hardware.graphics.composer@2.1::IComposerClient.Command;
Dominik Laskowskicd2e9f52018-03-12 19:41:03 -070024import @2.2::IComposerClient;
25import @2.1::Display;
26import @2.1::Error;
27
28interface IComposerClient extends @2.2::IComposerClient {
29
Peiyong Lin830137f2018-09-13 17:19:38 -070030 enum Command : @2.2::IComposerClient.Command {
31 /**
32 * SET_LAYER_COLOR_TRANSFORM has this pseudo prototype
33 *
34 * setLayerColorTransform(float[16] matrix);
35 *
36 * This command has the following binary layout in bytes:
37 *
38 * 0 - 16 * 4: matrix
39 *
40 * Sets a matrix for color transform which will be applied on this layer
41 * before composition.
42 *
43 * If the device is not capable of apply the matrix on this layer, it must force
44 * this layer to client composition during VALIDATE_DISPLAY.
45 *
46 * The matrix provided is an affine color transformation of the following
47 * form:
48 *
49 * |r.r r.g r.b 0|
50 * |g.r g.g g.b 0|
51 * |b.r b.g b.b 0|
52 * |Tr Tg Tb 1|
53 *
54 * This matrix must be provided in row-major form:
55 *
56 * {r.r, r.g, r.b, 0, g.r, ...}.
57 *
58 * Given a matrix of this form and an input color [R_in, G_in, B_in],
59 * the input color must first be converted to linear space
60 * [R_linear, G_linear, B_linear], then the output linear color
61 * [R_out_linear, G_out_linear, B_out_linear] will be:
62 *
63 * R_out_linear = R_linear * r.r + G_linear * g.r + B_linear * b.r + Tr
64 * G_out_linear = R_linear * r.g + G_linear * g.g + B_linear * b.g + Tg
65 * B_out_linear = R_linear * r.b + G_linear * g.b + B_linear * b.b + Tb
66 *
67 * [R_out_linear, G_out_linear, B_out_linear] must then be converted to
68 * gamma space: [R_out, G_out, B_out] before blending.
69 *
70 * @param matrix is a 4x4 transform matrix (16 floats) as described above.
71 */
72 SET_LAYER_COLOR_TRANSFORM = 0x40d << @2.1::IComposerClient.Command:OPCODE_SHIFT,
73 };
74
Dominik Laskowskicd2e9f52018-03-12 19:41:03 -070075 /**
76 * Returns the port and data that describe a physical display. The port is
77 * a unique number that identifies a physical connector (e.g. eDP, HDMI)
78 * for display output. The data blob is parsed to determine its format,
79 * typically EDID 1.3 as specified in VESA E-EDID Standard Release A
80 * Revision 1.
81 *
82 * @param display is the display to query.
83 * @return error is NONE upon success. Otherwise,
84 * BAD_DISPLAY when an invalid display handle was passed in.
85 * UNSUPPORTED when identification data is unavailable.
86 * @return port is the connector to which the display is connected.
87 * @return data is the EDID 1.3 blob identifying the display.
88 */
89 @callflow(next="*")
90 getDisplayIdentificationData(Display display)
91 generates (Error error,
92 uint8_t port,
93 vec<uint8_t> data);
Valerie Hauec983062018-10-09 16:09:12 -070094 /**
95 * getReadbackBufferAttributes_2_3
96 * Returns the format which should be used when allocating a buffer for use by
97 * device readback as well as the dataspace in which its contents must be
98 * interpreted.
99 *
100 * The width and height of this buffer must be those of the currently-active
101 * display configuration, and the usage flags must consist of the following:
102 * BufferUsage::CPU_READ | BufferUsage::GPU_TEXTURE |
103 * BufferUsage::COMPOSER_OUTPUT
104 *
105 * The format and dataspace provided must be sufficient such that if a
106 * correctly-configured buffer is passed into setReadbackBuffer, filled by
107 * the device, and then displayed by the client as a full-screen buffer, the
108 * output of the display remains the same (subject to the note about protected
109 * content in the description of setReadbackBuffer).
110 *
111 * If the active configuration or color mode of this display has changed
112 * since a previous call to this function, it must be called again prior to
113 * setting a readback buffer such that the returned format and dataspace will
114 * be updated accordingly.
115 *
116 * Parameters:
117 * @param display - the display on which to create the layer.
118 *
119 * @return format - the format the client should use when allocating a device
120 * readback buffer
121 * @return dataspace - the dataspace to use when interpreting the
122 * contents of a device readback buffer
123 * @return error is NONE upon success. Otherwise,
124 * BAD_DISPLAY when an invalid display handle was passed in.
125 * UNSUPPORTED if not supported on underlying HAL
126 *
127 * See also:
128 * setReadbackBuffer
129 * getReadbackBufferFence
130 */
131 getReadbackBufferAttributes_2_3(Display display)
132 generates (Error error,
133 PixelFormat format,
134 Dataspace dataspace);
135
136 /**
137 * getClientTargetSupport_2_3
138 * Returns whether a client target with the given properties can be
139 * handled by the device.
140 *
141 * This function must return true for a client target with width and
142 * height equal to the active display configuration dimensions,
143 * PixelFormat::RGBA_8888, and Dataspace::UNKNOWN. It is not required to
144 * return true for any other configuration.
145 *
146 * @param display is the display to query.
147 * @param width is the client target width in pixels.
148 * @param height is the client target height in pixels.
149 * @param format is the client target format.
150 * @param dataspace is the client target dataspace, as described in
151 * setLayerDataspace.
152 * @return error is NONE upon success. Otherwise,
153 * BAD_DISPLAY when an invalid display handle was passed in.
154 * UNSUPPORTED when the given configuration is not supported.
155 */
156 @callflow(next="*")
157 getClientTargetSupport_2_3(Display display,
158 uint32_t width,
159 uint32_t height,
160 PixelFormat format,
161 Dataspace dataspace)
162 generates (Error error);
Dominik Laskowskicd2e9f52018-03-12 19:41:03 -0700163
Peiyong Lin830137f2018-09-13 17:19:38 -0700164 /**
165 * Executes commands from the input command message queue. Return values
166 * generated by the input commands are written to the output command
167 * message queue in the form of value commands.
168 *
169 * @param inLength is the length of input commands.
170 * @param inHandles is an array of handles referenced by the input
171 * commands.
172 * @return error is NONE upon success. Otherwise,
173 * BAD_PARAMETER when inLength is not equal to the length of
174 * commands in the input command message queue.
175 * NO_RESOURCES when the output command message queue was not
176 * properly drained.
177 * @param outQueueChanged indicates whether the output command message
178 * queue has changed.
179 * @param outLength is the length of output commands.
180 * @param outHandles is an array of handles referenced by the output
181 * commands.
182 */
183 executeCommands_2_3(uint32_t inLength,
184 vec<handle> inHandles)
185 generates (Error error,
186 bool outQueueChanged,
187 uint32_t outLength,
188 vec<handle> outHandles);
Valerie Hauec983062018-10-09 16:09:12 -0700189
190 /**
191 * Returns the render intents supported by the specified display and color
192 * mode.
193 *
194 * For SDR color modes, RenderIntent::COLORIMETRIC must be supported. For
195 * HDR color modes, RenderIntent::TONE_MAP_COLORIMETRIC must be supported.
196 *
197 * @param display is the display to query.
198 * @param mode is the color mode to query.
199 * @return error is NONE upon success. Otherwise,
200 * BAD_DISPLAY when an invalid display handle was passed in.
201 * BAD_PARAMETER when an invalid color mode was passed in.
202 * @return intents is an array of render intents.
203 */
204 getRenderIntents_2_3(Display display, ColorMode mode)
205 generates (Error error,
206 vec<RenderIntent> intents);
207
208 /**
209 * Returns the color modes supported on this display.
210 *
211 * All devices must support at least ColorMode::NATIVE.
212 *
213 * @param display is the display to query.
214 * @return error is NONE upon success. Otherwise,
215 * BAD_DISPLAY when an invalid display handle was passed in.
216 * @return modes is an array of color modes.
217 */
218 getColorModes_2_3(Display display)
219 generates (Error error,
220 vec<ColorMode> modes);
221
222 /**
223 * Sets the color mode and render intent of the given display.
224 *
225 * The color mode and render intent change must take effect on next
226 * presentDisplay.
227 *
228 * All devices must support at least ColorMode::NATIVE and
229 * RenderIntent::COLORIMETRIC, and displays are assumed to be in this mode
230 * upon hotplug.
231 *
232 * @param display is the display to which the color mode is set.
233 * @param mode is the color mode to set to.
234 * @param intent is the render intent to set to.
235 * @return error is NONE upon success. Otherwise,
236 * BAD_DISPLAY when an invalid display handle was passed in.
237 * BAD_PARAMETER when mode or intent is invalid
238 * UNSUPPORTED when mode or intent is not supported on this
239 * display.
240 */
241 setColorMode_2_3(Display display, ColorMode mode, RenderIntent intent)
242 generates (Error error);
Dominik Laskowskicd2e9f52018-03-12 19:41:03 -0700243};