0001 #ifndef __NV50_KMS_WNDW_H__
0002 #define __NV50_KMS_WNDW_H__
0003 #define nv50_wndw(p) container_of((p), struct nv50_wndw, plane)
0004 #include "disp.h"
0005 #include "atom.h"
0006 #include "lut.h"
0007
0008 struct nv50_wndw_ctxdma {
0009 struct list_head head;
0010 struct nvif_object object;
0011 };
0012
0013 struct nv50_wndw {
0014 const struct nv50_wndw_func *func;
0015 const struct nv50_wimm_func *immd;
0016 int id;
0017 struct nv50_disp_interlock interlock;
0018
0019 struct {
0020 struct nvif_object *parent;
0021 struct list_head list;
0022 } ctxdma;
0023
0024 struct drm_plane plane;
0025
0026 struct nv50_lut ilut;
0027
0028 struct nv50_dmac wndw;
0029 struct nv50_dmac wimm;
0030
0031 u16 ntfy;
0032 u16 sema;
0033 u32 data;
0034 };
0035
0036 int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *,
0037 enum drm_plane_type, const char *name, int index,
0038 const u32 *format, enum nv50_disp_interlock_type,
0039 u32 interlock_data, u32 heads, struct nv50_wndw **);
0040 void nv50_wndw_flush_set(struct nv50_wndw *, u32 *interlock,
0041 struct nv50_wndw_atom *);
0042 void nv50_wndw_flush_clr(struct nv50_wndw *, u32 *interlock, bool flush,
0043 struct nv50_wndw_atom *);
0044 void nv50_wndw_ntfy_enable(struct nv50_wndw *, struct nv50_wndw_atom *);
0045 int nv50_wndw_wait_armed(struct nv50_wndw *, struct nv50_wndw_atom *);
0046
0047 struct nv50_wndw_func {
0048 int (*acquire)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
0049 struct nv50_head_atom *asyh);
0050 void (*release)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
0051 struct nv50_head_atom *asyh);
0052 void (*prepare)(struct nv50_wndw *, struct nv50_head_atom *asyh,
0053 struct nv50_wndw_atom *asyw);
0054
0055 int (*sema_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
0056 int (*sema_clr)(struct nv50_wndw *);
0057 void (*ntfy_reset)(struct nouveau_bo *, u32 offset);
0058 int (*ntfy_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
0059 int (*ntfy_clr)(struct nv50_wndw *);
0060 int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset,
0061 struct nvif_device *);
0062 void (*ilut)(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyh, int size);
0063 void (*csc)(struct nv50_wndw *, struct nv50_wndw_atom *,
0064 const struct drm_color_ctm *);
0065 int (*csc_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
0066 int (*csc_clr)(struct nv50_wndw *);
0067 bool ilut_identity;
0068 int ilut_size;
0069 bool olut_core;
0070 int (*xlut_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
0071 int (*xlut_clr)(struct nv50_wndw *);
0072 int (*image_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
0073 int (*image_clr)(struct nv50_wndw *);
0074 int (*scale_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
0075 int (*blend_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
0076
0077 int (*update)(struct nv50_wndw *, u32 *interlock);
0078 };
0079
0080 extern const struct drm_plane_funcs nv50_wndw;
0081
0082 void base507c_ntfy_reset(struct nouveau_bo *, u32);
0083 int base507c_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *);
0084 int base507c_ntfy_clr(struct nv50_wndw *);
0085 int base507c_ntfy_wait_begun(struct nouveau_bo *, u32, struct nvif_device *);
0086 int base507c_image_clr(struct nv50_wndw *);
0087 int base507c_update(struct nv50_wndw *, u32 *);
0088
0089 void base907c_csc(struct nv50_wndw *, struct nv50_wndw_atom *,
0090 const struct drm_color_ctm *);
0091
0092 struct nv50_wimm_func {
0093 int (*point)(struct nv50_wndw *, struct nv50_wndw_atom *);
0094
0095 int (*update)(struct nv50_wndw *, u32 *interlock);
0096 };
0097
0098 extern const struct nv50_wimm_func curs507a;
0099 bool curs507a_space(struct nv50_wndw *);
0100
0101 static inline __must_check int
0102 nvif_chan_wait(struct nv50_dmac *dmac, u32 size)
0103 {
0104 struct nv50_wndw *wndw = container_of(dmac, typeof(*wndw), wimm);
0105 return curs507a_space(wndw) ? 0 : -ETIMEDOUT;
0106 }
0107
0108 int wndwc37e_new(struct nouveau_drm *, enum drm_plane_type, int, s32,
0109 struct nv50_wndw **);
0110 int wndwc37e_new_(const struct nv50_wndw_func *, struct nouveau_drm *,
0111 enum drm_plane_type type, int index, s32 oclass, u32 heads,
0112 struct nv50_wndw **);
0113 int wndwc37e_acquire(struct nv50_wndw *, struct nv50_wndw_atom *,
0114 struct nv50_head_atom *);
0115 void wndwc37e_release(struct nv50_wndw *, struct nv50_wndw_atom *,
0116 struct nv50_head_atom *);
0117 int wndwc37e_sema_set(struct nv50_wndw *, struct nv50_wndw_atom *);
0118 int wndwc37e_sema_clr(struct nv50_wndw *);
0119 int wndwc37e_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *);
0120 int wndwc37e_ntfy_clr(struct nv50_wndw *);
0121 int wndwc37e_image_clr(struct nv50_wndw *);
0122 int wndwc37e_blend_set(struct nv50_wndw *, struct nv50_wndw_atom *);
0123 int wndwc37e_update(struct nv50_wndw *, u32 *);
0124
0125 int wndwc57e_new(struct nouveau_drm *, enum drm_plane_type, int, s32,
0126 struct nv50_wndw **);
0127 void wndwc57e_ilut(struct nv50_wndw *, struct nv50_wndw_atom *, int);
0128 int wndwc57e_ilut_set(struct nv50_wndw *, struct nv50_wndw_atom *);
0129 int wndwc57e_ilut_clr(struct nv50_wndw *);
0130 int wndwc57e_csc_set(struct nv50_wndw *, struct nv50_wndw_atom *);
0131 int wndwc57e_csc_clr(struct nv50_wndw *);
0132
0133 int wndwc67e_new(struct nouveau_drm *, enum drm_plane_type, int, s32,
0134 struct nv50_wndw **);
0135
0136 int nv50_wndw_new(struct nouveau_drm *, enum drm_plane_type, int index,
0137 struct nv50_wndw **);
0138 #endif