bo.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright 2016 Rockchip Electronics S.LSI Co. LTD
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef MPP_LINUX_C_BO_H
  17. #define MPP_LINUX_C_BO_H
  18. #include <drm/drm_fourcc.h>
  19. #include <xf86drm.h>
  20. #include <xf86drmMode.h>
  21. #include <errno.h>
  22. #include <fcntl.h>
  23. #include <string.h>
  24. #include <stdio.h>
  25. #include <stdlib.h>
  26. #include <stdint.h>
  27. #include <sys/mman.h>
  28. #include "dev.h"
  29. #undef USE_ATOMIC_API
  30. struct sp_dev;
  31. struct sp_bo {
  32. struct sp_dev *dev;
  33. uint32_t width;
  34. uint32_t height;
  35. uint32_t depth;
  36. uint32_t bpp;
  37. uint32_t format;
  38. uint32_t flags;
  39. uint32_t fb_id;
  40. uint32_t handle;
  41. void *map_addr;
  42. uint32_t pitch;
  43. uint32_t size;
  44. };
  45. int add_fb_sp_bo(struct sp_bo *bo, uint32_t format);
  46. struct sp_bo* create_sp_bo(struct sp_dev *dev, uint32_t width, uint32_t height,
  47. uint32_t depth, uint32_t bpp, uint32_t format, uint32_t flags);
  48. void fill_bo(struct sp_bo *bo, uint8_t a, uint8_t r, uint8_t g, uint8_t b);
  49. void draw_rect(struct sp_bo *bo, uint32_t x, uint32_t y, uint32_t width,
  50. uint32_t height, uint8_t a, uint8_t r, uint8_t g, uint8_t b);
  51. void free_sp_bo(struct sp_bo *bo);
  52. #endif //MPP_LINUX_C_BO_H