1 /* SPDX-License-Identifier: MIT */ 2 #ifndef __NOUVEAU_DISPLAY_H__ 3 #define __NOUVEAU_DISPLAY_H__ 4 5 #include "nouveau_drv.h" 6 7 #include <nvif/disp.h> 8 9 #include <drm/drm_framebuffer.h> 10 11 struct drm_format_info; 12 13 int 14 nouveau_framebuffer_new(struct drm_device *dev, 15 const struct drm_format_info *info, 16 const struct drm_mode_fb_cmd2 *mode_cmd, 17 struct drm_gem_object *gem, 18 struct drm_framebuffer **pfb); 19 20 struct nouveau_display { 21 void *priv; 22 void (*dtor)(struct drm_device *); 23 int (*init)(struct drm_device *, bool resume, bool runtime); 24 void (*fini)(struct drm_device *, bool suspend, bool runtime); 25 26 struct nvif_disp disp; 27 28 struct drm_property *dithering_mode; 29 struct drm_property *dithering_depth; 30 struct drm_property *underscan_property; 31 struct drm_property *underscan_hborder_property; 32 struct drm_property *underscan_vborder_property; 33 /* not really hue and saturation: */ 34 struct drm_property *vibrant_hue_property; 35 struct drm_property *color_vibrance_property; 36 37 struct drm_atomic_state *suspend; 38 39 const u64 *format_modifiers; 40 }; 41 42 static inline struct nouveau_display * 43 nouveau_display(struct drm_device *dev) 44 { 45 return nouveau_drm(dev)->display; 46 } 47 48 int nouveau_display_create(struct drm_device *dev); 49 void nouveau_display_destroy(struct drm_device *dev); 50 int nouveau_display_init(struct drm_device *dev, bool resume, bool runtime); 51 void nouveau_display_hpd_resume(struct nouveau_drm *); 52 void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime); 53 int nouveau_display_suspend(struct drm_device *dev, bool runtime); 54 void nouveau_display_resume(struct drm_device *dev, bool runtime); 55 int nouveau_display_vblank_enable(struct drm_crtc *crtc); 56 void nouveau_display_vblank_disable(struct drm_crtc *crtc); 57 bool nouveau_display_scanoutpos(struct drm_crtc *crtc, 58 bool in_vblank_irq, int *vpos, int *hpos, 59 ktime_t *stime, ktime_t *etime, 60 const struct drm_display_mode *mode); 61 62 int nouveau_display_dumb_create(struct drm_file *, struct drm_device *, 63 struct drm_mode_create_dumb *args); 64 65 void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *); 66 67 void 68 nouveau_framebuffer_get_layout(struct drm_framebuffer *fb, uint32_t *tile_mode, 69 uint8_t *kind); 70 71 struct drm_framebuffer * 72 nouveau_user_framebuffer_create(struct drm_device *, struct drm_file *, 73 const struct drm_format_info *, 74 const struct drm_mode_fb_cmd2 *); 75 #endif 76