nouveau_drm.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #ifndef __NOUVEAU_DRMCLI_H__
  2. #define __NOUVEAU_DRMCLI_H__
  3. #define DRIVER_AUTHOR "Nouveau Project"
  4. #define DRIVER_EMAIL "nouveau@lists.freedesktop.org"
  5. #define DRIVER_NAME "nouveau"
  6. #define DRIVER_DESC "nVidia Riva/TNT/GeForce/Quadro/Tesla"
  7. #define DRIVER_DATE "20120801"
  8. #define DRIVER_MAJOR 1
  9. #define DRIVER_MINOR 1
  10. #define DRIVER_PATCHLEVEL 0
  11. #include <core/client.h>
  12. #include <subdev/vm.h>
  13. #include <drmP.h>
  14. #include <drm/nouveau_drm.h>
  15. #include <drm/ttm/ttm_bo_api.h>
  16. #include <drm/ttm/ttm_bo_driver.h>
  17. #include <drm/ttm/ttm_placement.h>
  18. #include <drm/ttm/ttm_memory.h>
  19. #include <drm/ttm/ttm_module.h>
  20. #include <drm/ttm/ttm_page_alloc.h>
  21. struct nouveau_channel;
  22. #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
  23. #include "nouveau_fence.h"
  24. #include "nouveau_bios.h"
  25. struct nouveau_drm_tile {
  26. struct nouveau_fence *fence;
  27. bool used;
  28. };
  29. enum nouveau_drm_handle {
  30. NVDRM_CLIENT = 0xffffffff,
  31. NVDRM_DEVICE = 0xdddddddd,
  32. NVDRM_PUSH = 0xbbbb0000, /* |= client chid */
  33. NVDRM_CHAN = 0xcccc0000, /* |= client chid */
  34. };
  35. struct nouveau_cli {
  36. struct nouveau_client base;
  37. struct list_head head;
  38. struct mutex mutex;
  39. void *abi16;
  40. };
  41. static inline struct nouveau_cli *
  42. nouveau_cli(struct drm_file *fpriv)
  43. {
  44. return fpriv ? fpriv->driver_priv : NULL;
  45. }
  46. struct nouveau_drm {
  47. struct nouveau_cli client;
  48. struct drm_device *dev;
  49. struct nouveau_object *device;
  50. struct list_head clients;
  51. struct {
  52. enum {
  53. UNKNOWN = 0,
  54. DISABLE = 1,
  55. ENABLED = 2
  56. } stat;
  57. u32 base;
  58. u32 size;
  59. } agp;
  60. /* TTM interface support */
  61. struct {
  62. struct drm_global_reference mem_global_ref;
  63. struct ttm_bo_global_ref bo_global_ref;
  64. struct ttm_bo_device bdev;
  65. atomic_t validate_sequence;
  66. int (*move)(struct nouveau_channel *,
  67. struct ttm_buffer_object *,
  68. struct ttm_mem_reg *, struct ttm_mem_reg *);
  69. int mtrr;
  70. } ttm;
  71. /* GEM interface support */
  72. struct {
  73. u64 vram_available;
  74. u64 gart_available;
  75. } gem;
  76. /* synchronisation */
  77. void *fence;
  78. /* context for accelerated drm-internal operations */
  79. struct nouveau_channel *cechan;
  80. struct nouveau_channel *channel;
  81. struct nouveau_gpuobj *notify;
  82. struct nouveau_fbdev *fbcon;
  83. /* nv10-nv40 tiling regions */
  84. struct {
  85. struct nouveau_drm_tile reg[15];
  86. spinlock_t lock;
  87. } tile;
  88. /* modesetting */
  89. struct nvbios vbios;
  90. struct nouveau_display *display;
  91. struct backlight_device *backlight;
  92. /* power management */
  93. struct nouveau_pm *pm;
  94. };
  95. static inline struct nouveau_drm *
  96. nouveau_drm(struct drm_device *dev)
  97. {
  98. return dev->dev_private;
  99. }
  100. static inline struct nouveau_device *
  101. nouveau_dev(struct drm_device *dev)
  102. {
  103. return nv_device(nouveau_drm(dev)->device);
  104. }
  105. int nouveau_pmops_suspend(struct device *);
  106. int nouveau_pmops_resume(struct device *);
  107. #define NV_FATAL(cli, fmt, args...) nv_fatal((cli), fmt, ##args)
  108. #define NV_ERROR(cli, fmt, args...) nv_error((cli), fmt, ##args)
  109. #define NV_WARN(cli, fmt, args...) nv_warn((cli), fmt, ##args)
  110. #define NV_INFO(cli, fmt, args...) nv_info((cli), fmt, ##args)
  111. #define NV_DEBUG(cli, fmt, args...) do { \
  112. if (drm_debug & DRM_UT_DRIVER) \
  113. nv_info((cli), fmt, ##args); \
  114. } while (0)
  115. extern int nouveau_modeset;
  116. #endif