xref: /OK3568_Linux_fs/external/libmali/include/FBDEV/mali_fbdev_types.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * This confidential and proprietary software may be used only as
3  * authorised by a licensing agreement from ARM Limited
4  * (C) COPYRIGHT 2014-2015 ARM Limited
5  * ALL RIGHTS RESERVED
6  * The entire notice above must be reproduced on all authorised
7  * copies and copies may only be made to the extent permitted
8  * by a licensing agreement from ARM Limited.
9  */
10 #ifndef _MALI_FBDEV_TYPES_H_
11 #define _MALI_FBDEV_TYPES_H_
12 
13 typedef struct fbdev_window
14 {
15 	unsigned short width;
16 	unsigned short height;
17 } fbdev_window;
18 
19 typedef struct mali_native_window
20 {
21 	unsigned short width;
22 	unsigned short height;
23 } mali_native_window;
24 
25 typedef union mem_handle
26 {
27 	int fd;                    /* fd to dma memory */
28 } mem_handle;
29 
30 typedef struct egl_linux_pixmap
31 {
32 	int width, height;
33 
34 	struct
35 	{
36 		/** @brief The line stride of each plane.
37 		 * For each plane required by the format, the number of bytes from one line of samples to the next. Other entries in
38 		 * the array should be 0.
39 		 */
40 		khronos_usize_t stride;
41 		/** @brief The byte size of each plane.
42 		 * For each plane required by the format, the number of bytes taken up by that plane. That includes any space wasted
43 		 * in partially-used blocks.
44 		 */
45 		khronos_usize_t size;
46 		/** @brief The offset from the memory handle to each plane.
47 		 * For each plane required by the format, the number of bytes from the start of the UMP region to the start of that
48 		 * plane. Other entries in the array should be 0.
49 		 */
50 		khronos_usize_t offset;
51 	}
52 	planes[3];
53 
54 	/** An integer that specifies the format of the pixmap. Its meaning is known by tpi and winsys. */
55 	uint64_t pixmap_format;
56 
57 	/** Three buffers that can be used by this pixmap. In case of RGB pixmap only the first one is going to be
58 	 * used. In case of YUV pixmap all three of them can be used for storing Y, U and V color coordinates separately.*/
59 	mem_handle handles[3];
60 } egl_linux_pixmap;
61 
62 typedef struct dummy_display
63 {
64 	int width;
65 	int height;
66 	int bytes_per_pixel;
67 	int red_mask;
68 	int green_mask;
69 	int blue_mask;
70 	int alpha_mask;
71 	unsigned char *front_buffer;
72 } dummy_display;
73 
74 /** Converts a pixmap ID to the corresponding pixmap structure.
75  *
76  * @param[in] id The pixmap ID to lookup
77  *
78  * @return A pointer to the pixmap structure or NULL on failure
79  */
80 egl_linux_pixmap* egl_lookup_pixmap_ID_mapping(int32_t id);
81 
82 /** Creates a pixmap ID from a pixmap structure.
83  *
84  * @param[in] pixmap
85  *
86  * @return The pixmap ID or -1 on failure
87  */
88 int32_t egl_create_pixmap_ID_mapping(egl_linux_pixmap* pixmap);
89 
90 /** Destroy a pixmap ID to pixmap structure mapping. The caller is responsible for
91  *  destroying the pixmap structure.
92  *
93  * @param[in] id The pixmap ID for which the corresponding
94  *               mapping should be destroyed
95  *
96  * @return EGL_TRUE on success or EGL_FALSE on failure
97  */
98 unsigned int egl_destroy_pixmap_ID_mapping(int32_t id);
99 
100 #endif /* _MALI_FBDEV_TYPES_H_ */
101