blob: be3d5947c6be0a6a51fa1730d41501c49fb582c2 [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;
Ben Skeggs8a423642014-08-10 04:10:19 +100012 u32 r_handle;
Ben Skeggs77145f12012-07-31 16:16:21 +100013 u32 r_format;
14 u32 r_pitch;
Ben Skeggs0ad72862014-08-10 04:10:22 +100015 struct nvif_object h_base[4];
16 struct nvif_object h_core;
Ben Skeggs77145f12012-07-31 16:16:21 +100017};
18
19static inline struct nouveau_framebuffer *
20nouveau_framebuffer(struct drm_framebuffer *fb)
21{
22 return container_of(fb, struct nouveau_framebuffer, base);
23}
24
25int nouveau_framebuffer_init(struct drm_device *, struct nouveau_framebuffer *,
26 struct drm_mode_fb_cmd2 *, struct nouveau_bo *);
27
28struct 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
35struct 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 Skeggsab0af552014-08-10 04:10:19 +100041 int (*fb_ctor)(struct drm_framebuffer *);
42 void (*fb_dtor)(struct drm_framebuffer *);
43
Ben Skeggs0ad72862014-08-10 04:10:22 +100044 struct nvif_object disp;
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);
Ben Skeggs6fbb7022014-10-02 13:22:27 +100066int nouveau_display_suspend(struct drm_device *dev, bool runtime);
67void nouveau_display_resume(struct drm_device *dev, bool runtime);
Ben Skeggs51cb4b32013-10-03 07:02:29 +100068int nouveau_display_vblank_enable(struct drm_device *, int);
69void nouveau_display_vblank_disable(struct drm_device *, int);
Ben Skeggsd83ef852013-11-14 13:37:49 +100070int nouveau_display_scanoutpos(struct drm_device *, int, unsigned int,
71 int *, int *, ktime_t *, ktime_t *);
72int nouveau_display_vblstamp(struct drm_device *, int, int *,
73 struct timeval *, unsigned);
Ben Skeggs77145f12012-07-31 16:16:21 +100074
Ben Skeggs77145f12012-07-31 16:16:21 +100075int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
Keith Packarded8d1972013-07-22 18:49:58 -070076 struct drm_pending_vblank_event *event,
77 uint32_t page_flip_flags);
Ben Skeggs77145f12012-07-31 16:16:21 +100078int nouveau_finish_page_flip(struct nouveau_channel *,
79 struct nouveau_page_flip_state *);
80
81int nouveau_display_dumb_create(struct drm_file *, struct drm_device *,
82 struct drm_mode_create_dumb *args);
83int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *,
84 u32 handle, u64 *offset);
Ben Skeggs77145f12012-07-31 16:16:21 +100085
86void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
87
Dave Airlie5addcf02012-09-10 14:20:51 +100088int nouveau_crtc_set_config(struct drm_mode_set *set);
Ben Skeggs77145f12012-07-31 16:16:21 +100089#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
90extern int nouveau_backlight_init(struct drm_device *);
91extern void nouveau_backlight_exit(struct drm_device *);
92#else
93static inline int
94nouveau_backlight_init(struct drm_device *dev)
95{
96 return 0;
97}
98
99static inline void
100nouveau_backlight_exit(struct drm_device *dev) {
101}
102#endif
103
104#endif