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