drm/ffi/
drm_mode.rs

1/*
2 * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
3 * Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com>
4 * Copyright (c) 2008 Red Hat Inc.
5 * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
6 * Copyright (c) 2007-2008 Intel Corporation
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * IN THE SOFTWARE.
25 */
26
27use libc::*;
28
29pub const DRM_DISPLAY_INFO_LEN: c_int = 32;
30pub const DRM_CONNECTOR_NAME_LEN: c_int = 32;
31pub const DRM_DISPLAY_MODE_LEN: c_int = 32;
32pub const DRM_PROP_NAME_LEN: c_int = 32;
33
34pub const DRM_MODE_TYPE_BUILTIN: c_int = (1<<0);
35pub const DRM_MODE_TYPE_CLOCK_C: c_int = ((1<<1) | DRM_MODE_TYPE_BUILTIN);
36pub const DRM_MODE_TYPE_CRTC_C: c_int = ((1<<2) | DRM_MODE_TYPE_BUILTIN);
37pub const DRM_MODE_TYPE_PREFERRED: c_int = (1<<3);
38pub const DRM_MODE_TYPE_DEFAULT: c_int = (1<<4);
39pub const DRM_MODE_TYPE_USERDEF: c_int = (1<<5);
40pub const DRM_MODE_TYPE_DRIVER: c_int = (1<<6);
41
42/* Video mode flags */
43/* bit compatible with the xorg definitions. */
44pub const DRM_MODE_FLAG_PHSYNC: c_int = (1<<0);
45pub const DRM_MODE_FLAG_NHSYNC: c_int = (1<<1);
46pub const DRM_MODE_FLAG_PVSYNC: c_int = (1<<2);
47pub const DRM_MODE_FLAG_NVSYNC: c_int = (1<<3);
48pub const DRM_MODE_FLAG_INTERLACE: c_int = (1<<4);
49pub const DRM_MODE_FLAG_DBLSCAN: c_int = (1<<5);
50pub const DRM_MODE_FLAG_CSYNC: c_int = (1<<6);
51pub const DRM_MODE_FLAG_PCSYNC: c_int = (1<<7);
52pub const DRM_MODE_FLAG_NCSYNC: c_int = (1<<8);
53pub const DRM_MODE_FLAG_HSKEW: c_int = (1<<9); /* hskew provided */
54pub const DRM_MODE_FLAG_BCAST: c_int = (1<<10);
55pub const DRM_MODE_FLAG_PIXMUX: c_int = (1<<11);
56pub const DRM_MODE_FLAG_DBLCLK: c_int = (1<<12);
57pub const DRM_MODE_FLAG_CLKDIV2: c_int = (1<<13);
58 /*
59  * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX
60  * (define not exposed to user space).
61  */
62pub const DRM_MODE_FLAG_3D_MASK: c_int = (0x1f<<14);
63pub const DRM_MODE_FLAG_3D_NONE: c_int = (0<<14);
64pub const DRM_MODE_FLAG_3D_FRAME_PACKING: c_int = (1<<14);
65pub const DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE: c_int = (2<<14);
66pub const DRM_MODE_FLAG_3D_LINE_ALTERNATIVE: c_int = (3<<14);
67pub const DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL: c_int = (4<<14);
68pub const DRM_MODE_FLAG_3D_L_DEPTH: c_int = (5<<14);
69pub const DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH: c_int = (6<<14);
70pub const DRM_MODE_FLAG_3D_TOP_AND_BOTTOM: c_int = (7<<14);
71pub const DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF: c_int = (8<<14);
72
73
74/* DPMS flags */
75/* bit compatible with the xorg definitions. */
76pub const DRM_MODE_DPMS_ON: c_int = 0;
77pub const DRM_MODE_DPMS_STANDBY: c_int = 1;
78pub const DRM_MODE_DPMS_SUSPEND: c_int = 2;
79pub const DRM_MODE_DPMS_OFF: c_int = 3;
80
81/* Scaling mode options */
82pub const DRM_MODE_SCALE_NONE: c_int = 0; /* Unmodified timing (display or
83					     software can still scale) */
84pub const DRM_MODE_SCALE_FULLSCREEN: c_int = 1; /* Full screen, ignore aspect */
85pub const DRM_MODE_SCALE_CENTER: c_int = 2; /* Centered, no scaling */
86pub const DRM_MODE_SCALE_ASPECT: c_int = 3; /* Full screen, preserve aspect */
87
88/* Picture aspect ratio options */
89pub const DRM_MODE_PICTURE_ASPECT_NONE: c_int = 0;
90pub const DRM_MODE_PICTURE_ASPECT_4_3: c_int = 1;
91pub const DRM_MODE_PICTURE_ASPECT_16_9: c_int = 2;
92
93/* Dithering mode options */
94pub const DRM_MODE_DITHERING_OFF: c_int = 0;
95pub const DRM_MODE_DITHERING_ON: c_int = 1;
96pub const DRM_MODE_DITHERING_AUTO: c_int = 2;
97
98/* Dirty info options */
99pub const DRM_MODE_DIRTY_OFF: c_int = 0;
100pub const DRM_MODE_DIRTY_ON: c_int = 1;
101pub const DRM_MODE_DIRTY_ANNOTATE: c_int = 2;
102
103#[repr(C)]
104pub struct drm_mode_property_enum {
105	value: u64,
106	name: [c_char; DRM_PROP_NAME_LEN as usize]
107}
108impl ::std::default::Default for drm_mode_property_enum {
109    fn default() -> drm_mode_property_enum { unsafe { ::std::mem::zeroed() } }
110}
111
112#[repr(C)]
113pub struct drm_mode_create_dumb {
114    pub height: u32,
115    pub width: u32,
116    pub bpp: u32,
117    pub flags: u32,
118    /* handle, pitch, size will be returned */
119    pub handle: u32,
120    pub pitch: u32,
121    pub size: u64
122}
123impl ::std::default::Default for drm_mode_create_dumb {
124    fn default() -> drm_mode_create_dumb { unsafe { ::std::mem::zeroed() } }
125}
126
127/* set up for mmap of a dumb scanout buffer */
128#[repr(C)]
129pub struct drm_mode_map_dumb {
130    /** Handle for the object being mapped. */
131    pub handle: u32,
132    pub pad: u32,
133    /**
134    * Fake offset to use for subsequent mmap call
135    *
136    * This is a fixed-size type for 32/64 compatibility.
137    */
138    pub offset: u64
139}
140impl ::std::default::Default for drm_mode_map_dumb {
141    fn default() -> drm_mode_map_dumb { unsafe { ::std::mem::zeroed() } }
142}
143
144#[repr(C)]
145pub struct drm_mode_destroy_dumb {
146    pub handle: u32
147}
148impl ::std::default::Default for drm_mode_destroy_dumb {
149    fn default() -> drm_mode_destroy_dumb { unsafe { ::std::mem::zeroed() } }
150}
151