drm_legacy.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #ifndef __DRM_LEGACY_H__
  2. #define __DRM_LEGACY_H__
  3. /*
  4. * Copyright (c) 2014 David Herrmann <dh.herrmann@gmail.com>
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the "Software"),
  8. * to deal in the Software without restriction, including without limitation
  9. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. * and/or sell copies of the Software, and to permit persons to whom the
  11. * Software is furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22. * OTHER DEALINGS IN THE SOFTWARE.
  23. */
  24. /*
  25. * This file contains legacy interfaces that modern drm drivers
  26. * should no longer be using. They cannot be removed as legacy
  27. * drivers use them, and removing them are API breaks.
  28. */
  29. #include <linux/list.h>
  30. #include <drm/drm_legacy.h>
  31. struct agp_memory;
  32. struct drm_device;
  33. struct drm_file;
  34. /*
  35. * Generic DRM Contexts
  36. */
  37. #define DRM_KERNEL_CONTEXT 0
  38. #define DRM_RESERVED_CONTEXTS 1
  39. void drm_legacy_ctxbitmap_init(struct drm_device *dev);
  40. void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev);
  41. void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
  42. void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file);
  43. int drm_legacy_resctx(struct drm_device *d, void *v, struct drm_file *f);
  44. int drm_legacy_addctx(struct drm_device *d, void *v, struct drm_file *f);
  45. int drm_legacy_getctx(struct drm_device *d, void *v, struct drm_file *f);
  46. int drm_legacy_switchctx(struct drm_device *d, void *v, struct drm_file *f);
  47. int drm_legacy_newctx(struct drm_device *d, void *v, struct drm_file *f);
  48. int drm_legacy_rmctx(struct drm_device *d, void *v, struct drm_file *f);
  49. int drm_legacy_setsareactx(struct drm_device *d, void *v, struct drm_file *f);
  50. int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
  51. /*
  52. * Generic Buffer Management
  53. */
  54. #define DRM_MAP_HASH_OFFSET 0x10000000
  55. int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
  56. struct drm_file *file_priv);
  57. int drm_legacy_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
  58. int drm_legacy_rmmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
  59. int drm_legacy_addbufs(struct drm_device *d, void *v, struct drm_file *f);
  60. int drm_legacy_infobufs(struct drm_device *d, void *v, struct drm_file *f);
  61. int drm_legacy_markbufs(struct drm_device *d, void *v, struct drm_file *f);
  62. int drm_legacy_freebufs(struct drm_device *d, void *v, struct drm_file *f);
  63. int drm_legacy_mapbufs(struct drm_device *d, void *v, struct drm_file *f);
  64. int drm_legacy_dma_ioctl(struct drm_device *d, void *v, struct drm_file *f);
  65. int __drm_legacy_infobufs(struct drm_device *, void *, int *,
  66. int (*)(void *, int, struct drm_buf_entry *));
  67. int __drm_legacy_mapbufs(struct drm_device *, void *, int *,
  68. void __user **,
  69. int (*)(void *, int, unsigned long, struct drm_buf *),
  70. struct drm_file *);
  71. #ifdef CONFIG_DRM_VM
  72. void drm_legacy_vma_flush(struct drm_device *d);
  73. #else
  74. static inline void drm_legacy_vma_flush(struct drm_device *d)
  75. {
  76. /* do nothing */
  77. }
  78. #endif
  79. /*
  80. * AGP Support
  81. */
  82. struct drm_agp_mem {
  83. unsigned long handle;
  84. struct agp_memory *memory;
  85. unsigned long bound;
  86. int pages;
  87. struct list_head head;
  88. };
  89. /* drm_lock.c */
  90. int drm_legacy_lock(struct drm_device *d, void *v, struct drm_file *f);
  91. int drm_legacy_unlock(struct drm_device *d, void *v, struct drm_file *f);
  92. void drm_legacy_lock_release(struct drm_device *dev, struct file *filp);
  93. /* DMA support */
  94. int drm_legacy_dma_setup(struct drm_device *dev);
  95. void drm_legacy_dma_takedown(struct drm_device *dev);
  96. void drm_legacy_free_buffer(struct drm_device *dev,
  97. struct drm_buf * buf);
  98. void drm_legacy_reclaim_buffers(struct drm_device *dev,
  99. struct drm_file *filp);
  100. /* Scatter Gather Support */
  101. void drm_legacy_sg_cleanup(struct drm_device *dev);
  102. int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
  103. struct drm_file *file_priv);
  104. int drm_legacy_sg_free(struct drm_device *dev, void *data,
  105. struct drm_file *file_priv);
  106. #endif /* __DRM_LEGACY_H__ */