atom.h 3.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#ifndef __NV50_KMS_ATOM_H__
#define __NV50_KMS_ATOM_H__
#define nv50_atom(p) container_of((p), struct nv50_atom, state)
#include <drm/drm_atomic.h>

struct nv50_atom {
	struct drm_atomic_state state;

	struct list_head outp;
	bool lock_core;
	bool flush_disable;
};

#define nv50_head_atom(p) container_of((p), struct nv50_head_atom, state)

struct nv50_head_atom {
	struct drm_crtc_state state;

19 20 21 22 23
	struct {
		u32 mask;
		u32 olut;
	} wndw;

24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
	struct {
		u16 iW;
		u16 iH;
		u16 oW;
		u16 oH;
	} view;

	struct nv50_head_mode {
		bool interlace;
		u32 clock;
		struct {
			u16 active;
			u16 synce;
			u16 blanke;
			u16 blanks;
		} h;
		struct {
			u32 active;
			u16 synce;
			u16 blanke;
			u16 blanks;
			u16 blank2s;
			u16 blank2e;
			u16 blankus;
		} v;
	} mode;

	struct {
		bool visible;
		u32 handle;
		u64 offset:40;
55 56
		u8 buffer:1;
		u8 mode:4;
57 58 59
		u8 size:2;
		u8 range:2;
		u8 output_mode:2;
60
	} olut;
61 62 63 64 65 66 67 68

	struct {
		bool visible;
		u32 handle;
		u64 offset:40;
		u8  format;
		u8  kind:7;
		u8  layout:1;
69 70
		u8  blockh:4;
		u16 blocks:12;
71 72 73 74 75 76 77 78 79 80 81
		u32 pitch:20;
		u16 x;
		u16 y;
		u16 w;
		u16 h;
	} core;

	struct {
		bool visible;
		u32 handle;
		u64 offset:40;
82
		u8  layout:2;
83
		u8  format:8;
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
	} curs;

	struct {
		u8  depth;
		u8  cpp;
		u16 x;
		u16 y;
		u16 w;
		u16 h;
	} base;

	struct {
		u8 cpp;
	} ovly;

	struct {
		bool enable:1;
		u8 bits:2;
		u8 mode:4;
	} dither;

	struct {
		struct {
			u16 cos:12;
			u16 sin:12;
		} sat;
	} procamp;

	struct {
		u8 nhsync:1;
		u8 nvsync:1;
		u8 depth:4;
	} or;

118
	union nv50_head_atom_mask {
119
		struct {
120
			bool olut:1;
121 122 123 124 125 126 127 128 129 130 131
			bool core:1;
			bool curs:1;
			bool view:1;
			bool mode:1;
			bool base:1;
			bool ovly:1;
			bool dither:1;
			bool procamp:1;
			bool or:1;
		};
		u16 mask;
132
	} set, clr;
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
};

static inline struct nv50_head_atom *
nv50_head_atom_get(struct drm_atomic_state *state, struct drm_crtc *crtc)
{
	struct drm_crtc_state *statec = drm_atomic_get_crtc_state(state, crtc);
	if (IS_ERR(statec))
		return (void *)statec;
	return nv50_head_atom(statec);
}

#define nv50_wndw_atom(p) container_of((p), struct nv50_wndw_atom, state)

struct nv50_wndw_atom {
	struct drm_plane_state state;

149
	struct drm_property_blob *ilut;
150 151
	bool visible;

152 153 154 155 156 157 158 159 160 161 162 163 164 165
	struct {
		u32  handle;
		u16  offset:12;
		bool awaken:1;
	} ntfy;

	struct {
		u32 handle;
		u16 offset:12;
		u32 acquire;
		u32 release;
	} sema;

	struct {
166 167 168 169 170 171
		u32 handle;
		struct {
			u64 offset:40;
			u8  buffer:1;
			u8  enable:2;
			u8  mode:4;
172 173 174
			u8  size:2;
			u8  range:2;
			u8  output_mode:2;
175 176
		} i;
	} xlut;
177 178 179 180 181

	struct {
		u8  mode:2;
		u8  interval:4;

182
		u8  colorspace:2;
183 184 185
		u8  format;
		u8  kind:7;
		u8  layout:1;
186 187
		u8  blockh:4;
		u16 blocks[3];
188
		u32 pitch[3];
189 190 191
		u16 w;
		u16 h;

192 193
		u32 handle[6];
		u64 offset[6];
194 195
	} image;

196 197 198 199 200 201 202 203 204
	struct {
		u16 sx;
		u16 sy;
		u16 sw;
		u16 sh;
		u16 dw;
		u16 dh;
	} scale;

205 206 207 208 209
	struct {
		u16 x;
		u16 y;
	} point;

210
	union nv50_wndw_atom_mask {
211 212 213
		struct {
			bool ntfy:1;
			bool sema:1;
214
			bool xlut:1;
215
			bool image:1;
216
			bool scale:1;
217 218 219
			bool point:1;
		};
		u8 mask;
220
	} set, clr;
221 222
};
#endif