]>
Commit | Line | Data |
---|---|---|
77145f1c BS |
1 | #ifndef __NOUVEAU_DISPLAY_H__ |
2 | #define __NOUVEAU_DISPLAY_H__ | |
3 | ||
5ce3bf3c | 4 | #include <subdev/mmu.h> |
77145f1c | 5 | |
4dc28134 | 6 | #include "nouveau_drv.h" |
77145f1c BS |
7 | |
8 | struct nouveau_framebuffer { | |
9 | struct drm_framebuffer base; | |
10 | struct nouveau_bo *nvbo; | |
be83cd4e | 11 | struct nvkm_vma vma; |
8a423647 | 12 | u32 r_handle; |
77145f1c BS |
13 | u32 r_format; |
14 | u32 r_pitch; | |
0ad72863 BS |
15 | struct nvif_object h_base[4]; |
16 | struct nvif_object h_core; | |
77145f1c BS |
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 | ||
1608a0fb BS |
25 | int nouveau_framebuffer_new(struct drm_device *, |
26 | const struct drm_mode_fb_cmd2 *, | |
27 | struct nouveau_bo *, struct nouveau_framebuffer **); | |
77145f1c BS |
28 | |
29 | struct nouveau_page_flip_state { | |
30 | struct list_head head; | |
31 | struct drm_pending_vblank_event *event; | |
dc4ff116 GP |
32 | struct drm_crtc *crtc; |
33 | int bpp, pitch; | |
77145f1c BS |
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 | ||
0ad72863 | 43 | struct nvif_object disp; |
ab0af559 | 44 | |
77145f1c BS |
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; | |
b167db0e BS |
53 | |
54 | struct drm_atomic_state *suspend; | |
77145f1c BS |
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); | |
3b4c0abb | 66 | void nouveau_display_fini(struct drm_device *dev, bool suspend); |
6fbb702e BS |
67 | int nouveau_display_suspend(struct drm_device *dev, bool runtime); |
68 | void nouveau_display_resume(struct drm_device *dev, bool runtime); | |
88e72717 TR |
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 *); | |
d673c02c DV |
74 | bool nouveau_display_vblstamp(struct drm_device *, unsigned int, int *, |
75 | struct timeval *, unsigned); | |
77145f1c | 76 | |
77145f1c | 77 | int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, |
ed8d1975 | 78 | struct drm_pending_vblank_event *event, |
41292b1f DV |
79 | uint32_t page_flip_flags, |
80 | struct drm_modeset_acquire_ctx *ctx); | |
77145f1c BS |
81 | int nouveau_finish_page_flip(struct nouveau_channel *, |
82 | struct nouveau_page_flip_state *); | |
83 | ||
84 | int nouveau_display_dumb_create(struct drm_file *, struct drm_device *, | |
85 | struct drm_mode_create_dumb *args); | |
86 | int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *, | |
87 | u32 handle, u64 *offset); | |
77145f1c BS |
88 | |
89 | void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *); | |
90 | ||
91 | #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT | |
92 | extern int nouveau_backlight_init(struct drm_device *); | |
93 | extern void nouveau_backlight_exit(struct drm_device *); | |
db1a0ae2 PM |
94 | extern void nouveau_backlight_ctor(void); |
95 | extern void nouveau_backlight_dtor(void); | |
77145f1c BS |
96 | #else |
97 | static inline int | |
98 | nouveau_backlight_init(struct drm_device *dev) | |
99 | { | |
100 | return 0; | |
101 | } | |
102 | ||
103 | static inline void | |
104 | nouveau_backlight_exit(struct drm_device *dev) { | |
105 | } | |
db1a0ae2 PM |
106 | |
107 | static inline void | |
108 | nouveau_backlight_ctor(void) { | |
109 | } | |
110 | ||
111 | static inline void | |
112 | nouveau_backlight_dtor(void) { | |
113 | } | |
77145f1c BS |
114 | #endif |
115 | ||
839ca903 BS |
116 | struct drm_framebuffer * |
117 | nouveau_user_framebuffer_create(struct drm_device *, struct drm_file *, | |
118 | const struct drm_mode_fb_cmd2 *); | |
77145f1c | 119 | #endif |