1
/* $Xorg: EVI.c,v 1.3 2000/08/17 19:47:55 cpqbld Exp $ */
2
/************************************************************
3
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
4
Permission to use, copy, modify, and distribute this
5
software and its documentation for any purpose and without
6
fee is hereby granted, provided that the above copyright
7
notice appear in all copies and that both that copyright
8
notice and this permission notice appear in supporting
9
documentation, and that the name of Silicon Graphics not be
10
used in advertising or publicity pertaining to distribution
11
of the software without specific prior written permission.
12
Silicon Graphics makes no representation about the suitability
13
of this software for any purpose. It is provided "as is"
14
without any express or implied warranty.
15
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
16
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
17
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
18
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
19
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
21
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
22
THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
********************************************************/
24
/* $XFree86: xc/programs/Xserver/Xext/EVI.c,v 3.10tsi Exp $ */
26
#ifdef HAVE_DIX_CONFIG_H
27
#include <dix-config.h>
31
#include <X11/Xproto.h>
32
#include "dixstruct.h"
33
#include "extnsionst.h"
36
#include <X11/extensions/XEVIstr.h>
37
#include "EVIstruct.h"
41
static unsigned char XEVIReqCode = 0;
43
static EviPrivPtr eviPriv;
46
ProcEVIQueryVersion(ClientPtr client)
48
/* REQUEST(xEVIQueryVersionReq); */
49
xEVIQueryVersionReply rep;
51
REQUEST_SIZE_MATCH (xEVIQueryVersionReq);
54
rep.sequenceNumber = client->sequence;
55
rep.majorVersion = XEVI_MAJOR_VERSION;
56
rep.minorVersion = XEVI_MAJOR_VERSION;
57
if (client->swapped) {
58
swaps(&rep.sequenceNumber, n);
59
swapl(&rep.length, n);
60
swaps(&rep.majorVersion, n);
61
swaps(&rep.minorVersion, n);
63
WriteToClient(client, sizeof (xEVIQueryVersionReply), (char *)&rep);
64
return (client->noClientException);
66
#define swapEviInfo(eviInfo, l) \
69
xExtendedVisualInfo *eviInfo1 = eviInfo; \
71
swapl(&eviInfo1->core_visual_id, n); \
72
swapl(&eviInfo1->transparency_value, n); \
73
swaps(&eviInfo1->num_colormap_conflicts, n); \
77
#define swapVisual(visual, l) \
80
VisualID32 *visual1 = visual; \
88
ProcEVIGetVisualInfo(ClientPtr client)
90
REQUEST(xEVIGetVisualInfoReq);
91
xEVIGetVisualInfoReply rep;
92
int n, n_conflict, n_info, sz_info, sz_conflict;
94
xExtendedVisualInfo *eviInfo;
96
REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
97
status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
98
&eviInfo, &n_info, &conflict, &n_conflict);
99
if (status != Success)
101
sz_info = n_info * sz_xExtendedVisualInfo;
102
sz_conflict = n_conflict * sz_VisualID32;
105
rep.n_conflicts = n_conflict;
106
rep.sequenceNumber = client->sequence;
107
rep.length = (sz_info + sz_conflict) >> 2;
108
if (client->swapped) {
109
swaps(&rep.sequenceNumber, n);
110
swapl(&rep.length, n);
111
swapl(&rep.n_info, n);
112
swapl(&rep.n_conflicts, n);
113
swapEviInfo(eviInfo, n_info);
114
swapVisual(conflict, n_conflict);
116
WriteToClient(client, sz_xEVIGetVisualInfoReply, (char *)&rep);
117
WriteToClient(client, sz_info, (char *)eviInfo);
118
WriteToClient(client, sz_conflict, (char *)conflict);
119
eviPriv->freeVisualInfo(eviInfo, conflict);
120
return (client->noClientException);
124
ProcEVIDispatch(ClientPtr client)
127
switch (stuff->data) {
128
case X_EVIQueryVersion:
129
return ProcEVIQueryVersion (client);
130
case X_EVIGetVisualInfo:
131
return ProcEVIGetVisualInfo (client);
138
SProcEVIQueryVersion(ClientPtr client)
140
REQUEST(xEVIQueryVersionReq);
142
swaps(&stuff->length, n);
143
return ProcEVIQueryVersion(client);
147
SProcEVIGetVisualInfo(ClientPtr client)
150
REQUEST(xEVIGetVisualInfoReq);
151
swaps(&stuff->length, n);
152
return ProcEVIGetVisualInfo(client);
156
SProcEVIDispatch(ClientPtr client)
161
case X_EVIQueryVersion:
162
return SProcEVIQueryVersion (client);
163
case X_EVIGetVisualInfo:
164
return SProcEVIGetVisualInfo (client);
172
EVIResetProc(ExtensionEntry *extEntry)
180
* Called from InitExtensions in main() or from QueryExtension() if the
181
* extension is dynamically loaded.
185
EVIExtensionInit(INITARGS)
188
ExtensionEntry *extEntry;
190
if ((extEntry = AddExtension(EVINAME, 0, 0,
193
EVIResetProc, StandardMinorOpcode))) {
194
XEVIReqCode = (unsigned char)extEntry->base;
196
if (AddExtension(EVINAME, 0, 0,
197
ProcEVIDispatch, SProcEVIDispatch,
198
EVIResetProc, StandardMinorOpcode)) {
200
eviPriv = eviDDXInit();