omap_drm.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
  2. /*
  3. * Copyright (C) 2011 Texas Instruments, Inc
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a
  6. * copy of this software and associated documentation files (the "Software"),
  7. * to deal in the Software without restriction, including without limitation
  8. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. * and/or sell copies of the Software, and to permit persons to whom the
  10. * Software is furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice (including the next
  13. * paragraph) shall be included in all copies or substantial portions of the
  14. * Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  22. * SOFTWARE.
  23. *
  24. * Authors:
  25. * Rob Clark <rob@ti.com>
  26. */
  27. #ifndef __OMAP_DRM_H__
  28. #define __OMAP_DRM_H__
  29. #include <stdint.h>
  30. #include <drm.h>
  31. /* Please note that modifications to all structs defined here are
  32. * subject to backwards-compatibility constraints.
  33. */
  34. #define OMAP_PARAM_CHIPSET_ID 1 /* ie. 0x3430, 0x4430, etc */
  35. struct drm_omap_param {
  36. uint64_t param; /* in */
  37. uint64_t value; /* in (set_param), out (get_param) */
  38. };
  39. struct drm_omap_get_base {
  40. char plugin_name[64]; /* in */
  41. uint32_t ioctl_base; /* out */
  42. uint32_t __pad;
  43. };
  44. #define OMAP_BO_SCANOUT 0x00000001 /* scanout capable (phys contiguous) */
  45. #define OMAP_BO_CACHE_MASK 0x00000006 /* cache type mask, see cache modes */
  46. #define OMAP_BO_TILED_MASK 0x00000f00 /* tiled mapping mask, see tiled modes */
  47. /* cache modes */
  48. #define OMAP_BO_CACHED 0x00000000 /* default */
  49. #define OMAP_BO_WC 0x00000002 /* write-combine */
  50. #define OMAP_BO_UNCACHED 0x00000004 /* strongly-ordered (uncached) */
  51. /* tiled modes */
  52. #define OMAP_BO_TILED_8 0x00000100
  53. #define OMAP_BO_TILED_16 0x00000200
  54. #define OMAP_BO_TILED_32 0x00000300
  55. #define OMAP_BO_TILED (OMAP_BO_TILED_8 | OMAP_BO_TILED_16 | OMAP_BO_TILED_32)
  56. union omap_gem_size {
  57. uint32_t bytes; /* (for non-tiled formats) */
  58. struct {
  59. uint16_t width;
  60. uint16_t height;
  61. } tiled; /* (for tiled formats) */
  62. };
  63. struct drm_omap_gem_new {
  64. union omap_gem_size size; /* in */
  65. uint32_t flags; /* in */
  66. uint32_t handle; /* out */
  67. uint32_t __pad;
  68. };
  69. /* mask of operations: */
  70. enum omap_gem_op {
  71. OMAP_GEM_READ = 0x01,
  72. OMAP_GEM_WRITE = 0x02,
  73. };
  74. struct drm_omap_gem_cpu_prep {
  75. uint32_t handle; /* buffer handle (in) */
  76. uint32_t op; /* mask of omap_gem_op (in) */
  77. };
  78. struct drm_omap_gem_cpu_fini {
  79. uint32_t handle; /* buffer handle (in) */
  80. uint32_t op; /* mask of omap_gem_op (in) */
  81. /* TODO maybe here we pass down info about what regions are touched
  82. * by sw so we can be clever about cache ops? For now a placeholder,
  83. * set to zero and we just do full buffer flush..
  84. */
  85. uint32_t nregions;
  86. uint32_t __pad;
  87. };
  88. struct drm_omap_gem_info {
  89. uint32_t handle; /* buffer handle (in) */
  90. uint32_t pad;
  91. uint64_t offset; /* mmap offset (out) */
  92. /* note: in case of tiled buffers, the user virtual size can be
  93. * different from the physical size (ie. how many pages are needed
  94. * to back the object) which is returned in DRM_IOCTL_GEM_OPEN..
  95. * This size here is the one that should be used if you want to
  96. * mmap() the buffer:
  97. */
  98. uint32_t size; /* virtual size for mmap'ing (out) */
  99. uint32_t __pad;
  100. };
  101. #define DRM_OMAP_GET_PARAM 0x00
  102. #define DRM_OMAP_SET_PARAM 0x01
  103. #define DRM_OMAP_GET_BASE 0x02
  104. #define DRM_OMAP_GEM_NEW 0x03
  105. #define DRM_OMAP_GEM_CPU_PREP 0x04
  106. #define DRM_OMAP_GEM_CPU_FINI 0x05
  107. #define DRM_OMAP_GEM_INFO 0x06
  108. #define DRM_OMAP_NUM_IOCTLS 0x07
  109. #define DRM_IOCTL_OMAP_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param)
  110. #define DRM_IOCTL_OMAP_SET_PARAM DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param)
  111. #define DRM_IOCTL_OMAP_GET_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_BASE, struct drm_omap_get_base)
  112. #define DRM_IOCTL_OMAP_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new)
  113. #define DRM_IOCTL_OMAP_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep)
  114. #define DRM_IOCTL_OMAP_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini)
  115. #define DRM_IOCTL_OMAP_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_INFO, struct drm_omap_gem_info)
  116. #endif /* __OMAP_DRM_H__ */