2 * Copyright (C) 2008 Maarten Maathuis.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #ifndef __NV50_KMS_WRAPPER_H__
28 #define __NV50_KMS_WRAPPER_H__
33 #include "nv50_display.h"
34 #include "nv50_crtc.h"
35 #include "nv50_cursor.h"
38 #include "nv50_output.h"
39 #include "nv50_connector.h"
44 /* Link internal modesetting structure to interface. */
46 struct nv50_kms_crtc {
47 struct list_head item;
49 struct nv50_crtc priv;
53 struct nv50_kms_encoder {
54 struct list_head item;
56 struct nv50_output priv;
57 struct drm_encoder pub;
60 struct nv50_kms_connector {
61 struct list_head item;
63 struct nv50_connector priv;
64 struct drm_connector pub;
67 struct nv50_kms_priv {
68 struct list_head crtcs;
69 struct list_head encoders;
70 struct list_head connectors;
73 /* Get private functions. */
74 #define from_nv50_kms_crtc(x) container_of(x, struct nv50_kms_crtc, pub)
75 #define from_nv50_crtc(x) container_of(x, struct nv50_kms_crtc, priv)
76 #define from_nv50_kms_encoder(x) container_of(x, struct nv50_kms_encoder, pub)
77 #define from_nv50_output(x) container_of(x, struct nv50_kms_encoder, priv)
78 #define from_nv50_kms_connector(x) container_of(x, struct nv50_kms_connector, pub)
79 #define from_nv50_connector(x) container_of(x, struct nv50_kms_connector, priv)
81 #define to_nv50_crtc(x) (&(from_nv50_kms_crtc(x)->priv))
82 #define to_nv50_kms_crtc(x) (&(from_nv50_crtc(x)->pub))
83 #define to_nv50_output(x) (&(from_nv50_kms_encoder(x)->priv))
84 #define to_nv50_kms_encoder(x) (&(from_nv50_output(x)->pub))
85 #define to_nv50_connector(x) (&(from_nv50_kms_connector(x)->priv))
86 #define to_nv50_kms_connector(x) (&(from_nv50_connector(x)->pub))
88 struct nv50_kms_priv *nv50_get_kms_priv(struct drm_device *dev);
89 void nv50_kms_connector_detect_all(struct drm_device *dev);
90 bool nv50_kms_connector_get_digital(struct drm_connector *drm_connector);
92 int nv50_kms_init(struct drm_device *dev);
93 int nv50_kms_destroy(struct drm_device *dev);
95 #endif /* __NV50_KMS_WRAPPER_H__ */