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_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. extern int nouveau_runtime_pm;
  58. struct nouveau_drm {
  59. struct nouveau_cli client;
  60. struct drm_device *dev;
  61. struct nouveau_object *device;
  62. struct list_head clients;
  63. struct {
  64. enum {
  65. UNKNOWN = 0,
  66. DISABLE = 1,
  67. ENABLED = 2
  68. } stat;
  69. u32 base;
  70. u32 size;
  71. } agp;
  72. /* TTM interface support */
  73. struct {
  74. struct drm_global_reference mem_global_ref;
  75. struct ttm_bo_global_ref bo_global_ref;
  76. struct ttm_bo_device bdev;
  77. atomic_t validate_sequence;
  78. int (*move)(struct nouveau_channel *,
  79. struct ttm_buffer_object *,
  80. struct ttm_mem_reg *, struct ttm_mem_reg *);
  81. struct nouveau_channel *chan;
  82. int mtrr;
  83. } ttm;
  84. /* GEM interface support */
  85. struct {
  86. u64 vram_available;
  87. u64 gart_available;
  88. } gem;
  89. /* synchronisation */
  90. void *fence;
  91. /* context for accelerated drm-internal operations */
  92. struct nouveau_channel *cechan;
  93. struct nouveau_channel *channel;
  94. struct nouveau_gpuobj *notify;
  95. struct nouveau_fbdev *fbcon;
  96. /* nv10-nv40 tiling regions */
  97. struct {
  98. struct nouveau_drm_tile reg[15];
  99. spinlock_t lock;
  100. } tile;
  101. /* modesetting */
  102. struct nvbios vbios;
  103. struct nouveau_display *display;
  104. struct backlight_device *backlight;
  105. struct nouveau_eventh vblank[4];
  106. /* power management */
  107. struct nouveau_pm *pm;
  108. /* display power reference */
  109. bool have_disp_power_ref;
  110. struct dev_pm_domain vga_pm_domain;
  111. struct pci_dev *hdmi_device;
  112. };
  113. static inline struct nouveau_drm *
  114. nouveau_drm(struct drm_device *dev)
  115. {
  116. return dev->dev_private;
  117. }
  118. static inline struct nouveau_device *
  119. nouveau_dev(struct drm_device *dev)
  120. {
  121. return nv_device(nouveau_drm(dev)->device);
  122. }
  123. int nouveau_pmops_suspend(struct device *);
  124. int nouveau_pmops_resume(struct device *);
  125. #define NV_SUSPEND(cli, fmt, args...) nv_suspend((cli), fmt, ##args)
  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