exynos_drmif.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics Co., Ltd.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. *
  23. * Authors:
  24. * Inki Dae <inki.dae@samsung.com>
  25. */
  26. #ifndef EXYNOS_DRMIF_H_
  27. #define EXYNOS_DRMIF_H_
  28. #include <xf86drm.h>
  29. #include <stdint.h>
  30. #include "exynos_drm.h"
  31. #if defined(__cplusplus)
  32. extern "C" {
  33. #endif
  34. struct exynos_device {
  35. int fd;
  36. };
  37. /*
  38. * Exynos Buffer Object structure.
  39. *
  40. * @dev: exynos device object allocated.
  41. * @handle: a gem handle to gem object created.
  42. * @flags: indicate memory allocation and cache attribute types.
  43. * @size: size to the buffer created.
  44. * @vaddr: user space address to a gem buffer mmapped.
  45. * @name: a gem global handle from flink request.
  46. */
  47. struct exynos_bo {
  48. struct exynos_device *dev;
  49. uint32_t handle;
  50. uint32_t flags;
  51. size_t size;
  52. void *vaddr;
  53. uint32_t name;
  54. };
  55. #define EXYNOS_EVENT_CONTEXT_VERSION 1
  56. /*
  57. * Exynos Event Context structure.
  58. *
  59. * @base: base context (for core events).
  60. * @version: version info similar to the one in 'drmEventContext'.
  61. * @g2d_event_handler: handler for G2D events.
  62. */
  63. struct exynos_event_context {
  64. drmEventContext base;
  65. int version;
  66. void (*g2d_event_handler)(int fd, unsigned int cmdlist_no,
  67. unsigned int tv_sec, unsigned int tv_usec,
  68. void *user_data);
  69. };
  70. /*
  71. * device related functions:
  72. */
  73. struct exynos_device * exynos_device_create(int fd);
  74. void exynos_device_destroy(struct exynos_device *dev);
  75. /*
  76. * buffer-object related functions:
  77. */
  78. struct exynos_bo * exynos_bo_create(struct exynos_device *dev,
  79. size_t size, uint32_t flags);
  80. int exynos_bo_get_info(struct exynos_device *dev, uint32_t handle,
  81. size_t *size, uint32_t *flags);
  82. void exynos_bo_destroy(struct exynos_bo *bo);
  83. struct exynos_bo * exynos_bo_from_name(struct exynos_device *dev, uint32_t name);
  84. int exynos_bo_get_name(struct exynos_bo *bo, uint32_t *name);
  85. uint32_t exynos_bo_handle(struct exynos_bo *bo);
  86. void * exynos_bo_map(struct exynos_bo *bo);
  87. int exynos_prime_handle_to_fd(struct exynos_device *dev, uint32_t handle,
  88. int *fd);
  89. int exynos_prime_fd_to_handle(struct exynos_device *dev, int fd,
  90. uint32_t *handle);
  91. /*
  92. * Virtual Display related functions:
  93. */
  94. int exynos_vidi_connection(struct exynos_device *dev, uint32_t connect,
  95. uint32_t ext, void *edid);
  96. /*
  97. * event handling related functions:
  98. */
  99. int exynos_handle_event(struct exynos_device *dev,
  100. struct exynos_event_context *ctx);
  101. #if defined(__cplusplus)
  102. }
  103. #endif
  104. #endif /* EXYNOS_DRMIF_H_ */