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