| .. | .. |
|---|
| 1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 1 | +/* SPDX-License-Identifier: MIT */ |
|---|
| 2 | 2 | #ifndef __NOUVEAU_DISPLAY_H__ |
|---|
| 3 | 3 | #define __NOUVEAU_DISPLAY_H__ |
|---|
| 4 | + |
|---|
| 4 | 5 | #include "nouveau_drv.h" |
|---|
| 6 | + |
|---|
| 5 | 7 | #include <nvif/disp.h> |
|---|
| 6 | 8 | |
|---|
| 7 | | -struct nouveau_framebuffer { |
|---|
| 8 | | - struct drm_framebuffer base; |
|---|
| 9 | | - struct nouveau_bo *nvbo; |
|---|
| 10 | | - struct nouveau_vma *vma; |
|---|
| 11 | | - u32 r_handle; |
|---|
| 12 | | - u32 r_format; |
|---|
| 13 | | - u32 r_pitch; |
|---|
| 14 | | - struct nvif_object h_base[4]; |
|---|
| 15 | | - struct nvif_object h_core; |
|---|
| 16 | | -}; |
|---|
| 9 | +#include <drm/drm_framebuffer.h> |
|---|
| 17 | 10 | |
|---|
| 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 | | - |
|---|
| 24 | | -int nouveau_framebuffer_new(struct drm_device *, |
|---|
| 25 | | - const struct drm_mode_fb_cmd2 *, |
|---|
| 26 | | - struct nouveau_bo *, struct nouveau_framebuffer **); |
|---|
| 27 | | - |
|---|
| 28 | | -struct nouveau_page_flip_state { |
|---|
| 29 | | - struct list_head head; |
|---|
| 30 | | - struct drm_pending_vblank_event *event; |
|---|
| 31 | | - struct drm_crtc *crtc; |
|---|
| 32 | | - int bpp, pitch; |
|---|
| 33 | | - u64 offset; |
|---|
| 34 | | -}; |
|---|
| 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); |
|---|
| 35 | 16 | |
|---|
| 36 | 17 | struct nouveau_display { |
|---|
| 37 | 18 | void *priv; |
|---|
| 38 | 19 | void (*dtor)(struct drm_device *); |
|---|
| 39 | | - int (*init)(struct drm_device *); |
|---|
| 40 | | - void (*fini)(struct drm_device *); |
|---|
| 20 | + int (*init)(struct drm_device *, bool resume, bool runtime); |
|---|
| 21 | + void (*fini)(struct drm_device *, bool suspend, bool runtime); |
|---|
| 41 | 22 | |
|---|
| 42 | 23 | struct nvif_disp disp; |
|---|
| 43 | 24 | |
|---|
| .. | .. |
|---|
| 51 | 32 | struct drm_property *color_vibrance_property; |
|---|
| 52 | 33 | |
|---|
| 53 | 34 | struct drm_atomic_state *suspend; |
|---|
| 35 | + |
|---|
| 36 | + const u64 *format_modifiers; |
|---|
| 54 | 37 | }; |
|---|
| 55 | 38 | |
|---|
| 56 | 39 | static inline struct nouveau_display * |
|---|
| .. | .. |
|---|
| 61 | 44 | |
|---|
| 62 | 45 | int nouveau_display_create(struct drm_device *dev); |
|---|
| 63 | 46 | void nouveau_display_destroy(struct drm_device *dev); |
|---|
| 64 | | -int nouveau_display_init(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); |
|---|
| 65 | 49 | void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime); |
|---|
| 66 | 50 | int nouveau_display_suspend(struct drm_device *dev, bool runtime); |
|---|
| 67 | 51 | 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 | | -bool nouveau_display_scanoutpos(struct drm_device *, unsigned int, |
|---|
| 71 | | - bool, int *, int *, ktime_t *, |
|---|
| 72 | | - ktime_t *, const struct drm_display_mode *); |
|---|
| 73 | | - |
|---|
| 74 | | -int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, |
|---|
| 75 | | - struct drm_pending_vblank_event *event, |
|---|
| 76 | | - uint32_t page_flip_flags, |
|---|
| 77 | | - struct drm_modeset_acquire_ctx *ctx); |
|---|
| 78 | | -int nouveau_finish_page_flip(struct nouveau_channel *, |
|---|
| 79 | | - struct nouveau_page_flip_state *); |
|---|
| 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); |
|---|
| 80 | 58 | |
|---|
| 81 | 59 | int nouveau_display_dumb_create(struct drm_file *, struct drm_device *, |
|---|
| 82 | 60 | struct drm_mode_create_dumb *args); |
|---|
| .. | .. |
|---|
| 85 | 63 | |
|---|
| 86 | 64 | void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *); |
|---|
| 87 | 65 | |
|---|
| 88 | | -#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT |
|---|
| 89 | | -extern int nouveau_backlight_init(struct drm_device *); |
|---|
| 90 | | -extern void nouveau_backlight_exit(struct drm_device *); |
|---|
| 91 | | -extern void nouveau_backlight_ctor(void); |
|---|
| 92 | | -extern void nouveau_backlight_dtor(void); |
|---|
| 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 | | - |
|---|
| 104 | | -static inline void |
|---|
| 105 | | -nouveau_backlight_ctor(void) { |
|---|
| 106 | | -} |
|---|
| 107 | | - |
|---|
| 108 | | -static inline void |
|---|
| 109 | | -nouveau_backlight_dtor(void) { |
|---|
| 110 | | -} |
|---|
| 111 | | -#endif |
|---|
| 66 | +void |
|---|
| 67 | +nouveau_framebuffer_get_layout(struct drm_framebuffer *fb, uint32_t *tile_mode, |
|---|
| 68 | + uint8_t *kind); |
|---|
| 112 | 69 | |
|---|
| 113 | 70 | struct drm_framebuffer * |
|---|
| 114 | 71 | nouveau_user_framebuffer_create(struct drm_device *, struct drm_file *, |
|---|