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