1 #ifndef __NOUVEAU_DISPLAY_H__
2 #define __NOUVEAU_DISPLAY_H__
4 #include <subdev/mmu.h>
6 #include "nouveau_drv.h"
8 struct nouveau_framebuffer {
9 struct drm_framebuffer base;
10 struct nouveau_bo *nvbo;
15 struct nvif_object h_base[4];
16 struct nvif_object h_core;
19 static inline struct nouveau_framebuffer *
20 nouveau_framebuffer(struct drm_framebuffer *fb)
22 return container_of(fb, struct nouveau_framebuffer, base);
25 int nouveau_framebuffer_new(struct drm_device *,
26 const struct drm_mode_fb_cmd2 *,
27 struct nouveau_bo *, struct nouveau_framebuffer **);
29 struct nouveau_page_flip_state {
30 struct list_head head;
31 struct drm_pending_vblank_event *event;
32 struct drm_crtc *crtc;
37 struct nouveau_display {
39 void (*dtor)(struct drm_device *);
40 int (*init)(struct drm_device *);
41 void (*fini)(struct drm_device *);
43 struct nvif_object disp;
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;
54 struct drm_atomic_state *suspend;
57 static inline struct nouveau_display *
58 nouveau_display(struct drm_device *dev)
60 return nouveau_drm(dev)->display;
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 int nouveau_display_scanoutpos(struct drm_device *, unsigned int,
72 unsigned int, int *, int *, ktime_t *,
73 ktime_t *, const struct drm_display_mode *);
74 int nouveau_display_vblstamp(struct drm_device *, unsigned int, int *,
75 struct timeval *, unsigned);
77 int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
78 struct drm_pending_vblank_event *event,
79 uint32_t page_flip_flags);
80 int nouveau_finish_page_flip(struct nouveau_channel *,
81 struct nouveau_page_flip_state *);
83 int nouveau_display_dumb_create(struct drm_file *, struct drm_device *,
84 struct drm_mode_create_dumb *args);
85 int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *,
86 u32 handle, u64 *offset);
88 void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
90 int nouveau_crtc_set_config(struct drm_mode_set *set);
91 #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
92 extern int nouveau_backlight_init(struct drm_device *);
93 extern void nouveau_backlight_exit(struct drm_device *);
94 extern void nouveau_backlight_ctor(void);
95 extern void nouveau_backlight_dtor(void);
98 nouveau_backlight_init(struct drm_device *dev)
104 nouveau_backlight_exit(struct drm_device *dev) {
108 nouveau_backlight_ctor(void) {
112 nouveau_backlight_dtor(void) {
116 struct drm_framebuffer *
117 nouveau_user_framebuffer_create(struct drm_device *, struct drm_file *,
118 const struct drm_mode_fb_cmd2 *);