2 * Copyright (C) 2016 Nexell Co., Ltd.
3 * Author: SeongO, Park <ray@nexell.co.kr>
6 #ifndef __NX_VIDEO_ALLOC_H__
7 #define __NX_VIDEO_ALLOC_H__
17 #define NX_MAX_PLANES 4
20 // Nexell Private Memory Type
24 int drmFd; // DRM Device Handle
25 int dmaFd; // DMA Memory Handle
26 int gemFd; // GEM Handle
27 uint32_t flink; // flink name
28 int32_t size; // Allocate Size
29 int32_t align; // Start Address Align
30 void *pBuffer; // Virtual Address Pointer
32 } NX_MEMORY_INFO, *NX_MEMORY_HANDLE;
36 // Nexell Private Video Memory Type
40 int32_t width; // Video Image's Width
41 int32_t height; // Video Image's Height
42 int32_t align; // Start address align
43 int32_t planes; // Number of valid planes
44 uint32_t format; // Pixel Format(N/A)
46 int drmFd; // Drm Device Handle
47 int dmaFd[NX_MAX_PLANES]; // DMA memory Handle
48 int gemFd[NX_MAX_PLANES]; // GEM Handle
49 uint32_t flink[NX_MAX_PLANES]; // flink name
50 int32_t size[NX_MAX_PLANES]; // Each plane's size.
51 int32_t stride[NX_MAX_PLANES]; // Each plane's stride.
52 void *pBuffer[NX_MAX_PLANES]; // virtual address.
53 uint32_t reserved[NX_MAX_PLANES]; // for debugging or future user.
54 } NX_VID_MEMORY_INFO, *NX_VID_MEMORY_HANDLE;
56 // Nexell Private Memory Allocator
57 NX_MEMORY_INFO *NX_AllocateMemory (int size, int align);
58 void NX_FreeMemory (NX_MEMORY_INFO * pMem);
60 // Video Specific Allocator Wrapper
61 NX_VID_MEMORY_INFO *NX_AllocateVideoMemory (int width, int height,
62 int32_t planes, uint32_t format, int align);
63 void NX_FreeVideoMemory (NX_VID_MEMORY_INFO * pMem);
65 int NX_MapMemory (NX_MEMORY_INFO * pMem);
66 int NX_UnmapMemory (NX_MEMORY_INFO * pMem);
68 int NX_MapVideoMemory (NX_VID_MEMORY_INFO * pMem);
69 int NX_UnmapVideoMemory (NX_VID_MEMORY_INFO * pMem);
71 int NX_GetGEMHandles (int drmFd, NX_VID_MEMORY_INFO * pMem,
72 uint32_t handles[NX_MAX_PLANES]);
73 int NX_GetGemHandle (int drmFd, NX_VID_MEMORY_INFO * pMem, int32_t plane);
79 #endif // __NX_VIDEO_ALLOC_H__