Linux Audio

Check our new training course

Loading...
  1#ifndef __NV50_KMS_WNDW_H__
  2#define __NV50_KMS_WNDW_H__
  3#define nv50_wndw(p) container_of((p), struct nv50_wndw, plane)
  4#include "disp.h"
  5#include "atom.h"
  6#include "lut.h"
  7
  8struct nv50_wndw_ctxdma {
  9	struct list_head head;
 10	struct nvif_object object;
 11};
 12
 13struct nv50_wndw {
 14	const struct nv50_wndw_func *func;
 15	const struct nv50_wimm_func *immd;
 16	int id;
 17	struct nv50_disp_interlock interlock;
 18
 19	struct {
 20		struct nvif_object *parent;
 21		struct list_head list;
 22	} ctxdma;
 23
 24	struct drm_plane plane;
 25
 26	struct nv50_lut ilut;
 27
 28	struct nv50_dmac wndw;
 29	struct nv50_dmac wimm;
 30
 31	u16 ntfy;
 32	u16 sema;
 33	u32 data;
 34};
 35
 36int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *,
 37		   enum drm_plane_type, const char *name, int index,
 38		   const u32 *format, u32 heads,
 39		   enum nv50_disp_interlock_type, u32 interlock_data,
 40		   struct nv50_wndw **);
 41void nv50_wndw_flush_set(struct nv50_wndw *, u32 *interlock,
 42			 struct nv50_wndw_atom *);
 43void nv50_wndw_flush_clr(struct nv50_wndw *, u32 *interlock, bool flush,
 44			 struct nv50_wndw_atom *);
 45void nv50_wndw_ntfy_enable(struct nv50_wndw *, struct nv50_wndw_atom *);
 46int nv50_wndw_wait_armed(struct nv50_wndw *, struct nv50_wndw_atom *);
 47
 48struct nv50_wndw_func {
 49	int (*acquire)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
 50		       struct nv50_head_atom *asyh);
 51	void (*release)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
 52			struct nv50_head_atom *asyh);
 53	void (*prepare)(struct nv50_wndw *, struct nv50_head_atom *asyh,
 54			struct nv50_wndw_atom *asyw);
 55
 56	int (*sema_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
 57	int (*sema_clr)(struct nv50_wndw *);
 58	void (*ntfy_reset)(struct nouveau_bo *, u32 offset);
 59	int (*ntfy_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
 60	int (*ntfy_clr)(struct nv50_wndw *);
 61	int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset,
 62			       struct nvif_device *);
 63	void (*ilut)(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyh, int size);
 64	void (*csc)(struct nv50_wndw *, struct nv50_wndw_atom *,
 65		    const struct drm_color_ctm *);
 66	int (*csc_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
 67	int (*csc_clr)(struct nv50_wndw *);
 68	bool ilut_identity;
 69	int  ilut_size;
 70	bool olut_core;
 71	int (*xlut_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
 72	int (*xlut_clr)(struct nv50_wndw *);
 73	int (*image_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
 74	int (*image_clr)(struct nv50_wndw *);
 75	int (*scale_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
 76	int (*blend_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
 77
 78	int (*update)(struct nv50_wndw *, u32 *interlock);
 79};
 80
 81extern const struct drm_plane_funcs nv50_wndw;
 82
 83void base507c_ntfy_reset(struct nouveau_bo *, u32);
 84int base507c_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *);
 85int base507c_ntfy_clr(struct nv50_wndw *);
 86int base507c_ntfy_wait_begun(struct nouveau_bo *, u32, struct nvif_device *);
 87int base507c_image_clr(struct nv50_wndw *);
 88int base507c_update(struct nv50_wndw *, u32 *);
 89
 90void base907c_csc(struct nv50_wndw *, struct nv50_wndw_atom *,
 91		  const struct drm_color_ctm *);
 92
 93struct nv50_wimm_func {
 94	int (*point)(struct nv50_wndw *, struct nv50_wndw_atom *);
 95
 96	int (*update)(struct nv50_wndw *, u32 *interlock);
 97};
 98
 99extern const struct nv50_wimm_func curs507a;
100bool curs507a_space(struct nv50_wndw *);
101
102static inline __must_check int
103nvif_chan_wait(struct nv50_dmac *dmac, u32 size)
104{
105	struct nv50_wndw *wndw = container_of(dmac, typeof(*wndw), wimm);
106	return curs507a_space(wndw) ? 0 : -ETIMEDOUT;
107}
108
109int wndwc37e_new(struct nouveau_drm *, enum drm_plane_type, int, s32,
110		 struct nv50_wndw **);
111int wndwc37e_new_(const struct nv50_wndw_func *, struct nouveau_drm *,
112		  enum drm_plane_type type, int index, s32 oclass, u32 heads,
113		  struct nv50_wndw **);
114int wndwc37e_acquire(struct nv50_wndw *, struct nv50_wndw_atom *,
115		     struct nv50_head_atom *);
116void wndwc37e_release(struct nv50_wndw *, struct nv50_wndw_atom *,
117		      struct nv50_head_atom *);
118int wndwc37e_sema_set(struct nv50_wndw *, struct nv50_wndw_atom *);
119int wndwc37e_sema_clr(struct nv50_wndw *);
120int wndwc37e_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *);
121int wndwc37e_ntfy_clr(struct nv50_wndw *);
122int wndwc37e_image_clr(struct nv50_wndw *);
123int wndwc37e_blend_set(struct nv50_wndw *, struct nv50_wndw_atom *);
124int wndwc37e_update(struct nv50_wndw *, u32 *);
125
126int wndwc57e_new(struct nouveau_drm *, enum drm_plane_type, int, s32,
127		 struct nv50_wndw **);
128void wndwc57e_ilut(struct nv50_wndw *, struct nv50_wndw_atom *, int);
129int wndwc57e_ilut_set(struct nv50_wndw *, struct nv50_wndw_atom *);
130int wndwc57e_ilut_clr(struct nv50_wndw *);
131int wndwc57e_csc_set(struct nv50_wndw *, struct nv50_wndw_atom *);
132int wndwc57e_csc_clr(struct nv50_wndw *);
133
134int wndwc67e_new(struct nouveau_drm *, enum drm_plane_type, int, s32,
135		 struct nv50_wndw **);
136
137int nv50_wndw_new(struct nouveau_drm *, enum drm_plane_type, int index,
138		  struct nv50_wndw **);
139#endif