Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 1 | #ifndef __NOUVEAU_DISPLAY_H__ |
| 2 | #define __NOUVEAU_DISPLAY_H__ |
| 3 | |
| 4 | #include <subdev/vm.h> |
| 5 | |
| 6 | #include "nouveau_drm.h" |
| 7 | |
| 8 | struct nouveau_framebuffer { |
| 9 | struct drm_framebuffer base; |
| 10 | struct nouveau_bo *nvbo; |
| 11 | struct nouveau_vma vma; |
| 12 | u32 r_dma; |
| 13 | u32 r_format; |
| 14 | u32 r_pitch; |
| 15 | }; |
| 16 | |
| 17 | static inline struct nouveau_framebuffer * |
| 18 | nouveau_framebuffer(struct drm_framebuffer *fb) |
| 19 | { |
| 20 | return container_of(fb, struct nouveau_framebuffer, base); |
| 21 | } |
| 22 | |
| 23 | int nouveau_framebuffer_init(struct drm_device *, struct nouveau_framebuffer *, |
| 24 | struct drm_mode_fb_cmd2 *, struct nouveau_bo *); |
| 25 | |
| 26 | struct nouveau_page_flip_state { |
| 27 | struct list_head head; |
| 28 | struct drm_pending_vblank_event *event; |
| 29 | int crtc, bpp, pitch, x, y; |
| 30 | u64 offset; |
| 31 | }; |
| 32 | |
| 33 | struct nouveau_display { |
| 34 | void *priv; |
| 35 | void (*dtor)(struct drm_device *); |
| 36 | int (*init)(struct drm_device *); |
| 37 | void (*fini)(struct drm_device *); |
| 38 | |
| 39 | struct drm_property *dithering_mode; |
| 40 | struct drm_property *dithering_depth; |
| 41 | struct drm_property *underscan_property; |
| 42 | struct drm_property *underscan_hborder_property; |
| 43 | struct drm_property *underscan_vborder_property; |
| 44 | /* not really hue and saturation: */ |
| 45 | struct drm_property *vibrant_hue_property; |
| 46 | struct drm_property *color_vibrance_property; |
| 47 | }; |
| 48 | |
| 49 | static inline struct nouveau_display * |
| 50 | nouveau_display(struct drm_device *dev) |
| 51 | { |
| 52 | return nouveau_drm(dev)->display; |
| 53 | } |
| 54 | |
| 55 | int nouveau_display_create(struct drm_device *dev); |
| 56 | void nouveau_display_destroy(struct drm_device *dev); |
| 57 | int nouveau_display_init(struct drm_device *dev); |
| 58 | void nouveau_display_fini(struct drm_device *dev); |
| 59 | int nouveau_display_suspend(struct drm_device *dev); |
Dave Airlie | 5addcf0 | 2012-09-10 14:20:51 +1000 | [diff] [blame] | 60 | void nouveau_display_repin(struct drm_device *dev); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 61 | void nouveau_display_resume(struct drm_device *dev); |
| 62 | |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 63 | int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, |
Keith Packard | ed8d197 | 2013-07-22 18:49:58 -0700 | [diff] [blame^] | 64 | struct drm_pending_vblank_event *event, |
| 65 | uint32_t page_flip_flags); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 66 | int nouveau_finish_page_flip(struct nouveau_channel *, |
| 67 | struct nouveau_page_flip_state *); |
| 68 | |
| 69 | int nouveau_display_dumb_create(struct drm_file *, struct drm_device *, |
| 70 | struct drm_mode_create_dumb *args); |
| 71 | int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *, |
| 72 | u32 handle, u64 *offset); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 73 | |
| 74 | void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *); |
| 75 | |
Dave Airlie | 5addcf0 | 2012-09-10 14:20:51 +1000 | [diff] [blame] | 76 | int nouveau_crtc_set_config(struct drm_mode_set *set); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 77 | #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT |
| 78 | extern int nouveau_backlight_init(struct drm_device *); |
| 79 | extern void nouveau_backlight_exit(struct drm_device *); |
| 80 | #else |
| 81 | static inline int |
| 82 | nouveau_backlight_init(struct drm_device *dev) |
| 83 | { |
| 84 | return 0; |
| 85 | } |
| 86 | |
| 87 | static inline void |
| 88 | nouveau_backlight_exit(struct drm_device *dev) { |
| 89 | } |
| 90 | #endif |
| 91 | |
| 92 | #endif |