Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 2 | #ifndef __NOUVEAU_DISPLAY_H__ |
| 3 | #define __NOUVEAU_DISPLAY_H__ |
Ben Skeggs | 4dc2813 | 2016-05-20 09:22:55 +1000 | [diff] [blame] | 4 | #include "nouveau_drv.h" |
Ben Skeggs | 0d4a2c5 | 2018-05-08 20:39:47 +1000 | [diff] [blame] | 5 | #include <nvif/disp.h> |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 6 | |
| 7 | struct nouveau_framebuffer { |
| 8 | struct drm_framebuffer base; |
| 9 | struct nouveau_bo *nvbo; |
Ben Skeggs | 24e8375 | 2017-11-01 03:56:19 +1000 | [diff] [blame] | 10 | struct nouveau_vma *vma; |
Ben Skeggs | 8a42364 | 2014-08-10 04:10:19 +1000 | [diff] [blame] | 11 | u32 r_handle; |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 12 | u32 r_format; |
| 13 | u32 r_pitch; |
Ben Skeggs | 0ad7286 | 2014-08-10 04:10:22 +1000 | [diff] [blame] | 14 | struct nvif_object h_base[4]; |
| 15 | struct nvif_object h_core; |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 16 | }; |
| 17 | |
| 18 | static inline struct nouveau_framebuffer * |
| 19 | nouveau_framebuffer(struct drm_framebuffer *fb) |
| 20 | { |
| 21 | return container_of(fb, struct nouveau_framebuffer, base); |
| 22 | } |
| 23 | |
Ben Skeggs | 1608a0f | 2016-11-04 17:20:35 +1000 | [diff] [blame] | 24 | int nouveau_framebuffer_new(struct drm_device *, |
| 25 | const struct drm_mode_fb_cmd2 *, |
| 26 | struct nouveau_bo *, struct nouveau_framebuffer **); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 27 | |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 28 | struct nouveau_display { |
| 29 | void *priv; |
| 30 | void (*dtor)(struct drm_device *); |
Ben Skeggs | 0f9976d | 2019-02-12 22:28:13 +1000 | [diff] [blame^] | 31 | int (*init)(struct drm_device *, bool resume, bool runtime); |
Ben Skeggs | f04a418 | 2019-02-12 22:28:13 +1000 | [diff] [blame] | 32 | void (*fini)(struct drm_device *, bool suspend); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 33 | |
Ben Skeggs | 0d4a2c5 | 2018-05-08 20:39:47 +1000 | [diff] [blame] | 34 | struct nvif_disp disp; |
Ben Skeggs | ab0af55 | 2014-08-10 04:10:19 +1000 | [diff] [blame] | 35 | |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 36 | struct drm_property *dithering_mode; |
| 37 | struct drm_property *dithering_depth; |
| 38 | struct drm_property *underscan_property; |
| 39 | struct drm_property *underscan_hborder_property; |
| 40 | struct drm_property *underscan_vborder_property; |
| 41 | /* not really hue and saturation: */ |
| 42 | struct drm_property *vibrant_hue_property; |
| 43 | struct drm_property *color_vibrance_property; |
Ben Skeggs | b167db0 | 2016-11-04 17:20:36 +1000 | [diff] [blame] | 44 | |
| 45 | struct drm_atomic_state *suspend; |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | static inline struct nouveau_display * |
| 49 | nouveau_display(struct drm_device *dev) |
| 50 | { |
| 51 | return nouveau_drm(dev)->display; |
| 52 | } |
| 53 | |
| 54 | int nouveau_display_create(struct drm_device *dev); |
| 55 | void nouveau_display_destroy(struct drm_device *dev); |
Ben Skeggs | 0f9976d | 2019-02-12 22:28:13 +1000 | [diff] [blame^] | 56 | int nouveau_display_init(struct drm_device *dev, bool resume, bool runtime); |
Lyude Paul | 2f7ca78 | 2018-08-07 17:32:48 -0400 | [diff] [blame] | 57 | void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime); |
Ben Skeggs | 6fbb702 | 2014-10-02 13:22:27 +1000 | [diff] [blame] | 58 | int nouveau_display_suspend(struct drm_device *dev, bool runtime); |
| 59 | void nouveau_display_resume(struct drm_device *dev, bool runtime); |
Thierry Reding | 88e7271 | 2015-09-24 18:35:31 +0200 | [diff] [blame] | 60 | int nouveau_display_vblank_enable(struct drm_device *, unsigned int); |
| 61 | void nouveau_display_vblank_disable(struct drm_device *, unsigned int); |
Daniel Vetter | 1bf6ad6 | 2017-05-09 16:03:28 +0200 | [diff] [blame] | 62 | bool nouveau_display_scanoutpos(struct drm_device *, unsigned int, |
| 63 | bool, int *, int *, ktime_t *, |
| 64 | ktime_t *, const struct drm_display_mode *); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 65 | |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 66 | int nouveau_display_dumb_create(struct drm_file *, struct drm_device *, |
| 67 | struct drm_mode_create_dumb *args); |
| 68 | int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *, |
| 69 | u32 handle, u64 *offset); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 70 | |
| 71 | void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *); |
| 72 | |
Ben Skeggs | 839ca90 | 2016-11-04 17:20:36 +1000 | [diff] [blame] | 73 | struct drm_framebuffer * |
| 74 | nouveau_user_framebuffer_create(struct drm_device *, struct drm_file *, |
| 75 | const struct drm_mode_fb_cmd2 *); |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 76 | #endif |