1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NOUVEAU_DISPLAY_H__
3 #define __NOUVEAU_DISPLAY_H__
5 #include "nouveau_drv.h"
9 #include <drm/drm_framebuffer.h>
11 struct nouveau_framebuffer
{
12 struct drm_framebuffer base
;
13 struct nouveau_bo
*nvbo
;
14 struct nouveau_vma
*vma
;
18 struct nvif_object h_base
[4];
19 struct nvif_object h_core
;
22 static inline struct nouveau_framebuffer
*
23 nouveau_framebuffer(struct drm_framebuffer
*fb
)
25 return container_of(fb
, struct nouveau_framebuffer
, base
);
28 int nouveau_framebuffer_new(struct drm_device
*,
29 const struct drm_mode_fb_cmd2
*,
30 struct nouveau_bo
*, struct nouveau_framebuffer
**);
32 struct nouveau_display
{
34 void (*dtor
)(struct drm_device
*);
35 int (*init
)(struct drm_device
*, bool resume
, bool runtime
);
36 void (*fini
)(struct drm_device
*, bool suspend
);
38 struct nvif_disp disp
;
40 struct drm_property
*dithering_mode
;
41 struct drm_property
*dithering_depth
;
42 struct drm_property
*underscan_property
;
43 struct drm_property
*underscan_hborder_property
;
44 struct drm_property
*underscan_vborder_property
;
45 /* not really hue and saturation: */
46 struct drm_property
*vibrant_hue_property
;
47 struct drm_property
*color_vibrance_property
;
49 struct drm_atomic_state
*suspend
;
52 static inline struct nouveau_display
*
53 nouveau_display(struct drm_device
*dev
)
55 return nouveau_drm(dev
)->display
;
58 int nouveau_display_create(struct drm_device
*dev
);
59 void nouveau_display_destroy(struct drm_device
*dev
);
60 int nouveau_display_init(struct drm_device
*dev
, bool resume
, bool runtime
);
61 void nouveau_display_fini(struct drm_device
*dev
, bool suspend
, bool runtime
);
62 int nouveau_display_suspend(struct drm_device
*dev
, bool runtime
);
63 void nouveau_display_resume(struct drm_device
*dev
, bool runtime
);
64 int nouveau_display_vblank_enable(struct drm_device
*, unsigned int);
65 void nouveau_display_vblank_disable(struct drm_device
*, unsigned int);
66 bool nouveau_display_scanoutpos(struct drm_device
*, unsigned int,
67 bool, int *, int *, ktime_t
*,
68 ktime_t
*, const struct drm_display_mode
*);
70 int nouveau_display_dumb_create(struct drm_file
*, struct drm_device
*,
71 struct drm_mode_create_dumb
*args
);
72 int nouveau_display_dumb_map_offset(struct drm_file
*, struct drm_device
*,
73 u32 handle
, u64
*offset
);
75 void nouveau_hdmi_mode_set(struct drm_encoder
*, struct drm_display_mode
*);
77 struct drm_framebuffer
*
78 nouveau_user_framebuffer_create(struct drm_device
*, struct drm_file
*,
79 const struct drm_mode_fb_cmd2
*);