nouveau_drm.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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_CONTROL = 0xdddddddc,
  44. NVDRM_PUSH = 0xbbbb0000, /* |= client chid */
  45. NVDRM_CHAN = 0xcccc0000, /* |= client chid */
  46. };
  47. struct nouveau_cli {
  48. struct nouveau_client base;
  49. struct list_head head;
  50. struct mutex mutex;
  51. void *abi16;
  52. };
  53. static inline struct nouveau_cli *
  54. nouveau_cli(struct drm_file *fpriv)
  55. {
  56. return fpriv ? fpriv->driver_priv : NULL;
  57. }
  58. extern int nouveau_runtime_pm;
  59. struct nouveau_drm {
  60. struct nouveau_cli client;
  61. struct drm_device *dev;
  62. struct nouveau_object *device;
  63. struct list_head clients;
  64. struct {
  65. enum {
  66. UNKNOWN = 0,
  67. DISABLE = 1,
  68. ENABLED = 2
  69. } stat;
  70. u32 base;
  71. u32 size;
  72. } agp;
  73. /* TTM interface support */
  74. struct {
  75. struct drm_global_reference mem_global_ref;
  76. struct ttm_bo_global_ref bo_global_ref;
  77. struct ttm_bo_device bdev;
  78. atomic_t validate_sequence;
  79. int (*move)(struct nouveau_channel *,
  80. struct ttm_buffer_object *,
  81. struct ttm_mem_reg *, struct ttm_mem_reg *);
  82. struct nouveau_channel *chan;
  83. int mtrr;
  84. } ttm;
  85. /* GEM interface support */
  86. struct {
  87. u64 vram_available;
  88. u64 gart_available;
  89. } gem;
  90. /* synchronisation */
  91. void *fence;
  92. /* context for accelerated drm-internal operations */
  93. struct nouveau_channel *cechan;
  94. struct nouveau_channel *channel;
  95. struct nouveau_gpuobj *notify;
  96. struct nouveau_fbdev *fbcon;
  97. /* nv10-nv40 tiling regions */
  98. struct {
  99. struct nouveau_drm_tile reg[15];
  100. spinlock_t lock;
  101. } tile;
  102. /* modesetting */
  103. struct nvbios vbios;
  104. struct nouveau_display *display;
  105. struct backlight_device *backlight;
  106. /* power management */
  107. struct nouveau_hwmon *hwmon;
  108. struct nouveau_sysfs *sysfs;
  109. /* display power reference */
  110. bool have_disp_power_ref;
  111. struct dev_pm_domain vga_pm_domain;
  112. struct pci_dev *hdmi_device;
  113. };
  114. static inline struct nouveau_drm *
  115. nouveau_drm(struct drm_device *dev)
  116. {
  117. return dev->dev_private;
  118. }
  119. static inline struct nouveau_device *
  120. nouveau_dev(struct drm_device *dev)
  121. {
  122. return nv_device(nouveau_drm(dev)->device);
  123. }
  124. int nouveau_pmops_suspend(struct device *);
  125. int nouveau_pmops_resume(struct device *);
  126. #define NV_FATAL(cli, fmt, args...) nv_fatal((cli), fmt, ##args)
  127. #define NV_ERROR(cli, fmt, args...) nv_error((cli), fmt, ##args)
  128. #define NV_WARN(cli, fmt, args...) nv_warn((cli), fmt, ##args)
  129. #define NV_INFO(cli, fmt, args...) nv_info((cli), fmt, ##args)
  130. #define NV_DEBUG(cli, fmt, args...) do { \
  131. if (drm_debug & DRM_UT_DRIVER) \
  132. nv_info((cli), fmt, ##args); \
  133. } while (0)
  134. extern int nouveau_modeset;
  135. #endif