nouveau_drm.h 3.8 KB

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