Skip to main content

ohos_window_sys/native_buffer/native_buffer/
native_buffer_ffi.rs

1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6#[cfg(feature = "api-11")]
7use crate::native_buffer::buffer_common::OH_NativeBuffer_ColorSpace;
8#[cfg(feature = "api-12")]
9use crate::native_buffer::buffer_common::OH_NativeBuffer_MetadataKey;
10#[cfg(feature = "api-23")]
11use ohos_sys_opaque_types::OHIPCParcel;
12#[cfg(feature = "api-12")]
13use ohos_sys_opaque_types::OHNativeWindowBuffer;
14use ohos_sys_opaque_types::OH_NativeBuffer;
15
16impl ::core::ops::BitOr<OH_NativeBuffer_Usage> for OH_NativeBuffer_Usage {
17    type Output = Self;
18    #[inline]
19    fn bitor(self, other: Self) -> Self {
20        OH_NativeBuffer_Usage(self.0 | other.0)
21    }
22}
23impl ::core::ops::BitOrAssign for OH_NativeBuffer_Usage {
24    #[inline]
25    fn bitor_assign(&mut self, rhs: OH_NativeBuffer_Usage) {
26        self.0 |= rhs.0;
27    }
28}
29impl ::core::ops::BitAnd<OH_NativeBuffer_Usage> for OH_NativeBuffer_Usage {
30    type Output = Self;
31    #[inline]
32    fn bitand(self, other: Self) -> Self {
33        OH_NativeBuffer_Usage(self.0 & other.0)
34    }
35}
36impl ::core::ops::BitAndAssign for OH_NativeBuffer_Usage {
37    #[inline]
38    fn bitand_assign(&mut self, rhs: OH_NativeBuffer_Usage) {
39        self.0 &= rhs.0;
40    }
41}
42impl OH_NativeBuffer_Usage {
43    /// CPU read buffer
44    pub const NATIVEBUFFER_USAGE_CPU_READ: OH_NativeBuffer_Usage = OH_NativeBuffer_Usage(1);
45    /// CPU write memory
46    pub const NATIVEBUFFER_USAGE_CPU_WRITE: OH_NativeBuffer_Usage = OH_NativeBuffer_Usage(2);
47    /// Direct memory access (DMA) buffer
48    pub const NATIVEBUFFER_USAGE_MEM_DMA: OH_NativeBuffer_Usage = OH_NativeBuffer_Usage(8);
49    /// MMZ with cache
50    ///
51    /// Available since API-level: 20
52    #[cfg(feature = "api-20")]
53    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
54    pub const NATIVEBUFFER_USAGE_MEM_MMZ_CACHE: OH_NativeBuffer_Usage = OH_NativeBuffer_Usage(32);
55    /// For GPU write case
56    ///
57    /// Available since API-level: 12
58    #[cfg(feature = "api-12")]
59    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
60    pub const NATIVEBUFFER_USAGE_HW_RENDER: OH_NativeBuffer_Usage = OH_NativeBuffer_Usage(256);
61    /// For GPU read case
62    ///
63    /// Available since API-level: 12
64    #[cfg(feature = "api-12")]
65    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
66    pub const NATIVEBUFFER_USAGE_HW_TEXTURE: OH_NativeBuffer_Usage = OH_NativeBuffer_Usage(512);
67    /// Often be mapped for direct CPU reads
68    ///
69    /// Available since API-level: 12
70    #[cfg(feature = "api-12")]
71    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
72    pub const NATIVEBUFFER_USAGE_CPU_READ_OFTEN: OH_NativeBuffer_Usage =
73        OH_NativeBuffer_Usage(65536);
74    /// 512 bytes alignment
75    ///
76    /// Available since API-level: 12
77    #[cfg(feature = "api-12")]
78    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
79    pub const NATIVEBUFFER_USAGE_ALIGNMENT_512: OH_NativeBuffer_Usage =
80        OH_NativeBuffer_Usage(262144);
81}
82#[repr(transparent)]
83/// Indicates the usage of a native buffer.
84///
85///
86/// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
87///
88/// Available since API-level: 10
89///
90/// Version: 1.0
91#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
92pub struct OH_NativeBuffer_Usage(pub ::core::ffi::c_uint);
93#[cfg(feature = "api-12")]
94#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
95impl OH_NativeBuffer_ColorGamut {
96    /// < Native or default
97    pub const NATIVEBUFFER_COLOR_GAMUT_NATIVE: OH_NativeBuffer_ColorGamut =
98        OH_NativeBuffer_ColorGamut(0);
99    /// < Standard BT601
100    pub const NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT601: OH_NativeBuffer_ColorGamut =
101        OH_NativeBuffer_ColorGamut(1);
102    /// < Standard BT709
103    pub const NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT709: OH_NativeBuffer_ColorGamut =
104        OH_NativeBuffer_ColorGamut(2);
105    /// < DCI P3
106    pub const NATIVEBUFFER_COLOR_GAMUT_DCI_P3: OH_NativeBuffer_ColorGamut =
107        OH_NativeBuffer_ColorGamut(3);
108    /// < SRGB
109    pub const NATIVEBUFFER_COLOR_GAMUT_SRGB: OH_NativeBuffer_ColorGamut =
110        OH_NativeBuffer_ColorGamut(4);
111    /// < Adobe RGB
112    pub const NATIVEBUFFER_COLOR_GAMUT_ADOBE_RGB: OH_NativeBuffer_ColorGamut =
113        OH_NativeBuffer_ColorGamut(5);
114    /// < Display P3
115    pub const NATIVEBUFFER_COLOR_GAMUT_DISPLAY_P3: OH_NativeBuffer_ColorGamut =
116        OH_NativeBuffer_ColorGamut(6);
117    /// < BT2020
118    pub const NATIVEBUFFER_COLOR_GAMUT_BT2020: OH_NativeBuffer_ColorGamut =
119        OH_NativeBuffer_ColorGamut(7);
120    /// < BT2100 PQ
121    pub const NATIVEBUFFER_COLOR_GAMUT_BT2100_PQ: OH_NativeBuffer_ColorGamut =
122        OH_NativeBuffer_ColorGamut(8);
123    /// < BT2100 HLG
124    pub const NATIVEBUFFER_COLOR_GAMUT_BT2100_HLG: OH_NativeBuffer_ColorGamut =
125        OH_NativeBuffer_ColorGamut(9);
126    /// < Display BT2020
127    pub const NATIVEBUFFER_COLOR_GAMUT_DISPLAY_BT2020: OH_NativeBuffer_ColorGamut =
128        OH_NativeBuffer_ColorGamut(10);
129}
130#[repr(transparent)]
131/// Indicates the color gamut of a native buffer.
132///
133///
134/// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
135///
136/// Available since API-level: 12
137///
138/// Version: 1.0
139#[cfg(feature = "api-12")]
140#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
141#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
142pub struct OH_NativeBuffer_ColorGamut(pub ::core::ffi::c_uint);
143/// <b>OH_NativeBuffer</b> config.
144///
145/// Used to allocating new <b>OH_NativeBuffer</b> and query parameters if existing ones.
146///
147///
148/// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
149///
150/// Available since API-level: 9
151///
152/// Version: 1.0
153#[repr(C)]
154#[derive(Debug, Copy, Clone)]
155pub struct OH_NativeBuffer_Config {
156    /// < Width in pixels
157    pub width: i32,
158    /// < Height in pixels
159    pub height: i32,
160    /// < One of PixelFormat
161    pub format: i32,
162    /// < Combination of buffer usage
163    pub usage: i32,
164    /// < the stride of memory in bytes
165    pub stride: i32,
166}
167/// Holds info for a single image plane.
168///
169///
170///
171/// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
172///
173/// Available since API-level: 12
174///
175/// Version: 1.0
176#[cfg(feature = "api-12")]
177#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
178#[repr(C)]
179#[derive(Debug, Copy, Clone)]
180pub struct OH_NativeBuffer_Plane {
181    /// < Offset in bytes of plane.
182    pub offset: u64,
183    /// < Distance in bytes from the first value of one row of the image to the first value of the next row.
184    pub rowStride: u32,
185    /// < Distance in bytes from the first value of one column of the image to the first value of the next column.
186    pub columnStride: u32,
187}
188/// Holds all image planes.
189///
190///
191///
192/// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
193///
194/// Available since API-level: 12
195///
196/// Version: 1.0
197#[cfg(feature = "api-12")]
198#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
199#[repr(C)]
200#[derive(Debug, Copy, Clone)]
201pub struct OH_NativeBuffer_Planes {
202    /// < Number of distinct planes.
203    pub planeCount: u32,
204    /// < Array of image planes.
205    pub planes: [OH_NativeBuffer_Plane; 4usize],
206}
207extern "C" {
208    /// Alloc a <b>OH_NativeBuffer</b> that matches the passed BufferRequestConfig.
209    ///
210    /// A new <b>OH_NativeBuffer</b> instance is created each time this function is called.
211    ///
212    /// This interface needs to be used in conjunction with <b>OH_NativeBuffer_Unreference</b>,
213    /// otherwise memory leaks will occur.
214    ///
215    /// This interface is a non-thread-safe type interface.
216    ///
217    ///
218    ///
219    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
220    /// # Arguments
221    ///
222    /// * `config` - Indicates the pointer to a <b>BufferRequestConfig</b> instance.
223    ///
224    /// # Returns
225    ///
226    /// * Returns the pointer to the <b>OH_NativeBuffer</b> instance created if the operation is successful,
227    ///
228    /// returns <b>NULL</b> otherwise.
229    ///
230    /// Available since API-level: 9
231    ///
232    /// Version: 1.0
233    pub fn OH_NativeBuffer_Alloc(config: *const OH_NativeBuffer_Config) -> *mut OH_NativeBuffer;
234    /// Adds the reference count of a OH_NativeBuffer.
235    ///
236    /// This interface needs to be used in conjunction with <b>OH_NativeBuffer_Unreference</b>,
237    /// otherwise memory leaks will occur.
238    ///
239    /// This interface is a non-thread-safe type interface.
240    ///
241    ///
242    ///
243    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
244    /// # Arguments
245    ///
246    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
247    ///
248    /// # Returns
249    ///
250    /// * Returns an error code, 0 is success, otherwise, failed.
251    ///
252    /// Available since API-level: 9
253    ///
254    /// Version: 1.0
255    pub fn OH_NativeBuffer_Reference(buffer: *mut OH_NativeBuffer) -> i32;
256    /// Decreases the reference count of a OH_NativeBuffer and, when the reference count reaches 0,
257    /// destroys this OH_NativeBuffer.
258    ///
259    /// This interface is a non-thread-safe type interface.
260    ///
261    ///
262    ///
263    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
264    /// # Arguments
265    ///
266    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
267    ///
268    /// # Returns
269    ///
270    /// * Returns an error code, 0 is success, otherwise, failed.
271    ///
272    /// Available since API-level: 9
273    ///
274    /// Version: 1.0
275    pub fn OH_NativeBuffer_Unreference(buffer: *mut OH_NativeBuffer) -> i32;
276    /// Return a config of the OH_NativeBuffer in the passed OHNativeBufferConfig struct.
277    ///
278    /// This interface is a non-thread-safe type interface.
279    ///
280    ///
281    ///
282    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
283    /// # Arguments
284    ///
285    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
286    ///
287    /// * `config` - Indicates the pointer to the <b>NativeBufferConfig</b> of the buffer.
288    ///
289    /// # Returns
290    ///
291    /// * <b>void</b>
292    ///
293    /// Available since API-level: 9
294    ///
295    /// Version: 1.0
296    pub fn OH_NativeBuffer_GetConfig(
297        buffer: *mut OH_NativeBuffer,
298        config: *mut OH_NativeBuffer_Config,
299    );
300    /// Provide direct cpu access to the OH_NativeBuffer in the process's address space.
301    ///
302    /// This interface needs to be used in conjunction with <b>OH_NativeBuffer_Unmap</b>.
303    ///
304    /// This interface is a non-thread-safe type interface.
305    ///
306    ///
307    ///
308    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
309    /// # Arguments
310    ///
311    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
312    ///
313    /// * `virAddr` - Indicates the address of the <b>OH_NativeBuffer</b> in virtual memory.
314    ///
315    /// # Returns
316    ///
317    /// * Returns an error code, 0 is success, otherwise, failed.
318    ///
319    /// Available since API-level: 9
320    ///
321    /// Version: 1.0
322    pub fn OH_NativeBuffer_Map(
323        buffer: *mut OH_NativeBuffer,
324        virAddr: *mut *mut ::core::ffi::c_void,
325    ) -> i32;
326    /// Remove direct cpu access ability of the OH_NativeBuffer in the process's address space.
327    ///
328    /// This interface is a non-thread-safe type interface.
329    ///
330    ///
331    ///
332    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
333    /// # Arguments
334    ///
335    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
336    ///
337    /// # Returns
338    ///
339    /// * Returns an error code, 0 is success, otherwise, failed.
340    ///
341    /// Available since API-level: 9
342    ///
343    /// Version: 1.0
344    pub fn OH_NativeBuffer_Unmap(buffer: *mut OH_NativeBuffer) -> i32;
345    /// Get the system wide unique sequence number of the OH_NativeBuffer.
346    ///
347    /// This interface is a non-thread-safe type interface.
348    ///
349    ///
350    ///
351    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
352    /// # Arguments
353    ///
354    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
355    ///
356    /// # Returns
357    ///
358    /// * Returns the sequence number, which is unique for each OH_NativeBuffer.
359    ///
360    /// Available since API-level: 9
361    ///
362    /// Version: 1.0
363    pub fn OH_NativeBuffer_GetSeqNum(buffer: *mut OH_NativeBuffer) -> u32;
364    /// Provide direct cpu access to the potentially multi-planar OH_NativeBuffer in the process's address space.
365    ///
366    /// This interface is a non-thread-safe type interface.
367    ///
368    ///
369    ///
370    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
371    /// # Arguments
372    ///
373    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
374    ///
375    /// * `virAddr` - Indicates the address of the <b>OH_NativeBuffer</b> in virtual memory.
376    ///
377    /// * `outPlanes` - Indicates all image planes that contain the pixel data.
378    ///
379    /// # Returns
380    ///
381    /// * Returns an error code, 0 is success, otherwise, failed.
382    ///
383    /// Available since API-level: 12
384    ///
385    /// Version: 1.0
386    #[cfg(feature = "api-12")]
387    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
388    pub fn OH_NativeBuffer_MapPlanes(
389        buffer: *mut OH_NativeBuffer,
390        virAddr: *mut *mut ::core::ffi::c_void,
391        outPlanes: *mut OH_NativeBuffer_Planes,
392    ) -> i32;
393    /// Converts an <b>OHNativeWindowBuffer</b> instance to an <b>OH_NativeBuffer</b>.
394    ///
395    /// This interface is a non-thread-safe type interface.
396    ///
397    ///
398    ///
399    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
400    /// # Arguments
401    ///
402    /// * `nativeWindowBuffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
403    ///
404    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> pointer.
405    ///
406    /// # Returns
407    ///
408    /// * Returns an error code, 0 is success, otherwise, failed.
409    ///
410    /// Available since API-level: 12
411    ///
412    /// Version: 1.0
413    #[cfg(feature = "api-12")]
414    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
415    pub fn OH_NativeBuffer_FromNativeWindowBuffer(
416        nativeWindowBuffer: *mut OHNativeWindowBuffer,
417        buffer: *mut *mut OH_NativeBuffer,
418    ) -> i32;
419    /// Set the color space of the OH_NativeBuffer.
420    ///
421    /// This interface is a non-thread-safe type interface.
422    ///
423    ///
424    ///
425    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
426    /// # Arguments
427    ///
428    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
429    ///
430    /// * `colorSpace` - Indicates the color space of native buffer, see <b>OH_NativeBuffer_ColorSpace</b>.
431    ///
432    /// # Returns
433    ///
434    /// * Returns an error code, 0 is success, otherwise, failed.
435    ///
436    /// Available since API-level: 11
437    ///
438    /// Version: 1.0
439    #[cfg(feature = "api-11")]
440    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
441    pub fn OH_NativeBuffer_SetColorSpace(
442        buffer: *mut OH_NativeBuffer,
443        colorSpace: OH_NativeBuffer_ColorSpace,
444    ) -> i32;
445    /// Get the color space of the OH_NativeBuffer.
446    ///
447    /// This interface is a non-thread-safe type interface.
448    ///
449    ///
450    ///
451    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
452    /// # Arguments
453    ///
454    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
455    ///
456    /// * `colorSpace` - Indicates the color space of native buffer, see <b>OH_NativeBuffer_ColorSpace</b>.
457    ///
458    /// # Returns
459    ///
460    /// * [`NATIVE_ERROR_OK`] 0 - Success.
461    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - buffer is NULL.
462    /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - Incorrect colorSpace state.
463    ///
464    /// Available since API-level: 12
465    ///
466    /// Version: 1.0
467    #[cfg(feature = "api-12")]
468    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
469    pub fn OH_NativeBuffer_GetColorSpace(
470        buffer: *mut OH_NativeBuffer,
471        colorSpace: *mut OH_NativeBuffer_ColorSpace,
472    ) -> i32;
473    /// Set the metadata type of the OH_NativeBuffer.
474    ///
475    /// This interface is a non-thread-safe type interface.
476    ///
477    ///
478    ///
479    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
480    /// # Arguments
481    ///
482    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
483    ///
484    /// * `metadataKey` - Indicates the metadata type of native buffer, see <b>OH_NativeBuffer_MetadataKey</b>.
485    ///
486    /// * `size` - Indicates the size of a uint8_t vector.
487    ///
488    /// * `metadata` - Indicates the pointer to a uint8_t vector.
489    ///
490    /// # Returns
491    ///
492    /// * [`NATIVE_ERROR_OK`] 0 - Success.
493    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - buffer or metadata is NULL.
494    /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - Incorrect metadata state.
495    /// [`NATIVE_ERROR_UNSUPPORTED`] 50102000 - Unsupported metadata key.
496    ///
497    /// Available since API-level: 12
498    ///
499    /// Version: 1.0
500    #[cfg(feature = "api-12")]
501    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
502    pub fn OH_NativeBuffer_SetMetadataValue(
503        buffer: *mut OH_NativeBuffer,
504        metadataKey: OH_NativeBuffer_MetadataKey,
505        size: i32,
506        metadata: *mut u8,
507    ) -> i32;
508    /// Set the metadata type of the OH_NativeBuffer.
509    ///
510    /// This interface is a non-thread-safe type interface.
511    ///
512    ///
513    ///
514    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
515    /// # Arguments
516    ///
517    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
518    ///
519    /// * `metadataKey` - Indicates the metadata type of native buffer, see <b>OH_NativeBuffer_MetadataKey</b>.
520    ///
521    /// * `size` - Indicates the size of a uint8_t vector.
522    ///
523    /// * `metadata` - Indicates the pointer to a uint8_t vector.
524    ///
525    /// # Returns
526    ///
527    /// * [`NATIVE_ERROR_OK`] 0 - Success.
528    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - buffer, metadata, or size is NULL.
529    /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - Incorrect metadata state.
530    /// [`NATIVE_ERROR_UNSUPPORTED`] 50102000 - Unsupported metadata key.
531    ///
532    /// Available since API-level: 12
533    ///
534    /// Version: 1.0
535    #[cfg(feature = "api-12")]
536    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
537    pub fn OH_NativeBuffer_GetMetadataValue(
538        buffer: *mut OH_NativeBuffer,
539        metadataKey: OH_NativeBuffer_MetadataKey,
540        size: *mut i32,
541        metadata: *mut *mut u8,
542    ) -> i32;
543    /// Provide direct cpu access to the OH_NativeBuffer in the process's address space and wait fence.
544    ///
545    /// If the interface returns OK, fenceFd does not need to be closed by the developer,
546    /// Otherwise, the developer needs to close the fenceFd.
547    ///
548    /// This interface is a non-thread-safe type interface.
549    ///
550    ///
551    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
552    /// # Arguments
553    ///
554    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
555    ///
556    /// * `fenceFd` - Indicates the pointer to a file descriptor handle.
557    ///
558    /// * `virAddr` - Indicates the address of the <b>OH_NativeBuffer</b> in virtual memory.
559    ///
560    /// # Returns
561    ///
562    /// * [`NATIVE_ERROR_OK`] 0 - Success.
563    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - buffer or virAddr is NULL or invalid fenceFd.
564    /// [`NATIVE_ERROR_UNKNOWN`] 50002000 - map failed.
565    ///
566    /// Available since API-level: 23
567    ///
568    /// Version: 1.0
569    #[cfg(feature = "api-23")]
570    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
571    pub fn OH_NativeBuffer_MapWaitFence(
572        buffer: *mut OH_NativeBuffer,
573        fenceFd: i32,
574        virAddr: *mut *mut ::core::ffi::c_void,
575    ) -> i32;
576    /// Serialize <b>OH_NativeBuffer</b> object to the serialized <b>OHIPCParcel</b> object.
577    ///
578    /// This interface is a non-thread-safe type interface.
579    ///
580    ///
581    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
582    /// # Arguments
583    ///
584    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
585    ///
586    /// * `parcel` - Indicates the serialized <b>OHIPCParcel</b> object.
587    ///
588    /// # Returns
589    ///
590    /// * [`NATIVE_ERROR_OK`] 0 - Success.
591    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - buffer or parcel is NULL.
592    /// [`SURFACE_ERROR_BINDER_ERROR`] 50401000 - ipc send failed.
593    ///
594    /// Available since API-level: 23
595    ///
596    /// Version: 1.0
597    #[cfg(feature = "api-23")]
598    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
599    pub fn OH_NativeBuffer_WriteToParcel(
600        buffer: *mut OH_NativeBuffer,
601        parcel: *mut OHIPCParcel,
602    ) -> i32;
603    /// Deserialize data from the serialized <b>OHIPCParcel</b> object and rebuild <b>OH_NativeBuffer</b> object.
604    /// This interface will cause an increase in the reference count of the <b>OH_NativeBuffer</b> instance.
605    /// This interface needs to be used in conjunction with <b>OH_NativeBuffer_Unreference</b>,
606    ///
607    /// otherwise memory leaks will occur.
608    /// This interface is a non-thread-safe type interface.
609    ///
610    ///
611    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
612    /// # Arguments
613    ///
614    /// * `parcel` - Indicates the serialized <b>OHIPCParcel</b> object.
615    ///
616    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> pointer.
617    ///
618    /// # Returns
619    ///
620    /// * [`NATIVE_ERROR_OK`] 0 - Success.
621    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - parcel or buffer is NULL.
622    /// [`NATIVE_ERROR_UNKNOWN`] 50002000 - deserialize failed.
623    ///
624    /// Available since API-level: 23
625    ///
626    /// Version: 1.0
627    #[cfg(feature = "api-23")]
628    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
629    pub fn OH_NativeBuffer_ReadFromParcel(
630        parcel: *mut OHIPCParcel,
631        buffer: *mut *mut OH_NativeBuffer,
632    ) -> i32;
633    /// Check whether the system supports the <b>NativeBufferConfig</b>.
634    ///
635    /// This interface is a non-thread-safe type interface.
636    ///
637    ///
638    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
639    /// # Arguments
640    ///
641    /// * `config` - Indicates the config of the <b>OH_NativeBuffer</b>.
642    ///
643    /// * `isSupported` - Indicates whether the system supports the <b>NativeBufferConfig</b>.
644    ///
645    /// # Returns
646    ///
647    /// * [`NATIVE_ERROR_OK`] 0 - Success.
648    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - isSupported is NULL.
649    ///
650    /// Available since API-level: 23
651    ///
652    /// Version: 1.0
653    #[cfg(feature = "api-23")]
654    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
655    pub fn OH_NativeBuffer_IsSupported(
656        config: OH_NativeBuffer_Config,
657        isSupported: *mut bool,
658    ) -> i32;
659    /// Provide direct cpu access to the <b>OH_NativeBuffer</b> in the process's address space,
660    ///
661    /// and return a <b>NativeBufferConfig<b> of the <b>OH_NativeBuffer</b>.
662    /// This interface is a non-thread-safe type interface.
663    ///
664    ///
665    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeBuffer
666    /// # Arguments
667    ///
668    /// * `buffer` - Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
669    ///
670    /// * `virAddr` - Indicates the address of the <b>OH_NativeBuffer</b> in virtual memory.
671    ///
672    /// * `config` - Indicates the pointer to the <b>NativeBufferConfig</b> of the buffer.
673    ///
674    /// # Returns
675    ///
676    /// * [`NATIVE_ERROR_OK`] 0 - Success.
677    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - buffer or virAddr or config is NULL or invalid fenceFd.
678    /// [`NATIVE_ERROR_UNKNOWN`] 50002000 - map failed.
679    ///
680    /// Available since API-level: 23
681    ///
682    /// Version: 1.0
683    #[cfg(feature = "api-23")]
684    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
685    pub fn OH_NativeBuffer_MapAndGetConfig(
686        buffer: *mut OH_NativeBuffer,
687        virAddr: *mut *mut ::core::ffi::c_void,
688        config: *mut OH_NativeBuffer_Config,
689    ) -> i32;
690}