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; |
Ben Skeggs | 8a42364 | 2014-08-10 04:10:19 +1000 | [diff] [blame] | 12 | u32 r_handle; |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 13 | u32 r_format; |
| 14 | u32 r_pitch; |
Ben Skeggs | 0ad7286 | 2014-08-10 04:10:22 +1000 | [diff] [blame^] | 15 | struct nvif_object h_base[4]; |
| 16 | struct nvif_object h_core; |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 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 | |
Ben Skeggs | ab0af55 | 2014-08-10 04:10:19 +1000 | [diff] [blame] | 41 | int (*fb_ctor)(struct drm_framebuffer *); |
| 42 | void (*fb_dtor)(struct drm_framebuffer *); |
| 43 | |
Ben Skeggs | 0ad7286 | 2014-08-10 04:10:22 +1000 | [diff] [blame^] | 44 | struct nvif_object disp; |
Ben Skeggs | ab0af55 | 2014-08-10 04:10:19 +1000 | [diff] [blame] | 45 | |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 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); |
Dave Airlie | 5addcf0 | 2012-09-10 14:20:51 +1000 | [diff] [blame] | 67 | void nouveau_display_repin(struct drm_device *dev); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 68 | void nouveau_display_resume(struct drm_device *dev); |
Ben Skeggs | 51cb4b3 | 2013-10-03 07:02:29 +1000 | [diff] [blame] | 69 | int nouveau_display_vblank_enable(struct drm_device *, int); |
| 70 | void nouveau_display_vblank_disable(struct drm_device *, int); |
Ben Skeggs | d83ef85 | 2013-11-14 13:37:49 +1000 | [diff] [blame] | 71 | int nouveau_display_scanoutpos(struct drm_device *, int, unsigned int, |
| 72 | int *, int *, ktime_t *, ktime_t *); |
| 73 | int nouveau_display_vblstamp(struct drm_device *, int, int *, |
| 74 | struct timeval *, unsigned); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 75 | |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 76 | 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] | 77 | struct drm_pending_vblank_event *event, |
| 78 | uint32_t page_flip_flags); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 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); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 86 | |
| 87 | void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *); |
| 88 | |
Dave Airlie | 5addcf0 | 2012-09-10 14:20:51 +1000 | [diff] [blame] | 89 | int nouveau_crtc_set_config(struct drm_mode_set *set); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 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 |