xref: /OK3568_Linux_fs/kernel/drivers/gpu/drm/nouveau/nouveau_crtc.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (C) 2008 Maarten Maathuis.
3*4882a593Smuzhiyun  * All Rights Reserved.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining
6*4882a593Smuzhiyun  * a copy of this software and associated documentation files (the
7*4882a593Smuzhiyun  * "Software"), to deal in the Software without restriction, including
8*4882a593Smuzhiyun  * without limitation the rights to use, copy, modify, merge, publish,
9*4882a593Smuzhiyun  * distribute, sublicense, and/or sell copies of the Software, and to
10*4882a593Smuzhiyun  * permit persons to whom the Software is furnished to do so, subject to
11*4882a593Smuzhiyun  * the following conditions:
12*4882a593Smuzhiyun  *
13*4882a593Smuzhiyun  * The above copyright notice and this permission notice (including the
14*4882a593Smuzhiyun  * next paragraph) shall be included in all copies or substantial
15*4882a593Smuzhiyun  * portions of the Software.
16*4882a593Smuzhiyun  *
17*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18*4882a593Smuzhiyun  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19*4882a593Smuzhiyun  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20*4882a593Smuzhiyun  * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21*4882a593Smuzhiyun  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22*4882a593Smuzhiyun  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23*4882a593Smuzhiyun  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24*4882a593Smuzhiyun  *
25*4882a593Smuzhiyun  */
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun #ifndef __NOUVEAU_CRTC_H__
28*4882a593Smuzhiyun #define __NOUVEAU_CRTC_H__
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun #include <drm/drm_crtc.h>
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #include <nvif/notify.h>
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun struct nouveau_crtc {
35*4882a593Smuzhiyun 	struct drm_crtc base;
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun 	int index;
38*4882a593Smuzhiyun 	struct nvif_notify vblank;
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun 	uint32_t dpms_saved_fp_control;
41*4882a593Smuzhiyun 	uint32_t fp_users;
42*4882a593Smuzhiyun 	int saturation;
43*4882a593Smuzhiyun 	int sharpness;
44*4882a593Smuzhiyun 	int last_dpms;
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun 	int cursor_saved_x, cursor_saved_y;
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun 	struct {
49*4882a593Smuzhiyun 		int cpp;
50*4882a593Smuzhiyun 		bool blanked;
51*4882a593Smuzhiyun 		uint32_t offset;
52*4882a593Smuzhiyun 		uint32_t handle;
53*4882a593Smuzhiyun 	} fb;
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun 	struct {
56*4882a593Smuzhiyun 		struct nouveau_bo *nvbo;
57*4882a593Smuzhiyun 		uint32_t offset;
58*4882a593Smuzhiyun 		void (*set_offset)(struct nouveau_crtc *, uint32_t offset);
59*4882a593Smuzhiyun 		void (*set_pos)(struct nouveau_crtc *, int x, int y);
60*4882a593Smuzhiyun 		void (*hide)(struct nouveau_crtc *, bool update);
61*4882a593Smuzhiyun 		void (*show)(struct nouveau_crtc *, bool update);
62*4882a593Smuzhiyun 	} cursor;
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun 	struct {
65*4882a593Smuzhiyun 		int depth;
66*4882a593Smuzhiyun 	} lut;
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun 	void (*save)(struct drm_crtc *crtc);
69*4882a593Smuzhiyun 	void (*restore)(struct drm_crtc *crtc);
70*4882a593Smuzhiyun };
71*4882a593Smuzhiyun 
nouveau_crtc(struct drm_crtc * crtc)72*4882a593Smuzhiyun static inline struct nouveau_crtc *nouveau_crtc(struct drm_crtc *crtc)
73*4882a593Smuzhiyun {
74*4882a593Smuzhiyun 	return crtc ? container_of(crtc, struct nouveau_crtc, base) : NULL;
75*4882a593Smuzhiyun }
76*4882a593Smuzhiyun 
to_drm_crtc(struct nouveau_crtc * crtc)77*4882a593Smuzhiyun static inline struct drm_crtc *to_drm_crtc(struct nouveau_crtc *crtc)
78*4882a593Smuzhiyun {
79*4882a593Smuzhiyun 	return &crtc->base;
80*4882a593Smuzhiyun }
81*4882a593Smuzhiyun 
82*4882a593Smuzhiyun int nv04_cursor_init(struct nouveau_crtc *);
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun #endif /* __NOUVEAU_CRTC_H__ */
85