drm_legacy.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
  56. int drm_legacy_rmmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
  57. int drm_legacy_addbufs(struct drm_device *d, void *v, struct drm_file *f);
  58. int drm_legacy_infobufs(struct drm_device *d, void *v, struct drm_file *f);
  59. int drm_legacy_markbufs(struct drm_device *d, void *v, struct drm_file *f);
  60. int drm_legacy_freebufs(struct drm_device *d, void *v, struct drm_file *f);
  61. int drm_legacy_mapbufs(struct drm_device *d, void *v, struct drm_file *f);
  62. int drm_legacy_dma_ioctl(struct drm_device *d, void *v, struct drm_file *f);
  63. void drm_legacy_vma_flush(struct drm_device *d);
  64. /*
  65. * AGP Support
  66. */
  67. struct drm_agp_mem {
  68. unsigned long handle;
  69. struct agp_memory *memory;
  70. unsigned long bound;
  71. int pages;
  72. struct list_head head;
  73. };
  74. /*
  75. * Generic Userspace Locking-API
  76. */
  77. int drm_legacy_i_have_hw_lock(struct drm_device *d, struct drm_file *f);
  78. int drm_legacy_lock(struct drm_device *d, void *v, struct drm_file *f);
  79. int drm_legacy_unlock(struct drm_device *d, void *v, struct drm_file *f);
  80. int drm_legacy_lock_free(struct drm_lock_data *lock, unsigned int ctx);
  81. /* DMA support */
  82. int drm_legacy_dma_setup(struct drm_device *dev);
  83. void drm_legacy_dma_takedown(struct drm_device *dev);
  84. void drm_legacy_free_buffer(struct drm_device *dev,
  85. struct drm_buf * buf);
  86. void drm_legacy_reclaim_buffers(struct drm_device *dev,
  87. struct drm_file *filp);
  88. /* Scatter Gather Support */
  89. void drm_legacy_sg_cleanup(struct drm_device *dev);
  90. int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
  91. struct drm_file *file_priv);
  92. int drm_legacy_sg_free(struct drm_device *dev, void *data,
  93. struct drm_file *file_priv);
  94. #endif /* __DRM_LEGACY_H__ */