2 * Mesa 3-D graphics library
5 * Copyright (C) 2010 Chia-I Wu <olv@0xlab.org>
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
26 #ifndef _NATIVE_DRM_H_
27 #define _NATIVE_DRM_H_
30 #include <xf86drmMode.h>
32 #include "pipe/p_compiler.h"
33 #include "util/u_format.h"
34 #include "pipe/p_state.h"
35 #include "state_tracker/drm_driver.h"
37 #include "common/native.h"
38 #include "common/native_helper.h"
47 struct native_display base
;
49 struct native_event_handler
*event_handler
;
52 struct drm_config
*config
;
55 drmModeResPtr resources
;
56 struct drm_connector
*connectors
;
59 struct drm_surface
**shown_surfaces
;
60 /* save the original settings of the CRTCs */
61 struct drm_crtc
*saved_crtcs
;
65 struct native_config base
;
70 uint32_t connectors
[32];
74 struct drm_framebuffer
{
75 struct pipe_resource
*texture
;
82 struct native_surface base
;
83 struct drm_display
*drmdpy
;
85 struct resource_surface
*rsurf
;
86 enum pipe_format color_format
;
89 unsigned int sequence_number
;
90 struct drm_framebuffer front_fb
, back_fb
;
93 struct drm_crtc current_crtc
;
95 boolean have_pageflip
;
98 struct drm_connector
{
99 struct native_connector base
;
101 uint32_t connector_id
;
102 drmModeConnectorPtr connector
;
103 struct drm_mode
*drm_modes
;
108 struct native_mode base
;
109 drmModeModeInfo mode
;
112 static INLINE
struct drm_display
*
113 drm_display(const struct native_display
*ndpy
)
115 return (struct drm_display
*) ndpy
;
118 static INLINE
struct drm_config
*
119 drm_config(const struct native_config
*nconf
)
121 return (struct drm_config
*) nconf
;
124 static INLINE
struct drm_surface
*
125 drm_surface(const struct native_surface
*nsurf
)
127 return (struct drm_surface
*) nsurf
;
130 static INLINE
struct drm_connector
*
131 drm_connector(const struct native_connector
*nconn
)
133 return (struct drm_connector
*) nconn
;
136 static INLINE
struct drm_mode
*
137 drm_mode(const struct native_mode
*nmode
)
139 return (struct drm_mode
*) nmode
;
143 drm_display_init_modeset(struct native_display
*ndpy
);
146 drm_display_fini_modeset(struct native_display
*ndpy
);
148 #endif /* _NATIVE_DRM_H_ */