summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2008-04-18 19:01:06 -0400
committerAdam Jackson <ajax@redhat.com>2008-04-18 19:01:06 -0400
commit13adef8a17d8815f4db2aaac30ae04438e125343 (patch)
tree452c1dcb0c48f489deef36a51fbe25b71282c2c1
parenteafaf40fb3368ca7e4cf48336fdb7a6c9f536bfa (diff)
Finish deleting EVI
-rw-r--r--Xext/EVI.c200
-rw-r--r--Xext/sampleEVI.c123
2 files changed, 0 insertions, 323 deletions
diff --git a/Xext/EVI.c b/Xext/EVI.c
deleted file mode 100644
index a637bae5d..000000000
--- a/Xext/EVI.c
+++ /dev/null
@@ -1,200 +0,0 @@
1/************************************************************
2Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
3Permission to use, copy, modify, and distribute this
4software and its documentation for any purpose and without
5fee is hereby granted, provided that the above copyright
6notice appear in all copies and that both that copyright
7notice and this permission notice appear in supporting
8documentation, and that the name of Silicon Graphics not be
9used in advertising or publicity pertaining to distribution
10of the software without specific prior written permission.
11Silicon Graphics makes no representation about the suitability
12of this software for any purpose. It is provided "as is"
13without any express or implied warranty.
14SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
15SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
17GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
18DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
20OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
21THE USE OR PERFORMANCE OF THIS SOFTWARE.
22********************************************************/
23
24#ifdef HAVE_DIX_CONFIG_H
25#include <dix-config.h>
26#endif
27
28#include <X11/X.h>
29#include <X11/Xproto.h>
30#include "dixstruct.h"
31#include "extnsionst.h"
32#include "dix.h"
33#define _XEVI_SERVER_
34#include <X11/extensions/XEVIstr.h>
35#include "EVIstruct.h"
36#include "modinit.h"
37#include "scrnintstr.h"
38
39static EviPrivPtr eviPriv;
40
41static int
42ProcEVIQueryVersion(ClientPtr client)
43{
44 /* REQUEST(xEVIQueryVersionReq); */
45 xEVIQueryVersionReply rep;
46 register int n;
47 REQUEST_SIZE_MATCH (xEVIQueryVersionReq);
48 rep.type = X_Reply;
49 rep.length = 0;
50 rep.sequenceNumber = client->sequence;
51 rep.majorVersion = XEVI_MAJOR_VERSION;
52 rep.minorVersion = XEVI_MAJOR_VERSION;
53 if (client->swapped) {
54 swaps(&rep.sequenceNumber, n);
55 swapl(&rep.length, n);
56 swaps(&rep.majorVersion, n);
57 swaps(&rep.minorVersion, n);
58 }
59 WriteToClient(client, sizeof (xEVIQueryVersionReply), (char *)&rep);
60 return (client->noClientException);
61}
62#define swapEviInfo(eviInfo, l) \
63{ \
64 int l1 = l; \
65 xExtendedVisualInfo *eviInfo1 = eviInfo; \
66 while (l1-- > 0) { \
67 swapl(&eviInfo1->core_visual_id, n); \
68 swapl(&eviInfo1->transparency_value, n); \
69 swaps(&eviInfo1->num_colormap_conflicts, n); \
70 eviInfo1++; \
71 } \
72}
73#define swapVisual(visual, l) \
74{ \
75 int l1 = l; \
76 VisualID32 *visual1 = visual; \
77 while (l1-- > 0) { \
78 swapl(visual1, n); \
79 visual1++; \
80 } \
81}
82
83static int
84ProcEVIGetVisualInfo(ClientPtr client)
85{
86 REQUEST(xEVIGetVisualInfoReq);
87 xEVIGetVisualInfoReply rep;
88 int i, n, n_conflict, n_info, sz_info, sz_conflict;
89 VisualID32 *conflict;
90 unsigned int total_visuals = 0;
91 xExtendedVisualInfo *eviInfo;
92 int status;
93
94 /*
95 * do this first, otherwise REQUEST_FIXED_SIZE can overflow. we assume
96 * here that you don't have more than 2^32 visuals over all your screens;
97 * this seems like a safe assumption.
98 */
99 for (i = 0; i < screenInfo.numScreens; i++)
100 total_visuals += screenInfo.screens[i]->numVisuals;
101 if (stuff->n_visual > total_visuals)
102 return BadValue;
103
104 REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
105 status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
106 &eviInfo, &n_info, &conflict, &n_conflict);
107 if (status != Success)
108 return status;
109 sz_info = n_info * sz_xExtendedVisualInfo;
110 sz_conflict = n_conflict * sz_VisualID32;
111 rep.type = X_Reply;
112 rep.n_info = n_info;
113 rep.n_conflicts = n_conflict;
114 rep.sequenceNumber = client->sequence;
115 rep.length = (sz_info + sz_conflict) >> 2;
116 if (client->swapped) {
117 swaps(&rep.sequenceNumber, n);
118 swapl(&rep.length, n);
119 swapl(&rep.n_info, n);
120 swapl(&rep.n_conflicts, n);
121 swapEviInfo(eviInfo, n_info);
122 swapVisual(conflict, n_conflict);
123 }
124 WriteToClient(client, sz_xEVIGetVisualInfoReply, (char *)&rep);
125 WriteToClient(client, sz_info, (char *)eviInfo);
126 WriteToClient(client, sz_conflict, (char *)conflict);
127 eviPriv->freeVisualInfo(eviInfo, conflict);
128 return (client->noClientException);
129}
130
131static int
132ProcEVIDispatch(ClientPtr client)
133{
134 REQUEST(xReq);
135 switch (stuff->data) {
136 case X_EVIQueryVersion:
137 return ProcEVIQueryVersion (client);
138 case X_EVIGetVisualInfo:
139 return ProcEVIGetVisualInfo (client);
140 default:
141 return BadRequest;
142 }
143}
144
145static int
146SProcEVIQueryVersion(ClientPtr client)
147{
148 REQUEST(xEVIQueryVersionReq);
149 int n;
150 swaps(&stuff->length, n);
151 return ProcEVIQueryVersion(client);
152}
153
154static int
155SProcEVIGetVisualInfo(ClientPtr client)
156{
157 register int n;
158 REQUEST(xEVIGetVisualInfoReq);
159 swaps(&stuff->length, n);
160 return ProcEVIGetVisualInfo(client);
161}
162
163static int
164SProcEVIDispatch(ClientPtr client)
165{
166 REQUEST(xReq);
167 switch (stuff->data)
168 {
169 case X_EVIQueryVersion:
170 return SProcEVIQueryVersion (client);
171 case X_EVIGetVisualInfo:
172 return SProcEVIGetVisualInfo (client);
173 default:
174 return BadRequest;
175 }
176}
177
178/*ARGSUSED*/
179static void
180EVIResetProc(ExtensionEntry *extEntry)
181{
182 eviDDXReset();
183}
184
185/****************
186 * XEVIExtensionInit
187 *
188 * Called from InitExtensions in main() or from QueryExtension() if the
189 * extension is dynamically loaded.
190 *
191 ****************/
192void
193EVIExtensionInit(INITARGS)
194{
195 if (AddExtension(EVINAME, 0, 0,
196 ProcEVIDispatch, SProcEVIDispatch,
197 EVIResetProc, StandardMinorOpcode)) {
198 eviPriv = eviDDXInit();
199 }
200}
diff --git a/Xext/sampleEVI.c b/Xext/sampleEVI.c
deleted file mode 100644
index b871bfd74..000000000
--- a/Xext/sampleEVI.c
+++ /dev/null
@@ -1,123 +0,0 @@
1/************************************************************
2Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
3Permission to use, copy, modify, and distribute this
4software and its documentation for any purpose and without
5fee is hereby granted, provided that the above copyright
6notice appear in all copies and that both that copyright
7notice and this permission notice appear in supporting
8documentation, and that the name of Silicon Graphics not be
9used in advertising or publicity pertaining to distribution
10of the software without specific prior written permission.
11Silicon Graphics makes no representation about the suitability
12of this software for any purpose. It is provided "as is"
13without any express or implied warranty.
14SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
15SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
17GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
18DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
20OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
21THE USE OR PERFORMANCE OF THIS SOFTWARE.
22********************************************************/
23
24#ifdef HAVE_DIX_CONFIG_H
25#include <dix-config.h>
26#endif
27
28#include <X11/X.h>
29#include <X11/Xproto.h>
30#include "dixstruct.h"
31#include "extnsionst.h"
32#include "dix.h"
33#define _XEVI_SERVER_
34#include <X11/extensions/XEVIstr.h>
35#include "EVIstruct.h"
36#include "scrnintstr.h"
37
38#if HAVE_STDINT_H
39#include <stdint.h>
40#elif !defined(UINT32_MAX)
41#define UINT32_MAX 0xffffffffU
42#endif
43
44static int sampleGetVisualInfo(
45 VisualID32 *visual,
46 int n_visual,
47 xExtendedVisualInfo **evi_rn,
48 int *n_info_rn,
49 VisualID32 **conflict_rn,
50 int *n_conflict_rn)
51{
52 unsigned int max_sz_evi;
53 VisualID32 *temp_conflict;
54 xExtendedVisualInfo *evi;
55 unsigned int max_visuals = 0, max_sz_conflict, sz_conflict = 0;
56 register int visualI, scrI, sz_evi = 0, conflictI, n_conflict;
57
58 if (n_visual > UINT32_MAX/(sz_xExtendedVisualInfo * screenInfo.numScreens))
59 return BadAlloc;
60 max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens;
61
62 for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
63 if (screenInfo.screens[scrI]->numVisuals > max_visuals)
64 max_visuals = screenInfo.screens[scrI]->numVisuals;
65 }
66
67 if (n_visual > UINT32_MAX/(sz_VisualID32 * screenInfo.numScreens
68 * max_visuals))
69 return BadAlloc;
70 max_sz_conflict = n_visual * sz_VisualID32 * screenInfo.numScreens * max_visuals;
71
72 *evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi);
73 if (!*evi_rn)
74 return BadAlloc;
75
76 temp_conflict = (VisualID32 *)xalloc(max_sz_conflict);
77 if (!temp_conflict) {
78 xfree(*evi_rn);
79 return BadAlloc;
80 }
81
82 for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
83 for (visualI = 0; visualI < n_visual; visualI++) {
84 evi[sz_evi].core_visual_id = visual[visualI];
85 evi[sz_evi].screen = scrI;
86 evi[sz_evi].level = 0;
87 evi[sz_evi].transparency_type = XEVI_TRANSPARENCY_NONE;
88 evi[sz_evi].transparency_value = 0;
89 evi[sz_evi].min_hw_colormaps = 1;
90 evi[sz_evi].max_hw_colormaps = 1;
91 evi[sz_evi].num_colormap_conflicts = n_conflict = 0;
92 for (conflictI = 0; conflictI < n_conflict; conflictI++)
93 temp_conflict[sz_conflict++] = visual[visualI];
94 sz_evi++;
95 }
96 }
97 *conflict_rn = temp_conflict;
98 *n_conflict_rn = sz_conflict;
99 *n_info_rn = sz_evi;
100 return Success;
101}
102
103static void sampleFreeVisualInfo(
104 xExtendedVisualInfo *evi,
105 VisualID32 *conflict)
106{
107 if (evi)
108 xfree(evi);
109 if (conflict)
110 xfree(conflict);
111}
112
113EviPrivPtr eviDDXInit(void)
114{
115 static EviPrivRec eviPriv;
116 eviPriv.getVisualInfo = sampleGetVisualInfo;
117 eviPriv.freeVisualInfo = sampleFreeVisualInfo;
118 return &eviPriv;
119}
120
121void eviDDXReset(void)
122{
123}