1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __NOUVEAU_DISPLAY_H__
3 #define __NOUVEAU_DISPLAY_H__
5 #include <subdev/mmu.h>
7 #include "nouveau_drv.h"
9 struct nouveau_framebuffer
{
10 struct drm_framebuffer base
;
11 struct nouveau_bo
*nvbo
;
16 struct nvif_object h_base
[4];
17 struct nvif_object h_core
;
20 static inline struct nouveau_framebuffer
*
21 nouveau_framebuffer(struct drm_framebuffer
*fb
)
23 return container_of(fb
, struct nouveau_framebuffer
, base
);
26 int nouveau_framebuffer_new(struct drm_device
*,
27 const struct drm_mode_fb_cmd2
*,
28 struct nouveau_bo
*, struct nouveau_framebuffer
**);
30 struct nouveau_page_flip_state
{
31 struct list_head head
;
32 struct drm_pending_vblank_event
*event
;
33 struct drm_crtc
*crtc
;
38 struct nouveau_display
{
40 void (*dtor
)(struct drm_device
*);
41 int (*init
)(struct drm_device
*);
42 void (*fini
)(struct drm_device
*);
44 struct nvif_object disp
;
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
;
55 struct drm_atomic_state
*suspend
;
58 static inline struct nouveau_display
*
59 nouveau_display(struct drm_device
*dev
)
61 return nouveau_drm(dev
)->display
;
64 int nouveau_display_create(struct drm_device
*dev
);
65 void nouveau_display_destroy(struct drm_device
*dev
);
66 int nouveau_display_init(struct drm_device
*dev
);
67 void nouveau_display_fini(struct drm_device
*dev
, bool suspend
, bool runtime
);
68 int nouveau_display_suspend(struct drm_device
*dev
, bool runtime
);
69 void nouveau_display_resume(struct drm_device
*dev
, bool runtime
);
70 int nouveau_display_vblank_enable(struct drm_device
*, unsigned int);
71 void nouveau_display_vblank_disable(struct drm_device
*, unsigned int);
72 bool nouveau_display_scanoutpos(struct drm_device
*, unsigned int,
73 bool, int *, int *, ktime_t
*,
74 ktime_t
*, const struct drm_display_mode
*);
76 int 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
);
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 #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
91 extern int nouveau_backlight_init(struct drm_device
*);
92 extern void nouveau_backlight_exit(struct drm_device
*);
93 extern void nouveau_backlight_ctor(void);
94 extern void nouveau_backlight_dtor(void);
97 nouveau_backlight_init(struct drm_device
*dev
)
103 nouveau_backlight_exit(struct drm_device
*dev
) {
107 nouveau_backlight_ctor(void) {
111 nouveau_backlight_dtor(void) {
115 struct drm_framebuffer
*
116 nouveau_user_framebuffer_create(struct drm_device
*, struct drm_file
*,
117 const struct drm_mode_fb_cmd2
*);