2019-06-20 08:13:43 +08:00
|
|
|
/* SPDX-License-Identifier: MIT */
|
2012-07-31 14:16:21 +08:00
|
|
|
#ifndef __NOUVEAU_DISPLAY_H__
|
|
|
|
#define __NOUVEAU_DISPLAY_H__
|
2019-05-19 22:00:42 +08:00
|
|
|
|
2016-05-20 07:22:55 +08:00
|
|
|
#include "nouveau_drv.h"
|
2019-05-19 22:00:42 +08:00
|
|
|
|
2018-05-08 18:39:47 +08:00
|
|
|
#include <nvif/disp.h>
|
2012-07-31 14:16:21 +08:00
|
|
|
|
2019-05-19 22:00:42 +08:00
|
|
|
#include <drm/drm_framebuffer.h>
|
|
|
|
|
2012-07-31 14:16:21 +08:00
|
|
|
struct nouveau_framebuffer {
|
|
|
|
struct drm_framebuffer base;
|
|
|
|
struct nouveau_bo *nvbo;
|
2017-11-01 01:56:19 +08:00
|
|
|
struct nouveau_vma *vma;
|
2014-08-10 02:10:19 +08:00
|
|
|
u32 r_handle;
|
2012-07-31 14:16:21 +08:00
|
|
|
u32 r_format;
|
|
|
|
u32 r_pitch;
|
2014-08-10 02:10:22 +08:00
|
|
|
struct nvif_object h_base[4];
|
|
|
|
struct nvif_object h_core;
|
2012-07-31 14:16:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct nouveau_framebuffer *
|
|
|
|
nouveau_framebuffer(struct drm_framebuffer *fb)
|
|
|
|
{
|
|
|
|
return container_of(fb, struct nouveau_framebuffer, base);
|
|
|
|
}
|
|
|
|
|
2016-11-04 15:20:35 +08:00
|
|
|
int nouveau_framebuffer_new(struct drm_device *,
|
|
|
|
const struct drm_mode_fb_cmd2 *,
|
|
|
|
struct nouveau_bo *, struct nouveau_framebuffer **);
|
2012-07-31 14:16:21 +08:00
|
|
|
|
|
|
|
struct nouveau_display {
|
|
|
|
void *priv;
|
|
|
|
void (*dtor)(struct drm_device *);
|
2019-02-12 20:28:13 +08:00
|
|
|
int (*init)(struct drm_device *, bool resume, bool runtime);
|
2019-02-12 20:28:13 +08:00
|
|
|
void (*fini)(struct drm_device *, bool suspend);
|
2012-07-31 14:16:21 +08:00
|
|
|
|
2018-05-08 18:39:47 +08:00
|
|
|
struct nvif_disp disp;
|
2014-08-10 02:10:19 +08:00
|
|
|
|
2012-07-31 14:16:21 +08:00
|
|
|
struct drm_property *dithering_mode;
|
|
|
|
struct drm_property *dithering_depth;
|
|
|
|
struct drm_property *underscan_property;
|
|
|
|
struct drm_property *underscan_hborder_property;
|
|
|
|
struct drm_property *underscan_vborder_property;
|
|
|
|
/* not really hue and saturation: */
|
|
|
|
struct drm_property *vibrant_hue_property;
|
|
|
|
struct drm_property *color_vibrance_property;
|
2016-11-04 15:20:36 +08:00
|
|
|
|
|
|
|
struct drm_atomic_state *suspend;
|
2012-07-31 14:16:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct nouveau_display *
|
|
|
|
nouveau_display(struct drm_device *dev)
|
|
|
|
{
|
|
|
|
return nouveau_drm(dev)->display;
|
|
|
|
}
|
|
|
|
|
|
|
|
int nouveau_display_create(struct drm_device *dev);
|
|
|
|
void nouveau_display_destroy(struct drm_device *dev);
|
2019-02-12 20:28:13 +08:00
|
|
|
int nouveau_display_init(struct drm_device *dev, bool resume, bool runtime);
|
2018-08-08 05:32:48 +08:00
|
|
|
void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime);
|
2014-10-02 11:22:27 +08:00
|
|
|
int nouveau_display_suspend(struct drm_device *dev, bool runtime);
|
|
|
|
void nouveau_display_resume(struct drm_device *dev, bool runtime);
|
2020-01-23 21:59:30 +08:00
|
|
|
int nouveau_display_vblank_enable(struct drm_crtc *crtc);
|
|
|
|
void nouveau_display_vblank_disable(struct drm_crtc *crtc);
|
2020-01-23 21:59:29 +08:00
|
|
|
bool nouveau_display_scanoutpos(struct drm_crtc *crtc,
|
|
|
|
bool in_vblank_irq, int *vpos, int *hpos,
|
|
|
|
ktime_t *stime, ktime_t *etime,
|
|
|
|
const struct drm_display_mode *mode);
|
2012-07-31 14:16:21 +08:00
|
|
|
|
|
|
|
int nouveau_display_dumb_create(struct drm_file *, struct drm_device *,
|
|
|
|
struct drm_mode_create_dumb *args);
|
|
|
|
int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *,
|
|
|
|
u32 handle, u64 *offset);
|
|
|
|
|
|
|
|
void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
|
|
|
|
|
2016-11-04 15:20:36 +08:00
|
|
|
struct drm_framebuffer *
|
|
|
|
nouveau_user_framebuffer_create(struct drm_device *, struct drm_file *,
|
|
|
|
const struct drm_mode_fb_cmd2 *);
|
2012-07-31 14:16:21 +08:00
|
|
|
#endif
|