blob: 90426cb07c5ef22124e3d28bb2e84ed2f60cd50f [file] [log] [blame]
Ben Skeggs77145f12012-07-31 16:16:21 +10001#ifndef __NOUVEAU_DISPLAY_H__
2#define __NOUVEAU_DISPLAY_H__
3
4#include <subdev/vm.h>
5
6#include "nouveau_drm.h"
7
8struct 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
17static inline struct nouveau_framebuffer *
18nouveau_framebuffer(struct drm_framebuffer *fb)
19{
20 return container_of(fb, struct nouveau_framebuffer, base);
21}
22
23int nouveau_framebuffer_init(struct drm_device *, struct nouveau_framebuffer *,
24 struct drm_mode_fb_cmd2 *, struct nouveau_bo *);
25
26struct 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
33struct nouveau_display {
34 void *priv;
35 void (*dtor)(struct drm_device *);
36 int (*init)(struct drm_device *);
37 void (*fini)(struct drm_device *);
38
Ben Skeggsab0af552014-08-10 04:10:19 +100039 int (*fb_ctor)(struct drm_framebuffer *);
40 void (*fb_dtor)(struct drm_framebuffer *);
41
Ben Skeggs2332b312014-01-22 12:58:12 +100042 struct nouveau_object *core;
Ben Skeggs51cb4b32013-10-03 07:02:29 +100043 struct nouveau_eventh **vblank;
44
Ben Skeggsab0af552014-08-10 04:10:19 +100045
Ben Skeggs77145f12012-07-31 16:16:21 +100046 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
56static inline struct nouveau_display *
57nouveau_display(struct drm_device *dev)
58{
59 return nouveau_drm(dev)->display;
60}
61
62int nouveau_display_create(struct drm_device *dev);
63void nouveau_display_destroy(struct drm_device *dev);
64int nouveau_display_init(struct drm_device *dev);
65void nouveau_display_fini(struct drm_device *dev);
66int nouveau_display_suspend(struct drm_device *dev);
Dave Airlie5addcf02012-09-10 14:20:51 +100067void nouveau_display_repin(struct drm_device *dev);
Ben Skeggs77145f12012-07-31 16:16:21 +100068void nouveau_display_resume(struct drm_device *dev);
Ben Skeggs51cb4b32013-10-03 07:02:29 +100069int nouveau_display_vblank_enable(struct drm_device *, int);
70void nouveau_display_vblank_disable(struct drm_device *, int);
Ben Skeggsd83ef852013-11-14 13:37:49 +100071int nouveau_display_scanoutpos(struct drm_device *, int, unsigned int,
72 int *, int *, ktime_t *, ktime_t *);
73int nouveau_display_vblstamp(struct drm_device *, int, int *,
74 struct timeval *, unsigned);
Ben Skeggs77145f12012-07-31 16:16:21 +100075
Ben Skeggs77145f12012-07-31 16:16:21 +100076int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
Keith Packarded8d1972013-07-22 18:49:58 -070077 struct drm_pending_vblank_event *event,
78 uint32_t page_flip_flags);
Ben Skeggs77145f12012-07-31 16:16:21 +100079int nouveau_finish_page_flip(struct nouveau_channel *,
80 struct nouveau_page_flip_state *);
81
82int nouveau_display_dumb_create(struct drm_file *, struct drm_device *,
83 struct drm_mode_create_dumb *args);
84int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *,
85 u32 handle, u64 *offset);
Ben Skeggs77145f12012-07-31 16:16:21 +100086
87void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
88
Dave Airlie5addcf02012-09-10 14:20:51 +100089int nouveau_crtc_set_config(struct drm_mode_set *set);
Ben Skeggs77145f12012-07-31 16:16:21 +100090#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
91extern int nouveau_backlight_init(struct drm_device *);
92extern void nouveau_backlight_exit(struct drm_device *);
93#else
94static inline int
95nouveau_backlight_init(struct drm_device *dev)
96{
97 return 0;
98}
99
100static inline void
101nouveau_backlight_exit(struct drm_device *dev) {
102}
103#endif
104
105#endif