nouveau_display.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #ifndef __NOUVEAU_DISPLAY_H__
  2. #define __NOUVEAU_DISPLAY_H__
  3. #include <subdev/mmu.h>
  4. #include "nouveau_drv.h"
  5. struct nouveau_framebuffer {
  6. struct drm_framebuffer base;
  7. struct nouveau_bo *nvbo;
  8. struct nvkm_vma vma;
  9. u32 r_handle;
  10. u32 r_format;
  11. u32 r_pitch;
  12. struct nvif_object h_base[4];
  13. struct nvif_object h_core;
  14. };
  15. static inline struct nouveau_framebuffer *
  16. nouveau_framebuffer(struct drm_framebuffer *fb)
  17. {
  18. return container_of(fb, struct nouveau_framebuffer, base);
  19. }
  20. int nouveau_framebuffer_new(struct drm_device *,
  21. const struct drm_mode_fb_cmd2 *,
  22. struct nouveau_bo *, struct nouveau_framebuffer **);
  23. struct nouveau_page_flip_state {
  24. struct list_head head;
  25. struct drm_pending_vblank_event *event;
  26. struct drm_crtc *crtc;
  27. int bpp, pitch;
  28. u64 offset;
  29. };
  30. struct nouveau_display {
  31. void *priv;
  32. void (*dtor)(struct drm_device *);
  33. int (*init)(struct drm_device *);
  34. void (*fini)(struct drm_device *);
  35. struct nvif_object disp;
  36. struct drm_property *dithering_mode;
  37. struct drm_property *dithering_depth;
  38. struct drm_property *underscan_property;
  39. struct drm_property *underscan_hborder_property;
  40. struct drm_property *underscan_vborder_property;
  41. /* not really hue and saturation: */
  42. struct drm_property *vibrant_hue_property;
  43. struct drm_property *color_vibrance_property;
  44. struct drm_atomic_state *suspend;
  45. };
  46. static inline struct nouveau_display *
  47. nouveau_display(struct drm_device *dev)
  48. {
  49. return nouveau_drm(dev)->display;
  50. }
  51. int nouveau_display_create(struct drm_device *dev);
  52. void nouveau_display_destroy(struct drm_device *dev);
  53. int nouveau_display_init(struct drm_device *dev);
  54. void nouveau_display_fini(struct drm_device *dev, bool suspend);
  55. int nouveau_display_suspend(struct drm_device *dev, bool runtime);
  56. void nouveau_display_resume(struct drm_device *dev, bool runtime);
  57. int nouveau_display_vblank_enable(struct drm_device *, unsigned int);
  58. void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
  59. int nouveau_display_scanoutpos(struct drm_device *, unsigned int,
  60. unsigned int, int *, int *, ktime_t *,
  61. ktime_t *, const struct drm_display_mode *);
  62. int nouveau_display_vblstamp(struct drm_device *, unsigned int, int *,
  63. struct timeval *, unsigned);
  64. int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
  65. struct drm_pending_vblank_event *event,
  66. uint32_t page_flip_flags);
  67. int nouveau_finish_page_flip(struct nouveau_channel *,
  68. struct nouveau_page_flip_state *);
  69. int nouveau_display_dumb_create(struct drm_file *, struct drm_device *,
  70. struct drm_mode_create_dumb *args);
  71. int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *,
  72. u32 handle, u64 *offset);
  73. void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
  74. int nouveau_crtc_set_config(struct drm_mode_set *set);
  75. #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
  76. extern int nouveau_backlight_init(struct drm_device *);
  77. extern void nouveau_backlight_exit(struct drm_device *);
  78. extern void nouveau_backlight_ctor(void);
  79. extern void nouveau_backlight_dtor(void);
  80. #else
  81. static inline int
  82. nouveau_backlight_init(struct drm_device *dev)
  83. {
  84. return 0;
  85. }
  86. static inline void
  87. nouveau_backlight_exit(struct drm_device *dev) {
  88. }
  89. static inline void
  90. nouveau_backlight_ctor(void) {
  91. }
  92. static inline void
  93. nouveau_backlight_dtor(void) {
  94. }
  95. #endif
  96. struct drm_framebuffer *
  97. nouveau_user_framebuffer_create(struct drm_device *, struct drm_file *,
  98. const struct drm_mode_fb_cmd2 *);
  99. #endif