1 /**********************************************************
2 * Copyright 2008-2009 VMware, Inc. All rights reserved.
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 **********************************************************/
28 * Glue file for Xorg State Tracker.
30 * @author Alan Hourihane <alanh@tungstengraphics.com>
31 * @author Jakob Bornecrantz <wallbraker@gmail.com>
41 #define VMWGFX_DRIVER_NAME "vmwgfx"
43 #define VMW_STRING_INNER(s) #s
44 #define VMW_STRING(str) VMW_STRING_INNER(str)
46 #define VMWGFX_VERSION_MAJOR 11
47 #define VMWGFX_VERSION_MINOR 0
48 #define VMWGFX_VERSION_PATCH 0
49 #define VMWGFX_VERSION_STRING_MAJOR VMW_STRING(VMWGFX_VERSION_MAJOR)
50 #define VMWGFX_VERSION_STRING_MINOR VMW_STRING(VMWGFX_VERSION_MINOR)
51 #define VMWGFX_VERSION_STRING_PATCH VMW_STRING(VMWGFX_VERSION_PATCH)
53 #define VMWGFX_DRIVER_VERSION \
54 (VMWGFX_VERSION_MAJOR * 65536 + VMWGFX_VERSION_MINOR * 256 + VMWGFX_VERSION_PATCH)
55 #define VMWGFX_DRIVER_VERSION_STRING \
56 VMWGFX_VERSION_STRING_MAJOR "." VMWGFX_VERSION_STRING_MINOR \
57 "." VMWGFX_VERSION_STRING_PATCH
60 * Standard four digit version string expected by VMware Tools installer.
61 * As the driver's version is only {major, minor, patchlevel}, simply append an
62 * extra zero for the fourth digit.
65 _X_EXPORT
const char vmwgfx_drv_modinfo
[] __attribute__((section(".modinfo"),unused
)) =
66 "version=" VMWGFX_DRIVER_VERSION_STRING
".0";
69 static void vmw_xorg_identify(int flags
);
70 _X_EXPORT Bool
vmw_xorg_pci_probe(DriverPtr driver
,
72 struct pci_device
*device
,
80 static const struct pci_id_match vmw_xorg_device_match
[] = {
81 {0x15ad, PCI_MATCH_ANY
, PCI_MATCH_ANY
, PCI_MATCH_ANY
, 0, 0, 0},
82 {0, 0, 0, 0, 0, 0, 0},
85 static SymTabRec vmw_xorg_chipsets
[] = {
86 {PCI_MATCH_ANY
, "VMware SVGA Device"},
90 static PciChipsets vmw_xorg_pci_devices
[] = {
91 {PCI_MATCH_ANY
, PCI_MATCH_ANY
, NULL
},
95 static XF86ModuleVersionInfo vmw_xorg_version
= {
100 XORG_VERSION_CURRENT
,
101 VMWGFX_VERSION_MAJOR
, VMWGFX_VERSION_MINOR
, VMWGFX_VERSION_PATCH
,
103 ABI_VIDEODRV_VERSION
,
109 * Xorg driver exported structures
112 _X_EXPORT DriverRec vmwgfx
= {
117 xorg_tracker_available_options
,
121 vmw_xorg_device_match
,
125 static MODULESETUPPROTO(vmw_xorg_setup
);
127 _X_EXPORT XF86ModuleData vmwgfxModuleData
= {
135 * Xorg driver functions
139 vmw_xorg_setup(pointer module
, pointer opts
, int *errmaj
, int *errmin
)
141 static Bool setupDone
= 0;
143 /* This module should be loaded only once, but check to be sure.
147 xf86AddDriver(&vmwgfx
, module
, HaveDriverFuncs
);
150 * The return value must be non-NULL on success even though there
151 * is no TearDownProc.
156 *errmaj
= LDR_ONCEONLY
;
162 vmw_xorg_identify(int flags
)
164 xf86PrintChipsets("vmwgfx", "Driver for VMware SVGA device",
169 vmw_xorg_pci_probe(DriverPtr driver
,
170 int entity_num
, struct pci_device
*device
, intptr_t match_data
)
172 ScrnInfoPtr scrn
= NULL
;
173 EntityInfoPtr entity
;
175 scrn
= xf86ConfigPciEntity(scrn
, 0, entity_num
, vmw_xorg_pci_devices
,
176 NULL
, NULL
, NULL
, NULL
, NULL
);
178 scrn
->driverVersion
= 1;
179 scrn
->driverName
= "vmwgfx";
180 scrn
->name
= "vmwgfx";
183 entity
= xf86GetEntityInfo(entity_num
);
185 /* Use all the functions from the xorg tracker */
186 xorg_tracker_set_functions(scrn
);
188 vmw_screen_set_functions(scrn
);