omap_drm.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * include/uapi/drm/omap_drm.h
  3. *
  4. * Copyright (C) 2011 Texas Instruments
  5. * Author: Rob Clark <rob@ti.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published by
  9. * the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  14. * more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with
  17. * this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef __OMAP_DRM_H__
  20. #define __OMAP_DRM_H__
  21. #include "drm.h"
  22. #if defined(__cplusplus)
  23. extern "C" {
  24. #endif
  25. /* Please note that modifications to all structs defined here are
  26. * subject to backwards-compatibility constraints.
  27. */
  28. #define OMAP_PARAM_CHIPSET_ID 1 /* ie. 0x3430, 0x4430, etc */
  29. struct drm_omap_param {
  30. uint64_t param; /* in */
  31. uint64_t value; /* in (set_param), out (get_param) */
  32. };
  33. #define OMAP_BO_SCANOUT 0x00000001 /* scanout capable (phys contiguous) */
  34. #define OMAP_BO_CACHE_MASK 0x00000006 /* cache type mask, see cache modes */
  35. #define OMAP_BO_TILED_MASK 0x00000f00 /* tiled mapping mask, see tiled modes */
  36. #define OMAP_BO_MEM_CONTIG 0x00000008 /* only use contiguous dma mem */
  37. #define OMAP_BO_MEM_TILER 0x00000010 /* only use TILER mem */
  38. #define OMAP_BO_MEM_PIN 0x00000020 /* pin the buffer when allocating */
  39. /* cache modes */
  40. #define OMAP_BO_CACHED 0x00000000 /* default */
  41. #define OMAP_BO_WC 0x00000002 /* write-combine */
  42. #define OMAP_BO_UNCACHED 0x00000004 /* strongly-ordered (uncached) */
  43. /* tiled modes */
  44. #define OMAP_BO_TILED_8 0x00000100
  45. #define OMAP_BO_TILED_16 0x00000200
  46. #define OMAP_BO_TILED_32 0x00000300
  47. #define OMAP_BO_TILED (OMAP_BO_TILED_8 | OMAP_BO_TILED_16 | OMAP_BO_TILED_32)
  48. union omap_gem_size {
  49. uint32_t bytes; /* (for non-tiled formats) */
  50. struct {
  51. uint16_t width;
  52. uint16_t height;
  53. } tiled; /* (for tiled formats) */
  54. };
  55. struct drm_omap_gem_new {
  56. union omap_gem_size size; /* in */
  57. uint32_t flags; /* in */
  58. uint32_t handle; /* out */
  59. uint32_t __pad;
  60. };
  61. /* mask of operations: */
  62. enum omap_gem_op {
  63. OMAP_GEM_READ = 0x01,
  64. OMAP_GEM_WRITE = 0x02,
  65. };
  66. struct drm_omap_gem_cpu_prep {
  67. uint32_t handle; /* buffer handle (in) */
  68. uint32_t op; /* mask of omap_gem_op (in) */
  69. };
  70. struct drm_omap_gem_cpu_fini {
  71. uint32_t handle; /* buffer handle (in) */
  72. uint32_t op; /* mask of omap_gem_op (in) */
  73. /* TODO maybe here we pass down info about what regions are touched
  74. * by sw so we can be clever about cache ops? For now a placeholder,
  75. * set to zero and we just do full buffer flush..
  76. */
  77. uint32_t nregions;
  78. uint32_t __pad;
  79. };
  80. struct drm_omap_gem_info {
  81. uint32_t handle; /* buffer handle (in) */
  82. uint32_t pad;
  83. uint64_t offset; /* mmap offset (out) */
  84. /* note: in case of tiled buffers, the user virtual size can be
  85. * different from the physical size (ie. how many pages are needed
  86. * to back the object) which is returned in DRM_IOCTL_GEM_OPEN..
  87. * This size here is the one that should be used if you want to
  88. * mmap() the buffer:
  89. */
  90. uint32_t size; /* virtual size for mmap'ing (out) */
  91. uint32_t __pad;
  92. };
  93. #define DRM_OMAP_GET_PARAM 0x00
  94. #define DRM_OMAP_SET_PARAM 0x01
  95. #define DRM_OMAP_GEM_NEW 0x03
  96. #define DRM_OMAP_GEM_CPU_PREP 0x04
  97. #define DRM_OMAP_GEM_CPU_FINI 0x05
  98. #define DRM_OMAP_GEM_INFO 0x06
  99. #define DRM_OMAP_NUM_IOCTLS 0x07
  100. #define DRM_IOCTL_OMAP_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param)
  101. #define DRM_IOCTL_OMAP_SET_PARAM DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param)
  102. #define DRM_IOCTL_OMAP_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new)
  103. #define DRM_IOCTL_OMAP_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep)
  104. #define DRM_IOCTL_OMAP_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini)
  105. #define DRM_IOCTL_OMAP_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_INFO, struct drm_omap_gem_info)
  106. #if defined(__cplusplus)
  107. }
  108. #endif
  109. #endif /* __OMAP_DRM_H__ */