blob: 98fd875968d4b8354f5760181572e4a4db763dc9 [file] [log] [blame]
Marissa Wall53da7e32018-09-25 15:59:38 -07001/*
2 * Copyright 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
17/**
18 * @addtogroup NativeActivity Native Activity
19 * @{
20 */
21
22/**
23 * @file surface_control.h
24 */
25
26#ifndef ANDROID_SURFACE_CONTROL_H
27#define ANDROID_SURFACE_CONTROL_H
28
29#include <sys/cdefs.h>
30
Marissa Wall3ff826c2019-02-07 11:58:25 -080031#include <android/data_space.h>
Marissa Wall53da7e32018-09-25 15:59:38 -070032#include <android/hardware_buffer.h>
Marissa Wall80d94ad2019-01-18 16:04:36 -080033#include <android/hdr_metadata.h>
Marissa Wall53da7e32018-09-25 15:59:38 -070034#include <android/native_window.h>
35
36__BEGIN_DECLS
37
Marissa Wall53da7e32018-09-25 15:59:38 -070038struct ASurfaceControl;
39
40/**
Elliott Hughes733bf992019-03-08 11:25:28 -080041 * The SurfaceControl API can be used to provide a hierarchy of surfaces for
Marissa Wall53da7e32018-09-25 15:59:38 -070042 * composition to the system compositor. ASurfaceControl represents a content node in
Elliott Hughes733bf992019-03-08 11:25:28 -080043 * this hierarchy.
Marissa Wall53da7e32018-09-25 15:59:38 -070044 */
45typedef struct ASurfaceControl ASurfaceControl;
46
Elliott Hughes3d70e532019-10-29 08:59:39 -070047/**
Marissa Wall53da7e32018-09-25 15:59:38 -070048 * Creates an ASurfaceControl with either ANativeWindow or an ASurfaceControl as its parent.
Marin Shalamanov110c6bc2020-11-16 17:57:59 +010049 * \a debug_name is a debug name associated with this surface. It can be used to
Marissa Wall53da7e32018-09-25 15:59:38 -070050 * identify this surface in the SurfaceFlinger's layer tree. It must not be
51 * null.
52 *
53 * The caller takes ownership of the ASurfaceControl returned and must release it
54 * using ASurfaceControl_release below.
Elliott Hughes3d70e532019-10-29 08:59:39 -070055 *
56 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -070057 */
58ASurfaceControl* ASurfaceControl_createFromWindow(ANativeWindow* parent, const char* debug_name)
59 __INTRODUCED_IN(29);
60
Elliott Hughes3d70e532019-10-29 08:59:39 -070061/**
62 * See ASurfaceControl_createFromWindow.
63 *
64 * Available since API level 29.
65 */
Marissa Wall53da7e32018-09-25 15:59:38 -070066ASurfaceControl* ASurfaceControl_create(ASurfaceControl* parent, const char* debug_name)
67 __INTRODUCED_IN(29);
68
69/**
Marin Shalamanov110c6bc2020-11-16 17:57:59 +010070 * Releases the \a surface_control object. After releasing the ASurfaceControl the caller no longer
Marissa Wall80d94ad2019-01-18 16:04:36 -080071 * has ownership of the AsurfaceControl. The surface and it's children may remain on display as long
72 * as their parent remains on display.
Elliott Hughes3d70e532019-10-29 08:59:39 -070073 *
74 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -070075 */
Marissa Wall80d94ad2019-01-18 16:04:36 -080076void ASurfaceControl_release(ASurfaceControl* surface_control) __INTRODUCED_IN(29);
Marissa Wall53da7e32018-09-25 15:59:38 -070077
78struct ASurfaceTransaction;
79
80/**
81 * ASurfaceTransaction is a collection of updates to the surface tree that must
82 * be applied atomically.
83 */
84typedef struct ASurfaceTransaction ASurfaceTransaction;
85
86/**
87 * The caller takes ownership of the transaction and must release it using
Marin Shalamanov110c6bc2020-11-16 17:57:59 +010088 * ASurfaceTransaction_delete() below.
Elliott Hughes3d70e532019-10-29 08:59:39 -070089 *
90 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -070091 */
92ASurfaceTransaction* ASurfaceTransaction_create() __INTRODUCED_IN(29);
93
94/**
Marin Shalamanov110c6bc2020-11-16 17:57:59 +010095 * Destroys the \a transaction object.
Elliott Hughes3d70e532019-10-29 08:59:39 -070096 *
97 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -070098 */
99void ASurfaceTransaction_delete(ASurfaceTransaction* transaction) __INTRODUCED_IN(29);
100
101/**
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100102 * Applies the updates accumulated in \a transaction.
Marissa Wall53da7e32018-09-25 15:59:38 -0700103 *
104 * Note that the transaction is guaranteed to be applied atomically. The
105 * transactions which are applied on the same thread are also guaranteed to be
106 * applied in order.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700107 *
108 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -0700109 */
110void ASurfaceTransaction_apply(ASurfaceTransaction* transaction) __INTRODUCED_IN(29);
111
112/**
Marissa Wall80d94ad2019-01-18 16:04:36 -0800113 * An opaque handle returned during a callback that can be used to query general stats and stats for
114 * surfaces which were either removed or for which buffers were updated after this transaction was
115 * applied.
116 */
117typedef struct ASurfaceTransactionStats ASurfaceTransactionStats;
118
119/**
Marissa Wall53da7e32018-09-25 15:59:38 -0700120 * Since the transactions are applied asynchronously, the
121 * ASurfaceTransaction_OnComplete callback can be used to be notified when a frame
122 * including the updates in a transaction was presented.
123 *
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100124 * \param context Optional context provided by the client that is passed into
Marissa Wall53da7e32018-09-25 15:59:38 -0700125 * the callback.
Marissa Wall53da7e32018-09-25 15:59:38 -0700126 *
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100127 * \param stats Opaque handle that can be passed to ASurfaceTransactionStats functions to query
Elliott Hughes733bf992019-03-08 11:25:28 -0800128 * information about the transaction. The handle is only valid during the callback.
Marissa Wall53da7e32018-09-25 15:59:38 -0700129 *
130 * THREADING
131 * The transaction completed callback can be invoked on any thread.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700132 *
133 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -0700134 */
Marissa Wall80d94ad2019-01-18 16:04:36 -0800135typedef void (*ASurfaceTransaction_OnComplete)(void* context, ASurfaceTransactionStats* stats)
136 __INTRODUCED_IN(29);
137
138/**
139 * Returns the timestamp of when the frame was latched by the framework. Once a frame is
140 * latched by the framework, it is presented at the following hardware vsync.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700141 *
142 * Available since API level 29.
Marissa Wall80d94ad2019-01-18 16:04:36 -0800143 */
144int64_t ASurfaceTransactionStats_getLatchTime(ASurfaceTransactionStats* surface_transaction_stats)
145 __INTRODUCED_IN(29);
146
147/**
148 * Returns a sync fence that signals when the transaction has been presented.
149 * The recipient of the callback takes ownership of the fence and is responsible for closing
Marissa Wall183c44c2019-04-08 12:58:50 -0700150 * it. If a device does not support present fences, a -1 will be returned.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700151 *
152 * Available since API level 29.
Marissa Wall80d94ad2019-01-18 16:04:36 -0800153 */
154int ASurfaceTransactionStats_getPresentFenceFd(ASurfaceTransactionStats* surface_transaction_stats)
155 __INTRODUCED_IN(29);
156
157/**
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100158 * \a outASurfaceControls returns an array of ASurfaceControl pointers that were updated during the
Marissa Wall80d94ad2019-01-18 16:04:36 -0800159 * transaction. Stats for the surfaces can be queried through ASurfaceTransactionStats functions.
160 * When the client is done using the array, it must release it by calling
161 * ASurfaceTransactionStats_releaseASurfaceControls.
162 *
Elliott Hughes3d70e532019-10-29 08:59:39 -0700163 * Available since API level 29.
164 *
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100165 * \a outASurfaceControlsSize returns the size of the ASurfaceControls array.
Marissa Wall80d94ad2019-01-18 16:04:36 -0800166 */
167void ASurfaceTransactionStats_getASurfaceControls(ASurfaceTransactionStats* surface_transaction_stats,
168 ASurfaceControl*** outASurfaceControls,
169 size_t* outASurfaceControlsSize)
170 __INTRODUCED_IN(29);
171/**
172 * Releases the array of ASurfaceControls that were returned by
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100173 * ASurfaceTransactionStats_getASurfaceControls().
Elliott Hughes3d70e532019-10-29 08:59:39 -0700174 *
175 * Available since API level 29.
Marissa Wall80d94ad2019-01-18 16:04:36 -0800176 */
177void ASurfaceTransactionStats_releaseASurfaceControls(ASurfaceControl** surface_controls)
178 __INTRODUCED_IN(29);
179
180/**
181 * Returns the timestamp of when the CURRENT buffer was acquired. A buffer is considered
182 * acquired when its acquire_fence_fd has signaled. A buffer cannot be latched or presented until
183 * it is acquired. If no acquire_fence_fd was provided, this timestamp will be set to -1.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700184 *
185 * Available since API level 29.
Marissa Wall80d94ad2019-01-18 16:04:36 -0800186 */
187int64_t ASurfaceTransactionStats_getAcquireTime(ASurfaceTransactionStats* surface_transaction_stats,
188 ASurfaceControl* surface_control)
189 __INTRODUCED_IN(29);
190
191/**
192 * The returns the fence used to signal the release of the PREVIOUS buffer set on
193 * this surface. If this fence is valid (>=0), the PREVIOUS buffer has not yet been released and the
194 * fence will signal when the PREVIOUS buffer has been released. If the fence is -1 , the PREVIOUS
195 * buffer is already released. The recipient of the callback takes ownership of the
196 * previousReleaseFenceFd and is responsible for closing it.
197 *
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100198 * Each time a buffer is set through ASurfaceTransaction_setBuffer() on a transaction
199 * which is applied, the framework takes a ref on this buffer. The framework treats the
Marissa Wall80d94ad2019-01-18 16:04:36 -0800200 * addition of a buffer to a particular surface as a unique ref. When a transaction updates or
201 * removes a buffer from a surface, or removes the surface itself from the tree, this ref is
202 * guaranteed to be released in the OnComplete callback for this transaction. The
203 * ASurfaceControlStats provided in the callback for this surface may contain an optional fence
204 * which must be signaled before the ref is assumed to be released.
205 *
206 * The client must ensure that all pending refs on a buffer are released before attempting to reuse
207 * this buffer, otherwise synchronization errors may occur.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700208 *
209 * Available since API level 29.
Marissa Wall80d94ad2019-01-18 16:04:36 -0800210 */
211int ASurfaceTransactionStats_getPreviousReleaseFenceFd(
212 ASurfaceTransactionStats* surface_transaction_stats,
213 ASurfaceControl* surface_control)
214 __INTRODUCED_IN(29);
Marissa Wall53da7e32018-09-25 15:59:38 -0700215
216/**
217 * Sets the callback that will be invoked when the updates from this transaction
218 * are presented. For details on the callback semantics and data, see the
219 * comments on the ASurfaceTransaction_OnComplete declaration above.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700220 *
221 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -0700222 */
223void ASurfaceTransaction_setOnComplete(ASurfaceTransaction* transaction, void* context,
224 ASurfaceTransaction_OnComplete func) __INTRODUCED_IN(29);
225
Marissa Wall80d94ad2019-01-18 16:04:36 -0800226/**
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100227 * Reparents the \a surface_control from its old parent to the \a new_parent surface control.
228 * Any children of the reparented \a surface_control will remain children of the \a surface_control.
Marissa Wall80d94ad2019-01-18 16:04:36 -0800229 *
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100230 * The \a new_parent can be null. Surface controls with a null parent do not appear on the display.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700231 *
232 * Available since API level 29.
Marissa Wall80d94ad2019-01-18 16:04:36 -0800233 */
234void ASurfaceTransaction_reparent(ASurfaceTransaction* transaction,
235 ASurfaceControl* surface_control, ASurfaceControl* new_parent)
236 __INTRODUCED_IN(29);
237
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100238/**
239 * Parameter for ASurfaceTransaction_setVisibility().
240 */
Marissa Wall53da7e32018-09-25 15:59:38 -0700241enum {
242 ASURFACE_TRANSACTION_VISIBILITY_HIDE = 0,
243 ASURFACE_TRANSACTION_VISIBILITY_SHOW = 1,
244};
245/**
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100246 * Updates the visibility of \a surface_control. If show is set to
247 * ASURFACE_TRANSACTION_VISIBILITY_HIDE, the \a surface_control and all surfaces in its subtree will
Marissa Wall53da7e32018-09-25 15:59:38 -0700248 * be hidden.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700249 *
250 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -0700251 */
252void ASurfaceTransaction_setVisibility(ASurfaceTransaction* transaction,
253 ASurfaceControl* surface_control, int8_t visibility)
254 __INTRODUCED_IN(29);
255
256/**
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100257 * Updates the z order index for \a surface_control. Note that the z order for a surface
Marissa Wall53da7e32018-09-25 15:59:38 -0700258 * is relative to other surfaces which are siblings of this surface. The behavior of sibilings with
259 * the same z order is undefined.
260 *
261 * Z orders may be from MIN_INT32 to MAX_INT32. A layer's default z order index is 0.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700262 *
263 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -0700264 */
265void ASurfaceTransaction_setZOrder(ASurfaceTransaction* transaction,
266 ASurfaceControl* surface_control, int32_t z_order)
267 __INTRODUCED_IN(29);
268
269/**
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100270 * Updates the AHardwareBuffer displayed for \a surface_control. If not -1, the
Marissa Wall80d94ad2019-01-18 16:04:36 -0800271 * acquire_fence_fd should be a file descriptor that is signaled when all pending work
Marissa Wall53da7e32018-09-25 15:59:38 -0700272 * for the buffer is complete and the buffer can be safely read.
273 *
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100274 * The frameworks takes ownership of the \a acquire_fence_fd passed and is responsible
Marissa Wall53da7e32018-09-25 15:59:38 -0700275 * for closing it.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700276 *
277 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -0700278 */
279void ASurfaceTransaction_setBuffer(ASurfaceTransaction* transaction,
280 ASurfaceControl* surface_control, AHardwareBuffer* buffer,
Marissa Wall80d94ad2019-01-18 16:04:36 -0800281 int acquire_fence_fd = -1) __INTRODUCED_IN(29);
Marissa Wall53da7e32018-09-25 15:59:38 -0700282
283/**
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100284 * Updates the color for \a surface_control. This will make the background color for the
285 * ASurfaceControl visible in transparent regions of the surface. Colors \a r, \a g,
286 * and \a b must be within the range that is valid for \a dataspace. \a dataspace and \a alpha
Valerie Haued54efa2019-01-11 20:03:14 -0800287 * will be the dataspace and alpha set for the background color layer.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700288 *
289 * Available since API level 29.
Valerie Haued54efa2019-01-11 20:03:14 -0800290 */
291void ASurfaceTransaction_setColor(ASurfaceTransaction* transaction,
292 ASurfaceControl* surface_control, float r, float g, float b,
293 float alpha, ADataSpace dataspace)
294 __INTRODUCED_IN(29);
295
296/**
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100297 * \param source The sub-rect within the buffer's content to be rendered inside the surface's area
Marissa Wall53da7e32018-09-25 15:59:38 -0700298 * The surface's source rect is clipped by the bounds of its current buffer. The source rect's width
299 * and height must be > 0.
300 *
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100301 * \param destination Specifies the rect in the parent's space where this surface will be drawn. The post
Marissa Wall53da7e32018-09-25 15:59:38 -0700302 * source rect bounds are scaled to fit the destination rect. The surface's destination rect is
303 * clipped by the bounds of its parent. The destination rect's width and height must be > 0.
304 *
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100305 * \param transform The transform applied after the source rect is applied to the buffer. This parameter
Marissa Wall53da7e32018-09-25 15:59:38 -0700306 * should be set to 0 for no transform. To specify a transfrom use the NATIVE_WINDOW_TRANSFORM_*
307 * enum.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700308 *
309 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -0700310 */
311void ASurfaceTransaction_setGeometry(ASurfaceTransaction* transaction,
312 ASurfaceControl* surface_control, const ARect& source,
313 const ARect& destination, int32_t transform)
314 __INTRODUCED_IN(29);
315
316
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100317/**
318 * Parameter for ASurfaceTransaction_setBufferTransparency().
319 */
Marissa Wall53da7e32018-09-25 15:59:38 -0700320enum {
321 ASURFACE_TRANSACTION_TRANSPARENCY_TRANSPARENT = 0,
322 ASURFACE_TRANSACTION_TRANSPARENCY_TRANSLUCENT = 1,
323 ASURFACE_TRANSACTION_TRANSPARENCY_OPAQUE = 2,
324};
325/**
326 * Updates whether the content for the buffer associated with this surface is
327 * completely opaque. If true, every pixel of content inside the buffer must be
328 * opaque or visual errors can occur.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700329 *
330 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -0700331 */
332void ASurfaceTransaction_setBufferTransparency(ASurfaceTransaction* transaction,
Marissa Wall80d94ad2019-01-18 16:04:36 -0800333 ASurfaceControl* surface_control,
334 int8_t transparency)
335 __INTRODUCED_IN(29);
Marissa Wall53da7e32018-09-25 15:59:38 -0700336
337/**
338 * Updates the region for the content on this surface updated in this
339 * transaction. If unspecified, the complete surface is assumed to be damaged.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700340 *
341 * Available since API level 29.
Marissa Wall53da7e32018-09-25 15:59:38 -0700342 */
343void ASurfaceTransaction_setDamageRegion(ASurfaceTransaction* transaction,
344 ASurfaceControl* surface_control, const ARect rects[],
345 uint32_t count) __INTRODUCED_IN(29);
346
Marissa Wall80d94ad2019-01-18 16:04:36 -0800347/**
348 * Specifies a desiredPresentTime for the transaction. The framework will try to present
349 * the transaction at or after the time specified.
350 *
351 * Transactions will not be presented until all of their acquire fences have signaled even if the
352 * app requests an earlier present time.
353 *
354 * If an earlier transaction has a desired present time of x, and a later transaction has a desired
355 * present time that is before x, the later transaction will not preempt the earlier transaction.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700356 *
357 * Available since API level 29.
Marissa Wall80d94ad2019-01-18 16:04:36 -0800358 */
359void ASurfaceTransaction_setDesiredPresentTime(ASurfaceTransaction* transaction,
360 int64_t desiredPresentTime) __INTRODUCED_IN(29);
361
362/**
363 * Sets the alpha for the buffer. It uses a premultiplied blending.
364 *
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100365 * The \a alpha must be between 0.0 and 1.0.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700366 *
367 * Available since API level 29.
Marissa Wall80d94ad2019-01-18 16:04:36 -0800368 */
369void ASurfaceTransaction_setBufferAlpha(ASurfaceTransaction* transaction,
370 ASurfaceControl* surface_control, float alpha)
371 __INTRODUCED_IN(29);
372
Marissa Wall3ff826c2019-02-07 11:58:25 -0800373/**
374 * Sets the data space of the surface_control's buffers.
375 *
376 * If no data space is set, the surface control defaults to ADATASPACE_SRGB.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700377 *
378 * Available since API level 29.
Marissa Wall3ff826c2019-02-07 11:58:25 -0800379 */
380void ASurfaceTransaction_setBufferDataSpace(ASurfaceTransaction* transaction,
381 ASurfaceControl* surface_control, ADataSpace data_space)
382 __INTRODUCED_IN(29);
383
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100384/**
Marissa Wall80d94ad2019-01-18 16:04:36 -0800385 * SMPTE ST 2086 "Mastering Display Color Volume" static metadata
386 *
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100387 * When \a metadata is set to null, the framework does not use any smpte2086 metadata when rendering
Marissa Wall80d94ad2019-01-18 16:04:36 -0800388 * the surface's buffer.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700389 *
390 * Available since API level 29.
Marissa Wall80d94ad2019-01-18 16:04:36 -0800391 */
392void ASurfaceTransaction_setHdrMetadata_smpte2086(ASurfaceTransaction* transaction,
393 ASurfaceControl* surface_control,
394 struct AHdrMetadata_smpte2086* metadata)
395 __INTRODUCED_IN(29);
396
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100397/**
Marissa Wall80d94ad2019-01-18 16:04:36 -0800398 * Sets the CTA 861.3 "HDR Static Metadata Extension" static metadata on a surface.
399 *
Marin Shalamanov110c6bc2020-11-16 17:57:59 +0100400 * When \a metadata is set to null, the framework does not use any cta861.3 metadata when rendering
Marissa Wall80d94ad2019-01-18 16:04:36 -0800401 * the surface's buffer.
Elliott Hughes3d70e532019-10-29 08:59:39 -0700402 *
403 * Available since API level 29.
Marissa Wall80d94ad2019-01-18 16:04:36 -0800404 */
405void ASurfaceTransaction_setHdrMetadata_cta861_3(ASurfaceTransaction* transaction,
406 ASurfaceControl* surface_control,
407 struct AHdrMetadata_cta861_3* metadata)
408 __INTRODUCED_IN(29);
409
Steven Thomas15b6f9c2020-03-26 13:44:28 -0700410/**
Marin Shalamanov46084422020-10-13 12:33:42 +0200411 * Same as ASurfaceTransaction_setFrameRateWithSeamlessness(transaction, surface_control,
412 * frameRate, compatibility, true).
Steven Thomas6d88a482019-12-02 22:00:47 -0800413 *
Marin Shalamanov46084422020-10-13 12:33:42 +0200414 * See ASurfaceTransaction_setFrameRateWithSeamlessness().
Steven Thomas62a4cf82020-01-31 12:04:03 -0800415 *
Steven Thomas6d88a482019-12-02 22:00:47 -0800416 * Available since API level 30.
417 */
418void ASurfaceTransaction_setFrameRate(ASurfaceTransaction* transaction,
Steven Thomas62a4cf82020-01-31 12:04:03 -0800419 ASurfaceControl* surface_control, float frameRate,
420 int8_t compatibility) __INTRODUCED_IN(30);
Steven Thomas6d88a482019-12-02 22:00:47 -0800421
Marin Shalamanov46084422020-10-13 12:33:42 +0200422/**
423 * Sets the intended frame rate for \a surface_control.
424 *
425 * On devices that are capable of running the display at different refresh rates, the system may
426 * choose a display refresh rate to better match this surface's frame rate. Usage of this API won't
427 * directly affect the application's frame production pipeline. However, because the system may
428 * change the display refresh rate, calls to this function may result in changes to Choreographer
429 * callback timings, and changes to the time interval at which the system releases buffers back to
430 * the application.
431 *
432 * \param frameRate is the intended frame rate of this surface, in frames per second. 0 is a special
433 * value that indicates the app will accept the system's choice for the display frame rate, which is
434 * the default behavior if this function isn't called. The frameRate param does <em>not</em> need to
435 * be a valid refresh rate for this device's display - e.g., it's fine to pass 30fps to a device
436 * that can only run the display at 60fps.
437 *
438 * \param compatibility The frame rate compatibility of this surface. The compatibility value may
439 * influence the system's choice of display frame rate. To specify a compatibility use the
440 * ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_* enum.
441 *
442 * \param shouldBeSeamless Whether display refresh rate transitions should be seamless. A
443 * seamless transition is one that doesn't have any visual interruptions, such as a black
444 * screen for a second or two. True indicates that any frame rate changes caused by this
445 * request should be seamless. False indicates that non-seamless refresh rates are also
446 * acceptable.
447 *
448 * Available since API level 31.
449 */
450void ASurfaceTransaction_setFrameRateWithSeamlessness(ASurfaceTransaction* transaction,
451 ASurfaceControl* surface_control, float frameRate,
452 int8_t compatibility, bool shouldBeSeamless)
453 __INTRODUCED_IN(31);
454
Marissa Wall53da7e32018-09-25 15:59:38 -0700455__END_DECLS
456
457#endif // ANDROID_SURFACE_CONTROL_H