1e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
2e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Copyright (C) 2010 The Android Open Source Project
3e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
4e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Licensed under the Apache License, Version 2.0 (the "License");
5e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * you may not use this file except in compliance with the License.
6e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * You may obtain a copy of the License at
7e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
8e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *      http://www.apache.org/licenses/LICENSE-2.0
9e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
10e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Unless required by applicable law or agreed to in writing, software
11e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * distributed under the License is distributed on an "AS IS" BASIS,
12e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * See the License for the specific language governing permissions and
14e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * limitations under the License.
15e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
16e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
17bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine/**
18bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine * @addtogroup NativeActivity Native Activity
19bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine * @{
20bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine */
21bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine
22bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine/**
23bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine * @file native_window.h
243aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * @brief API for accessing a native window.
25bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine */
26bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine
27e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#ifndef ANDROID_NATIVE_WINDOW_H
28e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#define ANDROID_NATIVE_WINDOW_H
29e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
30494ed550f5aea1332984fb9f0f11036fc58bd716Dan Albert#include <sys/cdefs.h>
31494ed550f5aea1332984fb9f0f11036fc58bd716Dan Albert
32654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin#include <android/data_space.h>
33c7e8daecb66a4875e16b03cf744fdd9ab867aa4fCraig Donner#include <android/hardware_buffer.h>
34e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#include <android/rect.h>
35e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
36e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#ifdef __cplusplus
37e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianextern "C" {
38e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#endif
39e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
40bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine/**
41c7e8daecb66a4875e16b03cf744fdd9ab867aa4fCraig Donner * Legacy window pixel format names, kept for backwards compatibility.
42c7e8daecb66a4875e16b03cf744fdd9ab867aa4fCraig Donner * New code and APIs should use AHARDWAREBUFFER_FORMAT_*.
43e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
44e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
45ff415149dc5a83a4eb5960daf2cb2c310ef89847Romain Guy    // NOTE: these values must match the values from graphics/common/x.x/types.hal
46ff415149dc5a83a4eb5960daf2cb2c310ef89847Romain Guy
47bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine    /** Red: 8 bits, Green: 8 bits, Blue: 8 bits, Alpha: 8 bits. **/
48c7e8daecb66a4875e16b03cf744fdd9ab867aa4fCraig Donner    WINDOW_FORMAT_RGBA_8888          = AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM,
49bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine    /** Red: 8 bits, Green: 8 bits, Blue: 8 bits, Unused: 8 bits. **/
50c7e8daecb66a4875e16b03cf744fdd9ab867aa4fCraig Donner    WINDOW_FORMAT_RGBX_8888          = AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM,
51bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine    /** Red: 5 bits, Green: 6 bits, Blue: 5 bits. **/
52c7e8daecb66a4875e16b03cf744fdd9ab867aa4fCraig Donner    WINDOW_FORMAT_RGB_565            = AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM,
53e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
54e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
5509932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall/**
5609932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall * Transforms that can be applied to buffers as they are displayed to a window.
5709932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall *
5809932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall * Supported transforms are any combination of horizontal mirror, vertical
5909932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall * mirror, and clockwise 90 degree rotation, in that order. Rotations of 180
6009932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall * and 270 degrees are made up of those basic transforms.
6109932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall */
6209932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hallenum ANativeWindowTransform {
6309932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall    ANATIVEWINDOW_TRANSFORM_IDENTITY            = 0x00,
6409932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall    ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL   = 0x01,
6509932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall    ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL     = 0x02,
6609932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall    ANATIVEWINDOW_TRANSFORM_ROTATE_90           = 0x04,
6709932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall
6809932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall    ANATIVEWINDOW_TRANSFORM_ROTATE_180          = ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL |
6909932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall                                                  ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL,
7009932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall    ANATIVEWINDOW_TRANSFORM_ROTATE_270          = ANATIVEWINDOW_TRANSFORM_ROTATE_180 |
7109932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall                                                  ANATIVEWINDOW_TRANSFORM_ROTATE_90,
7209932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall};
7309932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall
74e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianstruct ANativeWindow;
75bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine/**
763aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * Opaque type that provides access to a native window.
77bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine *
783aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * A pointer can be obtained using {@link ANativeWindow_fromSurface()}.
79bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine */
80e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopiantypedef struct ANativeWindow ANativeWindow;
81e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
82bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine/**
833aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * Struct that represents a windows buffer.
84bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine *
853aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * A pointer can be obtained using {@link ANativeWindow_lock()}.
86bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine */
87e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopiantypedef struct ANativeWindow_Buffer {
88bd5cb48d3ec561c7f754f9fb9ec4b68fec25b150Krzysztof Kosiński    /// The number of pixels that are shown horizontally.
89e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    int32_t width;
90e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
91bd5cb48d3ec561c7f754f9fb9ec4b68fec25b150Krzysztof Kosiński    /// The number of pixels that are shown vertically.
92e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    int32_t height;
93e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
94bd5cb48d3ec561c7f754f9fb9ec4b68fec25b150Krzysztof Kosiński    /// The number of *pixels* that a line in the buffer takes in
95bd5cb48d3ec561c7f754f9fb9ec4b68fec25b150Krzysztof Kosiński    /// memory. This may be >= width.
96e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    int32_t stride;
97e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
98bd5cb48d3ec561c7f754f9fb9ec4b68fec25b150Krzysztof Kosiński    /// The format of the buffer. One of AHARDWAREBUFFER_FORMAT_*
99e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    int32_t format;
100e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
101bd5cb48d3ec561c7f754f9fb9ec4b68fec25b150Krzysztof Kosiński    /// The actual bits.
102e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    void* bits;
103bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine
104bd5cb48d3ec561c7f754f9fb9ec4b68fec25b150Krzysztof Kosiński    /// Do not touch.
105e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    uint32_t reserved[6];
106e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian} ANativeWindow_Buffer;
107e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
108e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/**
1093aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * Acquire a reference on the given {@link ANativeWindow} object. This prevents the object
110e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * from being deleted until the reference is removed.
111e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
112e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianvoid ANativeWindow_acquire(ANativeWindow* window);
113e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
114e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/**
1153aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * Remove a reference that was previously acquired with {@link ANativeWindow_acquire()}.
116e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
117e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianvoid ANativeWindow_release(ANativeWindow* window);
118e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
119bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine/**
1203aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * Return the current width in pixels of the window surface.
1213aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong *
1223aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * \return negative value on error.
123e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
124e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t ANativeWindow_getWidth(ANativeWindow* window);
125e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
126bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine/**
1273aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * Return the current height in pixels of the window surface.
1283aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong *
1293aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * \return a negative value on error.
130e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
131e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t ANativeWindow_getHeight(ANativeWindow* window);
132e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
133bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine/**
1343aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * Return the current pixel format (AHARDWAREBUFFER_FORMAT_*) of the window surface.
1353aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong *
1363aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * \return a negative value on error.
137e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
138e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t ANativeWindow_getFormat(ANativeWindow* window);
139e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
140bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine/**
141e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Change the format and size of the window buffers.
142e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
143e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * The width and height control the number of pixels in the buffers, not the
1443aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * dimensions of the window on screen. If these are different than the
1453aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * window's physical size, then its buffer will be scaled to match that size
1463aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * when compositing it to the screen. The width and height must be either both zero
1473aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * or both non-zero.
148e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
149e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * For all of these parameters, if 0 is supplied then the window's base
150e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * value will come back in force.
151e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
1523aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * \param width width of the buffers in pixels.
1533aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * \param height height of the buffers in pixels.
1543aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * \param format one of AHARDWAREBUFFER_FORMAT_* constants.
1553aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * \return 0 for success, or a negative value on error.
156e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
157e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window,
158e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        int32_t width, int32_t height, int32_t format);
159e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
160e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/**
161e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Lock the window's next drawing surface for writing.
162e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * inOutDirtyBounds is used as an in/out parameter, upon entering the
163e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * function, it contains the dirty region, that is, the region the caller
164e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * intends to redraw. When the function returns, inOutDirtyBounds is updated
165e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * with the actual area the caller needs to redraw -- this region is often
1663aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * extended by {@link ANativeWindow_lock}.
1673aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong *
1683aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * \return 0 for success, or a negative value on error.
169e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
170e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer,
171e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        ARect* inOutDirtyBounds);
172e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
173e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/**
174e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Unlock the window's drawing surface after previously locking it,
175e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * posting the new buffer to the display.
1763aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong *
1773aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * \return 0 for success, or a negative value on error.
178e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
179e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t ANativeWindow_unlockAndPost(ANativeWindow* window);
180e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
18109932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall#if __ANDROID_API__ >= __ANDROID_API_O__
18209932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall
18309932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall/**
18409932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall * Set a transform that will be applied to future buffers posted to the window.
18509932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall *
1863aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * \param transform combination of {@link ANativeWindowTransform} flags
1873aea0e37b08cb09e65de21642aa60c698a3c8d12Quddus Chong * \return 0 for success, or -EINVAL if \p transform is invalid
18809932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall */
18909932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hallint32_t ANativeWindow_setBuffersTransform(ANativeWindow* window, int32_t transform);
19009932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall
19109932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall#endif // __ANDROID_API__ >= __ANDROID_API_O__
19209932eceb2fcec029edc6aaa0e2bca0591613281Jesse Hall
193654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin#if __ANDROID_API__ >= __ANDROID_API_P__
194654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin
195654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin/**
196654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * All buffers queued after this call will be associated with the dataSpace
197654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * parameter specified.
198654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin *
199654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * dataSpace specifies additional information about the buffer.
200654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * For example, it can be used to convey the color space of the image data in
201654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * the buffer, or it can be used to indicate that the buffers contain depth
202654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * measurement data instead of color images. The default dataSpace is 0,
203654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * ADATASPACE_UNKNOWN, unless it has been overridden by the producer.
204654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin *
205654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * \param dataSpace data space of all buffers queued after this call.
206654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * \return 0 for success, -EINVAL if window is invalid or the dataspace is not
207654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * supported.
208654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin */
209654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Linint32_t ANativeWindow_setBuffersDataSpace(ANativeWindow* window, int32_t dataSpace);
210654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin
211654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin/**
212654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * Get the dataspace of the buffers in window.
213654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * \return the dataspace of buffers in window, ADATASPACE_UNKNOWN is returned if
214654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin * dataspace is unknown, or -EINVAL if window is invalid.
215654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin */
216654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Linint32_t ANativeWindow_getBuffersDataSpace(ANativeWindow* window);
217654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin
218654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin#endif // __ANDROID_API__ >= __ANDROID_API_P__
219654f87b3c2b6777ecf53587dba10ecaaacbe3f4ePeiyong Lin
220e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#ifdef __cplusplus
221e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
222e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#endif
223e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
224e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#endif // ANDROID_NATIVE_WINDOW_H
225bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine
226bf6d5e012cd9b15568c2351831f3349cf564bf18Johan Euphrosine/** @} */
227