]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/gpu/drm/nouveau/nouveau_display.h
Merge tag 'edac_for_4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp
[karo-tx-linux.git] / drivers / gpu / drm / nouveau / nouveau_display.h
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 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);
76
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 *);
82
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);
87
88 void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
89
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);
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 }
106
107 static inline void
108 nouveau_backlight_ctor(void) {
109 }
110
111 static inline void
112 nouveau_backlight_dtor(void) {
113 }
114 #endif
115
116 struct drm_framebuffer *
117 nouveau_user_framebuffer_create(struct drm_device *, struct drm_file *,
118                                 const struct drm_mode_fb_cmd2 *);
119 #endif