| 1 | #ifndef __NOUVEAU_DISPLAY_H__ |
| 2 | #define __NOUVEAU_DISPLAY_H__ |
| 3 | |
| 4 | #include <subdev/mmu.h> |
| 5 | |
| 6 | #include "nouveau_drm.h" |
| 7 | |
| 8 | struct nouveau_framebuffer { |
| 9 | struct drm_framebuffer base; |
| 10 | struct nouveau_bo *nvbo; |
| 11 | struct nvkm_vma vma; |
| 12 | u32 r_handle; |
| 13 | u32 r_format; |
| 14 | u32 r_pitch; |
| 15 | struct nvif_object h_base[4]; |
| 16 | struct nvif_object h_core; |
| 17 | }; |
| 18 | |
| 19 | static inline struct nouveau_framebuffer * |
| 20 | nouveau_framebuffer(struct drm_framebuffer *fb) |
| 21 | { |
| 22 | return container_of(fb, struct nouveau_framebuffer, base); |
| 23 | } |
| 24 | |
| 25 | int nouveau_framebuffer_init(struct drm_device *, struct nouveau_framebuffer *, |
| 26 | struct drm_mode_fb_cmd2 *, struct nouveau_bo *); |
| 27 | |
| 28 | struct nouveau_page_flip_state { |
| 29 | struct list_head head; |
| 30 | struct drm_pending_vblank_event *event; |
| 31 | int crtc, bpp, pitch, x, y; |
| 32 | u64 offset; |
| 33 | }; |
| 34 | |
| 35 | struct nouveau_display { |
| 36 | void *priv; |
| 37 | void (*dtor)(struct drm_device *); |
| 38 | int (*init)(struct drm_device *); |
| 39 | void (*fini)(struct drm_device *); |
| 40 | |
| 41 | int (*fb_ctor)(struct drm_framebuffer *); |
| 42 | void (*fb_dtor)(struct drm_framebuffer *); |
| 43 | |
| 44 | struct nvif_object disp; |
| 45 | |
| 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; |
| 54 | }; |
| 55 | |
| 56 | static inline struct nouveau_display * |
| 57 | nouveau_display(struct drm_device *dev) |
| 58 | { |
| 59 | return nouveau_drm(dev)->display; |
| 60 | } |
| 61 | |
| 62 | int nouveau_display_create(struct drm_device *dev); |
| 63 | void nouveau_display_destroy(struct drm_device *dev); |
| 64 | int nouveau_display_init(struct drm_device *dev); |
| 65 | void nouveau_display_fini(struct drm_device *dev); |
| 66 | int nouveau_display_suspend(struct drm_device *dev, bool runtime); |
| 67 | void nouveau_display_resume(struct drm_device *dev, bool runtime); |
| 68 | int nouveau_display_vblank_enable(struct drm_device *, unsigned int); |
| 69 | void nouveau_display_vblank_disable(struct drm_device *, unsigned int); |
| 70 | int nouveau_display_scanoutpos(struct drm_device *, unsigned int, |
| 71 | unsigned int, int *, int *, ktime_t *, |
| 72 | ktime_t *, const struct drm_display_mode *); |
| 73 | int nouveau_display_vblstamp(struct drm_device *, unsigned int, int *, |
| 74 | struct timeval *, unsigned); |
| 75 | |
| 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 | int nouveau_finish_page_flip(struct nouveau_channel *, |
| 80 | struct nouveau_page_flip_state *); |
| 81 | |
| 82 | int nouveau_display_dumb_create(struct drm_file *, struct drm_device *, |
| 83 | struct drm_mode_create_dumb *args); |
| 84 | int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *, |
| 85 | u32 handle, u64 *offset); |
| 86 | |
| 87 | void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *); |
| 88 | |
| 89 | int nouveau_crtc_set_config(struct drm_mode_set *set); |
| 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 | #else |
| 94 | static inline int |
| 95 | nouveau_backlight_init(struct drm_device *dev) |
| 96 | { |
| 97 | return 0; |
| 98 | } |
| 99 | |
| 100 | static inline void |
| 101 | nouveau_backlight_exit(struct drm_device *dev) { |
| 102 | } |
| 103 | #endif |
| 104 | |
| 105 | #endif |