1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __NOUVEAU_DISPLAY_H__
3 #define __NOUVEAU_DISPLAY_H__
4 #include "nouveau_drv.h"
6 struct nouveau_framebuffer
{
7 struct drm_framebuffer base
;
8 struct nouveau_bo
*nvbo
;
9 struct nouveau_vma
*vma
;
13 struct nvif_object h_base
[4];
14 struct nvif_object h_core
;
17 static inline struct nouveau_framebuffer
*
18 nouveau_framebuffer(struct drm_framebuffer
*fb
)
20 return container_of(fb
, struct nouveau_framebuffer
, base
);
23 int nouveau_framebuffer_new(struct drm_device
*,
24 const struct drm_mode_fb_cmd2
*,
25 struct nouveau_bo
*, struct nouveau_framebuffer
**);
27 struct nouveau_page_flip_state
{
28 struct list_head head
;
29 struct drm_pending_vblank_event
*event
;
30 struct drm_crtc
*crtc
;
35 struct nouveau_display
{
37 void (*dtor
)(struct drm_device
*);
38 int (*init
)(struct drm_device
*);
39 void (*fini
)(struct drm_device
*);
41 struct nvif_object disp
;
43 struct drm_property
*dithering_mode
;
44 struct drm_property
*dithering_depth
;
45 struct drm_property
*underscan_property
;
46 struct drm_property
*underscan_hborder_property
;
47 struct drm_property
*underscan_vborder_property
;
48 /* not really hue and saturation: */
49 struct drm_property
*vibrant_hue_property
;
50 struct drm_property
*color_vibrance_property
;
52 struct drm_atomic_state
*suspend
;
55 static inline struct nouveau_display
*
56 nouveau_display(struct drm_device
*dev
)
58 return nouveau_drm(dev
)->display
;
61 int nouveau_display_create(struct drm_device
*dev
);
62 void nouveau_display_destroy(struct drm_device
*dev
);
63 int nouveau_display_init(struct drm_device
*dev
);
64 void nouveau_display_fini(struct drm_device
*dev
, bool suspend
);
65 int nouveau_display_suspend(struct drm_device
*dev
, bool runtime
);
66 void nouveau_display_resume(struct drm_device
*dev
, bool runtime
);
67 int nouveau_display_vblank_enable(struct drm_device
*, unsigned int);
68 void nouveau_display_vblank_disable(struct drm_device
*, unsigned int);
69 bool nouveau_display_scanoutpos(struct drm_device
*, unsigned int,
70 bool, int *, int *, ktime_t
*,
71 ktime_t
*, const struct drm_display_mode
*);
73 int nouveau_crtc_page_flip(struct drm_crtc
*crtc
, struct drm_framebuffer
*fb
,
74 struct drm_pending_vblank_event
*event
,
75 uint32_t page_flip_flags
,
76 struct drm_modeset_acquire_ctx
*ctx
);
77 int nouveau_finish_page_flip(struct nouveau_channel
*,
78 struct nouveau_page_flip_state
*);
80 int nouveau_display_dumb_create(struct drm_file
*, struct drm_device
*,
81 struct drm_mode_create_dumb
*args
);
82 int nouveau_display_dumb_map_offset(struct drm_file
*, struct drm_device
*,
83 u32 handle
, u64
*offset
);
85 void nouveau_hdmi_mode_set(struct drm_encoder
*, struct drm_display_mode
*);
87 #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
88 extern int nouveau_backlight_init(struct drm_device
*);
89 extern void nouveau_backlight_exit(struct drm_device
*);
90 extern void nouveau_backlight_ctor(void);
91 extern void nouveau_backlight_dtor(void);
94 nouveau_backlight_init(struct drm_device
*dev
)
100 nouveau_backlight_exit(struct drm_device
*dev
) {
104 nouveau_backlight_ctor(void) {
108 nouveau_backlight_dtor(void) {
112 struct drm_framebuffer
*
113 nouveau_user_framebuffer_create(struct drm_device
*, struct drm_file
*,
114 const struct drm_mode_fb_cmd2
*);