RgaApi.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (C) 2016 Rockchip Electronics Co., Ltd.
  3. * Authors:
  4. * Zhiqin Wei <wzq@rock-chips.com>
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #ifndef _rockchip_rga_c_h_
  19. #define _rockchip_rga_c_h_
  20. #include <stdint.h>
  21. #include <sys/types.h>
  22. #include <stdlib.h>
  23. #include <stdio.h>
  24. #include <string.h>
  25. #include <errno.h>
  26. #include <time.h>
  27. #include <unistd.h>
  28. #include <sys/mman.h>
  29. #include <linux/stddef.h>
  30. #include "drmrga.h"
  31. #include "rga.h"
  32. #ifdef __cplusplus
  33. extern "C"{
  34. #endif
  35. /*
  36. * Compatible with the old version of C interface.The new
  37. * version of the C interface no longer requires users to
  38. * initialize rga, so RgaInit and RgaDeInit are just for
  39. * compatibility with the old C interface, so please do
  40. * not use ctx, because it is usually a NULL.
  41. */
  42. #define RgaInit(ctx) ({ \
  43. int ret = 0; \
  44. ret = c_RkRgaInit(); \
  45. c_RkRgaGetContext(ctx); \
  46. ret;\
  47. })
  48. #define RgaDeInit(ctx) { \
  49. (void)ctx; /* unused */ \
  50. c_RkRgaDeInit(); \
  51. }
  52. #define RgaBlit(...) c_RkRgaBlit(__VA_ARGS__)
  53. #define RgaCollorFill(...) c_RkRgaColorFill(__VA_ARGS__)
  54. #define RgaFlush() c_RkRgaFlush()
  55. int c_RkRgaInit();
  56. void c_RkRgaDeInit();
  57. void c_RkRgaGetContext(void **ctx);
  58. int c_RkRgaBlit(rga_info_t *src, rga_info_t *dst, rga_info_t *src1);
  59. int c_RkRgaColorFill(rga_info_t *dst);
  60. int c_RkRgaFlush();
  61. #ifndef ANDROID /* linux */
  62. int c_RkRgaGetAllocBuffer(bo_t *bo_info, int width, int height, int bpp);
  63. int c_RkRgaGetAllocBufferCache(bo_t *bo_info, int width, int height, int bpp);
  64. int c_RkRgaGetMmap(bo_t *bo_info);
  65. int c_RkRgaUnmap(bo_t *bo_info);
  66. int c_RkRgaFree(bo_t *bo_info);
  67. int c_RkRgaGetBufferFd(bo_t *bo_info, int *fd);
  68. #endif /* #ifndef ANDROID */
  69. #ifdef __cplusplus
  70. }
  71. #endif
  72. #endif /* #ifndef _rockchip_rga_c_h_ */