diff options
author | Jakob Bornecrantz <wallbraker@gmail.com> | 2009-03-03 03:24:31 +0100 |
---|---|---|
committer | Jakob Bornecrantz <wallbraker@gmail.com> | 2009-03-03 03:24:31 +0100 |
commit | 72cf6e8e92e49753472e760b1cf4575327b48f43 (patch) | |
tree | 1f338ac27f73b1978b843329fb270d3f55163a86 | |
parent | 4a1b8cbab8dc779d98830ba86e2d3d25f8545987 (diff) |
intel: Add Xorg driver
-rw-r--r-- | src/gallium/winsys/drm/intel/xorg/Makefile | 42 | ||||
-rw-r--r-- | src/gallium/winsys/drm/intel/xorg/intel_xorg.c | 156 |
2 files changed, 198 insertions, 0 deletions
diff --git a/src/gallium/winsys/drm/intel/xorg/Makefile b/src/gallium/winsys/drm/intel/xorg/Makefile new file mode 100644 index 00000000000..8130fdb2265 --- /dev/null +++ b/src/gallium/winsys/drm/intel/xorg/Makefile | |||
@@ -0,0 +1,42 @@ | |||
1 | TARGET = modesetting_drv.so | ||
2 | CFILES = $(wildcard ./*.c) | ||
3 | OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES)) | ||
4 | GALLIUMDIR = ../../../.. | ||
5 | TOP = ../../../../../.. | ||
6 | |||
7 | include ${TOP}/configs/current | ||
8 | |||
9 | CFLAGS = -DHAVE_CONFIG_H \ | ||
10 | -g -Wall -Wimplicit-function-declaration -fPIC \ | ||
11 | $(shell pkg-config --cflags pixman-1 xorg-server libdrm xproto) \ | ||
12 | -I../gem \ | ||
13 | -I${GALLIUMDIR}/include \ | ||
14 | -I${GALLIUMDIR}/drivers \ | ||
15 | -I${GALLIUMDIR}/auxiliary \ | ||
16 | -I${TOP}/src/mesa \ | ||
17 | -I$(TOP)/include \ | ||
18 | -I$(TOP)/src/egl/main | ||
19 | |||
20 | LIBS = \ | ||
21 | $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a \ | ||
22 | $(GALLIUMDIR)/winsys/drm/intel/gem/libinteldrm.a \ | ||
23 | $(TOP)/src/gallium/drivers/i915simple/libi915simple.a \ | ||
24 | $(GALLIUM_AUXILIARIES) | ||
25 | |||
26 | ############################################# | ||
27 | |||
28 | |||
29 | |||
30 | all default: $(TARGET) | ||
31 | |||
32 | $(TARGET): $(OBJECTS) Makefile $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a | ||
33 | $(TOP)/bin/mklib -noprefix -o $@ \ | ||
34 | $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_intel | ||
35 | |||
36 | clean: | ||
37 | rm -rf $(OBJECTS) $(TARGET) | ||
38 | |||
39 | install: | ||
40 | cp $(TARGET) /opt/kms/lib/xorg/modules/drivers | ||
41 | |||
42 | .PHONY = all clean install | ||
diff --git a/src/gallium/winsys/drm/intel/xorg/intel_xorg.c b/src/gallium/winsys/drm/intel/xorg/intel_xorg.c new file mode 100644 index 00000000000..aea39247e51 --- /dev/null +++ b/src/gallium/winsys/drm/intel/xorg/intel_xorg.c | |||
@@ -0,0 +1,156 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. | ||
3 | * All Rights Reserved. | ||
4 | * | ||
5 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
6 | * 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, sub license, 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: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice (including the | ||
14 | * next paragraph) shall be included in all copies or substantial portions | ||
15 | * of the Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
20 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
21 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
24 | * | ||
25 | * | ||
26 | * Author: Alan Hourihane <alanh@tungstengraphics.com> | ||
27 | * Author: Jakob Bornecrantz <wallbraker@gmail.com> | ||
28 | * | ||
29 | */ | ||
30 | |||
31 | #include "../../../../state_trackers/xorg/xorg_winsys.h" | ||
32 | |||
33 | static void intel_xorg_identify(int flags); | ||
34 | static Bool intel_xorg_pci_probe(DriverPtr driver, | ||
35 | int entity_num, | ||
36 | struct pci_device *device, | ||
37 | intptr_t match_data); | ||
38 | |||
39 | static const struct pci_id_match intel_xorg_device_match[] = { | ||
40 | {0x8086, 0x2592, 0xffff, 0xffff, 0, 0, 0}, | ||
41 | {0x8086, 0x27A2, 0xffff, 0xffff, 0, 0, 0}, | ||
42 | {0, 0, 0}, | ||
43 | }; | ||
44 | |||
45 | static SymTabRec intel_xorg_chipsets[] = { | ||
46 | {0x2592, "Intel Graphics Device"}, | ||
47 | {0x27A2, "Intel Graphics Device"}, | ||
48 | {-1, NULL} | ||
49 | }; | ||
50 | |||
51 | static PciChipsets intel_xorg_pci_devices[] = { | ||
52 | {0x2592, 0x2592, RES_SHARED_VGA}, | ||
53 | {0x27A2, 0x27A2, RES_SHARED_VGA}, | ||
54 | {-1, -1, RES_UNDEFINED} | ||
55 | }; | ||
56 | |||
57 | static XF86ModuleVersionInfo intel_xorg_version = { | ||
58 | "modesetting", | ||
59 | MODULEVENDORSTRING, | ||
60 | MODINFOSTRING1, | ||
61 | MODINFOSTRING2, | ||
62 | XORG_VERSION_CURRENT, | ||
63 | 0, 1, 0, /* major, minor, patch */ | ||
64 | ABI_CLASS_VIDEODRV, | ||
65 | ABI_VIDEODRV_VERSION, | ||
66 | MOD_CLASS_VIDEODRV, | ||
67 | {0, 0, 0, 0} | ||
68 | }; | ||
69 | |||
70 | /* | ||
71 | * Xorg driver exported structures | ||
72 | */ | ||
73 | |||
74 | _X_EXPORT DriverRec modesetting = { | ||
75 | 1, | ||
76 | "modesetting", | ||
77 | intel_xorg_identify, | ||
78 | NULL, | ||
79 | xorg_tracker_available_options, | ||
80 | NULL, | ||
81 | 0, | ||
82 | NULL, | ||
83 | intel_xorg_device_match, | ||
84 | intel_xorg_pci_probe | ||
85 | }; | ||
86 | |||
87 | static MODULESETUPPROTO(intel_xorg_setup); | ||
88 | |||
89 | _X_EXPORT XF86ModuleData modesettingModuleData = { | ||
90 | &intel_xorg_version, | ||
91 | intel_xorg_setup, | ||
92 | NULL | ||
93 | }; | ||
94 | |||
95 | /* | ||
96 | * Xorg driver functions | ||
97 | */ | ||
98 | |||
99 | static pointer | ||
100 | intel_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin) | ||
101 | { | ||
102 | static Bool setupDone = 0; | ||
103 | |||
104 | /* This module should be loaded only once, but check to be sure. | ||
105 | */ | ||
106 | if (!setupDone) { | ||
107 | setupDone = 1; | ||
108 | xf86AddDriver(&modesetting, module, HaveDriverFuncs); | ||
109 | |||
110 | /* | ||
111 | * Tell the loader about symbols from other modules that this module | ||
112 | * might refer to. | ||
113 | */ | ||
114 | xorg_tracker_loader_ref_sym_lists(); | ||
115 | |||
116 | /* | ||
117 | * The return value must be non-NULL on success even though there | ||
118 | * is no TearDownProc. | ||
119 | */ | ||
120 | return (pointer) 1; | ||
121 | } else { | ||
122 | if (errmaj) | ||
123 | *errmaj = LDR_ONCEONLY; | ||
124 | return NULL; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | static void | ||
129 | intel_xorg_identify(int flags) | ||
130 | { | ||
131 | xf86PrintChipsets("modesetting", "Driver for Modesetting Kernel Drivers", | ||
132 | intel_xorg_chipsets); | ||
133 | } | ||
134 | |||
135 | static Bool | ||
136 | intel_xorg_pci_probe(DriverPtr driver, | ||
137 | int entity_num, struct pci_device *device, intptr_t match_data) | ||
138 | { | ||
139 | ScrnInfoPtr scrn = NULL; | ||
140 | EntityInfoPtr entity; | ||
141 | |||
142 | scrn = xf86ConfigPciEntity(scrn, 0, entity_num, intel_xorg_pci_devices, | ||
143 | NULL, NULL, NULL, NULL, NULL); | ||
144 | if (scrn != NULL) { | ||
145 | scrn->driverVersion = 1; | ||
146 | scrn->driverName = "modesetting"; | ||
147 | scrn->name = "modesetting"; | ||
148 | scrn->Probe = NULL; | ||
149 | |||
150 | entity = xf86GetEntityInfo(entity_num); | ||
151 | |||
152 | /* Use all the functions from the xorg tracker */ | ||
153 | xorg_tracker_set_functions(scrn); | ||
154 | } | ||
155 | return scrn != NULL; | ||
156 | } | ||