Home | History | Annotate | Line # | Download | only in nouveau
      1  1.2  riastrad /*	$NetBSD: nouveau_display.h,v 1.3 2021/12/18 23:45:32 riastradh Exp $	*/
      2  1.2  riastrad 
      3  1.3  riastrad /* SPDX-License-Identifier: MIT */
      4  1.1  riastrad #ifndef __NOUVEAU_DISPLAY_H__
      5  1.1  riastrad #define __NOUVEAU_DISPLAY_H__
      6  1.1  riastrad 
      7  1.3  riastrad #include "nouveau_drv.h"
      8  1.1  riastrad 
      9  1.3  riastrad #include <nvif/disp.h>
     10  1.3  riastrad 
     11  1.3  riastrad #include <drm/drm_framebuffer.h>
     12  1.1  riastrad 
     13  1.1  riastrad struct nouveau_framebuffer {
     14  1.1  riastrad 	struct drm_framebuffer base;
     15  1.1  riastrad 	struct nouveau_bo *nvbo;
     16  1.3  riastrad 	struct nouveau_vma *vma;
     17  1.2  riastrad 	u32 r_handle;
     18  1.1  riastrad 	u32 r_format;
     19  1.1  riastrad 	u32 r_pitch;
     20  1.2  riastrad 	struct nvif_object h_base[4];
     21  1.2  riastrad 	struct nvif_object h_core;
     22  1.1  riastrad };
     23  1.1  riastrad 
     24  1.1  riastrad static inline struct nouveau_framebuffer *
     25  1.1  riastrad nouveau_framebuffer(struct drm_framebuffer *fb)
     26  1.1  riastrad {
     27  1.1  riastrad 	return container_of(fb, struct nouveau_framebuffer, base);
     28  1.1  riastrad }
     29  1.1  riastrad 
     30  1.3  riastrad int nouveau_framebuffer_new(struct drm_device *,
     31  1.3  riastrad 			    const struct drm_mode_fb_cmd2 *,
     32  1.3  riastrad 			    struct nouveau_bo *, struct nouveau_framebuffer **);
     33  1.1  riastrad 
     34  1.1  riastrad struct nouveau_display {
     35  1.1  riastrad 	void *priv;
     36  1.1  riastrad 	void (*dtor)(struct drm_device *);
     37  1.3  riastrad 	int  (*init)(struct drm_device *, bool resume, bool runtime);
     38  1.3  riastrad 	void (*fini)(struct drm_device *, bool suspend);
     39  1.1  riastrad 
     40  1.3  riastrad 	struct nvif_disp disp;
     41  1.1  riastrad 
     42  1.1  riastrad 	struct drm_property *dithering_mode;
     43  1.1  riastrad 	struct drm_property *dithering_depth;
     44  1.1  riastrad 	struct drm_property *underscan_property;
     45  1.1  riastrad 	struct drm_property *underscan_hborder_property;
     46  1.1  riastrad 	struct drm_property *underscan_vborder_property;
     47  1.1  riastrad 	/* not really hue and saturation: */
     48  1.1  riastrad 	struct drm_property *vibrant_hue_property;
     49  1.1  riastrad 	struct drm_property *color_vibrance_property;
     50  1.3  riastrad 
     51  1.3  riastrad 	struct drm_atomic_state *suspend;
     52  1.1  riastrad };
     53  1.1  riastrad 
     54  1.1  riastrad static inline struct nouveau_display *
     55  1.1  riastrad nouveau_display(struct drm_device *dev)
     56  1.1  riastrad {
     57  1.1  riastrad 	return nouveau_drm(dev)->display;
     58  1.1  riastrad }
     59  1.1  riastrad 
     60  1.1  riastrad int  nouveau_display_create(struct drm_device *dev);
     61  1.1  riastrad void nouveau_display_destroy(struct drm_device *dev);
     62  1.3  riastrad int  nouveau_display_init(struct drm_device *dev, bool resume, bool runtime);
     63  1.3  riastrad void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime);
     64  1.2  riastrad int  nouveau_display_suspend(struct drm_device *dev, bool runtime);
     65  1.2  riastrad void nouveau_display_resume(struct drm_device *dev, bool runtime);
     66  1.2  riastrad int  nouveau_display_vblank_enable(struct drm_device *, unsigned int);
     67  1.2  riastrad void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
     68  1.3  riastrad bool  nouveau_display_scanoutpos(struct drm_device *, unsigned int,
     69  1.3  riastrad 				 bool, int *, int *, ktime_t *,
     70  1.3  riastrad 				 ktime_t *, const struct drm_display_mode *);
     71  1.1  riastrad 
     72  1.1  riastrad int  nouveau_display_dumb_create(struct drm_file *, struct drm_device *,
     73  1.1  riastrad 				 struct drm_mode_create_dumb *args);
     74  1.1  riastrad int  nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *,
     75  1.1  riastrad 				     u32 handle, u64 *offset);
     76  1.1  riastrad 
     77  1.1  riastrad void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
     78  1.1  riastrad 
     79  1.3  riastrad struct drm_framebuffer *
     80  1.3  riastrad nouveau_user_framebuffer_create(struct drm_device *, struct drm_file *,
     81  1.3  riastrad 				const struct drm_mode_fb_cmd2 *);
     82  1.1  riastrad #endif
     83