nouveau_display.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #ifndef __NOUVEAU_DISPLAY_H__
  2. #define __NOUVEAU_DISPLAY_H__
  3. #include <subdev/mmu.h>
  4. #include "nouveau_drm.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_init(struct drm_device *, struct nouveau_framebuffer *,
  21. struct drm_mode_fb_cmd2 *, struct nouveau_bo *);
  22. struct nouveau_page_flip_state {
  23. struct list_head head;
  24. struct drm_pending_vblank_event *event;
  25. int crtc, bpp, pitch, x, y;
  26. u64 offset;
  27. };
  28. struct nouveau_display {
  29. void *priv;
  30. void (*dtor)(struct drm_device *);
  31. int (*init)(struct drm_device *);
  32. void (*fini)(struct drm_device *);
  33. int (*fb_ctor)(struct drm_framebuffer *);
  34. void (*fb_dtor)(struct drm_framebuffer *);
  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. };
  45. static inline struct nouveau_display *
  46. nouveau_display(struct drm_device *dev)
  47. {
  48. return nouveau_drm(dev)->display;
  49. }
  50. int nouveau_display_create(struct drm_device *dev);
  51. void nouveau_display_destroy(struct drm_device *dev);
  52. int nouveau_display_init(struct drm_device *dev);
  53. void nouveau_display_fini(struct drm_device *dev);
  54. int nouveau_display_suspend(struct drm_device *dev, bool runtime);
  55. void nouveau_display_resume(struct drm_device *dev, bool runtime);
  56. int nouveau_display_vblank_enable(struct drm_device *, unsigned int);
  57. void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
  58. int nouveau_display_scanoutpos(struct drm_device *, unsigned int,
  59. unsigned int, int *, int *, ktime_t *,
  60. ktime_t *, const struct drm_display_mode *);
  61. int nouveau_display_vblstamp(struct drm_device *, unsigned int, int *,
  62. struct timeval *, unsigned);
  63. int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
  64. struct drm_pending_vblank_event *event,
  65. uint32_t page_flip_flags);
  66. int nouveau_finish_page_flip(struct nouveau_channel *,
  67. struct nouveau_page_flip_state *);
  68. int nouveau_display_dumb_create(struct drm_file *, struct drm_device *,
  69. struct drm_mode_create_dumb *args);
  70. int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *,
  71. u32 handle, u64 *offset);
  72. void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
  73. int nouveau_crtc_set_config(struct drm_mode_set *set);
  74. #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
  75. extern int nouveau_backlight_init(struct drm_device *);
  76. extern void nouveau_backlight_exit(struct drm_device *);
  77. #else
  78. static inline int
  79. nouveau_backlight_init(struct drm_device *dev)
  80. {
  81. return 0;
  82. }
  83. static inline void
  84. nouveau_backlight_exit(struct drm_device *dev) {
  85. }
  86. #endif
  87. #endif