video_mem.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2021-2022 Alibaba Group. All rights reserved.
  3. * License-Identifier: Apache-2.0
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  6. * not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. #ifndef _VIDEO_MEM_H_
  19. #define _VIDEO_MEM_H_
  20. /* No special needs. */
  21. #define VMEM_FLAG_NONE 0x00000000
  22. /* Physical contiguous. */
  23. #define VMEM_FLAG_CONTIGUOUS 0x00000001
  24. /* Physical non contiguous. */
  25. #define VMEM_FLAG_NON_CONTIGUOUS 0x00000002
  26. /* Need 32bit address. */
  27. #define VMEM_FLAG_4GB_ADDR 0x00000004
  28. typedef enum _VmemStatus
  29. {
  30. VMEM_STATUS_OK = 0,
  31. VMEM_STATUS_ERROR = -1, /* general error */
  32. VMEM_STATUS_NO_MEMORY = -2, /* not enough memory to allocate buffer */
  33. } VmemStatus;
  34. typedef struct _VmemParams
  35. {
  36. int size;
  37. int flags;
  38. unsigned int phy_address;
  39. void *vir_address;
  40. int fd;
  41. } VmemParams;
  42. VmemStatus VMEM_create(void **vmem);
  43. VmemStatus VMEM_allocate(void *vmem, VmemParams *params);
  44. VmemStatus VMEM_mmap(void *vmem, VmemParams *params);
  45. VmemStatus VMEM_free(void *vmem, VmemParams *params);
  46. VmemStatus VMEM_destroy(void *vmem);
  47. VmemStatus VMEM_export(void *vmem, VmemParams *params);
  48. VmemStatus VMEM_import(void *vmem, VmemParams *params);
  49. VmemStatus VMEM_release(void *vmem, VmemParams *params);
  50. #endif /* !_VIDEO_MEM_H_ */