1 /*
2  * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup DriverHdi
18  * @{
19  *
20  * @brief Provides APIs for a system ability to obtain hardware device interface (HDI) services,
21  * load or unload a device, and listen for service status, and capabilities for the hdi-gen tool
22  * to automatically generate code in interface description language (IDL).
23  *
24  * The HDF and IDL code generated allow the system ability to accesses HDI driver services.
25  *
26  * @since 1.0
27  */
28 
29 /**
30  * @file buffer_handle.h
31  *
32  * @brief Defines the common data struct for graphics processing.
33  * The <b>BufferHandle</b> must comply with the IDL syntax.
34  *
35  * You only need to define the struct in IDL for the service module.
36  * The HDI module implements serialization and deserialization of this struct.
37  *
38  * @since 1.0
39  */
40 
41 #ifndef INCLUDE_BUFFER_HANDLE_H
42 #define INCLUDE_BUFFER_HANDLE_H
43 
44 #include <stdint.h>
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 /**
51  * @brief Defines the <b>BufferHandle</b> struct.
52  */
53 typedef struct {
54     int32_t fd;           /**< Buffer file descriptor (FD). The value <b>-1</b> indicates a invalid FD. */
55     int32_t width;        /**< Width of the image */
56     int32_t stride;       /**< Stride of the image */
57     int32_t height;       /**< Height of the image */
58     int32_t size;         /* < Size of the buffer */
59     int32_t format;       /**< Format of the image */
60     uint64_t usage;       /**< Usage of the buffer */
61     void *virAddr;        /**< Virtual address of the buffer */
62     uint64_t phyAddr;     /**< Physical address */
63     uint32_t reserveFds;  /**< Number of the reserved FDs */
64     uint32_t reserveInts; /**< Number of the reserved integers */
65     int32_t reserve[0];   /**< Data */
66 } BufferHandle;
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif // INCLUDE_BUFFER_HANDLE_H
73