]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/gpu/drm/nouveau/nouveau_display.h
drm: Add acquire ctx parameter to ->set_config
[mirror_ubuntu-artful-kernel.git] / drivers / gpu / drm / nouveau / nouveau_display.h
CommitLineData
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
8struct 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
19static inline struct nouveau_framebuffer *
20nouveau_framebuffer(struct drm_framebuffer *fb)
21{
22 return container_of(fb, struct nouveau_framebuffer, base);
23}
24
1608a0fb
BS
25int nouveau_framebuffer_new(struct drm_device *,
26 const struct drm_mode_fb_cmd2 *,
27 struct nouveau_bo *, struct nouveau_framebuffer **);
77145f1c
BS
28
29struct 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
37struct 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
57static inline struct nouveau_display *
58nouveau_display(struct drm_device *dev)
59{
60 return nouveau_drm(dev)->display;
61}
62
63int nouveau_display_create(struct drm_device *dev);
64void nouveau_display_destroy(struct drm_device *dev);
65int nouveau_display_init(struct drm_device *dev);
3b4c0abb 66void nouveau_display_fini(struct drm_device *dev, bool suspend);
6fbb702e
BS
67int nouveau_display_suspend(struct drm_device *dev, bool runtime);
68void nouveau_display_resume(struct drm_device *dev, bool runtime);
88e72717
TR
69int nouveau_display_vblank_enable(struct drm_device *, unsigned int);
70void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
71int nouveau_display_scanoutpos(struct drm_device *, unsigned int,
72 unsigned int, int *, int *, ktime_t *,
73 ktime_t *, const struct drm_display_mode *);
74int nouveau_display_vblstamp(struct drm_device *, unsigned int, int *,
d83ef853 75 struct timeval *, unsigned);
77145f1c 76
77145f1c 77int 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
81int nouveau_finish_page_flip(struct nouveau_channel *,
82 struct nouveau_page_flip_state *);
83
84int nouveau_display_dumb_create(struct drm_file *, struct drm_device *,
85 struct drm_mode_create_dumb *args);
86int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *,
87 u32 handle, u64 *offset);
77145f1c
BS
88
89void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
90
91#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
92extern int nouveau_backlight_init(struct drm_device *);
93extern void nouveau_backlight_exit(struct drm_device *);
db1a0ae2
PM
94extern void nouveau_backlight_ctor(void);
95extern void nouveau_backlight_dtor(void);
77145f1c
BS
96#else
97static inline int
98nouveau_backlight_init(struct drm_device *dev)
99{
100 return 0;
101}
102
103static inline void
104nouveau_backlight_exit(struct drm_device *dev) {
105}
db1a0ae2
PM
106
107static inline void
108nouveau_backlight_ctor(void) {
109}
110
111static inline void
112nouveau_backlight_dtor(void) {
113}
77145f1c
BS
114#endif
115
839ca903
BS
116struct drm_framebuffer *
117nouveau_user_framebuffer_create(struct drm_device *, struct drm_file *,
118 const struct drm_mode_fb_cmd2 *);
77145f1c 119#endif