nouveau_drm.h 3.3 KB

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