New upstream version 3.5.99.27

This commit is contained in:
geos_one
2025-08-08 20:00:36 +02:00
commit bc8d10cc33
4267 changed files with 1757978 additions and 0 deletions

View File

@@ -0,0 +1,133 @@
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
/* Copyright (c) 2008-2017 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
/* Copyright (c) 2011-2022 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
/* Copyright (c) 2014-2019 Mihai Moldovan <ionic@ionic.de> */
/* Copyright (c) 2014-2022 Ulrich Sibiller <uli42@gmx.de> */
/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* nx-X11, NX protocol compression and NX extensions to this software */
/* are copyright of the aforementioned persons and companies. */
/* */
/* Redistribution and use of the present software is allowed according */
/* to terms specified in the file LICENSE which comes in the source */
/* distribution. */
/* */
/* All rights reserved. */
/* */
/* NOTE: This software has received contributions from various other */
/* contributors, only the core maintainers and supporters are listed as */
/* copyright holders. Please contact us, if you feel you should be listed */
/* as copyright holder, as well. */
/* */
/**************************************************************************/
#include <Server.tmpl>
#if HasShm && (!(defined(NXAgentServer) && NXAgentServer))
SHMSRCS = shm.c
SHMOBJS = shm.o
#endif
#if BuildScreenSaverExt
SCRNSAVSRC = saver.c
SCRNSAVOBJ = saver.o
#endif
#if BuildXF86BigfontExt
XF86BIGFSRCS = xf86bigfont.c
XF86BIGFOBJS = xf86bigfont.o
#if HasShm
SHM_DEFINES = -DHAS_SHM
#endif
#endif
#if BuildXvExt
XVSRCS = xvmain.c xvdisp.c xvmc.c
XVOBJS = xvmain.o xvdisp.o xvmc.o
#endif
#if BuildXResExt
XRESSRCS = xres.c
XRESOBJS = xres.o
#endif
#if BuildXCSecurity
SECURITYSRCS = security.c
SECURITYOBJS = security.o
POLICYFILEDEF = -DDEFAULTPOLICYFILE=\"$(USRDATADIR)/SecurityPolicy\"
#endif
#if BuildXinerama
PNRXSRCS = panoramiX.c panoramiXSwap.c panoramiXprocs.c
PNRXOBJS = panoramiX.o panoramiXSwap.o panoramiXprocs.o
PNRXINCLUDES = -I../mi -I../render
#endif
#if BuildDPMS
DPMSSRCS = dpms.c dpmsstubs.c
DPMSOBJS = dpms.o dpmsstubs.o
#endif
SRCS = shape.c $(SHMSRCS) xcmisc.c\
xtest.c sleepuntil.c \
bigreq.c sync.c $(SCRNSAVSRC) \
$(XF86BIGFSRCS) $(SECURITYSRCS) \
$(PNRXSRCS) $(DPMSSRCS) \
$(XVSRCS) $(XRESSRCS) $(DMXSRCS)
OBJS = shape.o $(SHMOBJS) xcmisc.o \
xtest.o sleepuntil.o \
bigreq.o sync.o $(SCRNSAVOBJ) \
$(XF86BIGFOBJS) $(SECURITYOBJS) \
$(PNRXOBJS) $(DPMSOBJS) \
$(XVOBJS) $(XRESOBJS) $(DMXOBJS)
SOBJS = $(SHMOBJS) $(SECURITYOBJS) \
shape.o xtest.o sleepuntil.o $(PNRXOBJS) \
$(XF86BIGFOBJS)
#if defined(NXAgentServer) && NXAgentServer
NX_DEFINES = -DNXAGENT_SERVER
#endif
#if defined(XorgVersion)
/* XXX Check if this can be eliminated */
XF86INCLUDES = -I$(XF86COMSRC)
#endif
INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
$(PNRXINCLUDES) \
$(XF86INCLUDES) \
$(DMXINCLUDES) \
`pkg-config --cflags-only-I pixman-1`
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
#if defined(NXAgentServer) && NXAgentServer
DEFINES = $(EXT_DEFINES) $(XVMCSHM_DEFINES) $(NX_DEFINES)
#else
DEFINES = $(EXT_DEFINES) $(XVMCSHM_DEFINES)
#endif
NormalLibraryObjectRule()
NormalLibraryTarget(ext,$(OBJS))
LintLibraryTarget(ext,$(SRCS))
NormalLintTarget($(SRCS))
#if BuildXF86BigfontExt
SpecialCObjectRule(xf86bigfont,$(ICONFIGFILES),$(SHM_DEFINES))
#endif
#if BuildXCSecurity
SpecialCObjectRule(security,$(ICONFIGFILES),$(POLICYFILEDEF))
#endif
LinkConfDirectory(xserver,.,xserver,.)
#if BuildXCSecurity && InstallSecurityConfig
InstallNonExecFile(SecurityPolicy,$(USRDATADIR))
#endif
DependTarget()
InstallDriverSDKNonExecFile(xvdix.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(xvmcext.h,$(DRIVERSDKINCLUDEDIR))

View File

@@ -0,0 +1,88 @@
version-1
# $Xorg: SecurityPolicy,v 1.3 2000/08/17 19:47:56 cpqbld Exp $
# The site policy fields are interpreted by the XC-QUERY-SECURITY-1
# authorization protocol. The values are arbitrary and site-specific.
# Refer to the Security Extension Specification for the usage of the policies.
#sitepolicy A
#sitepolicy B
#sitepolicy C
# Property access rules:
# property <property> <window> <permissions>
# <window> ::= any | root | <propertyselector>
# <propertyselector> ::= <property> | <property>=<value>
# <permissions> :== [ <operation> | <action> | <space> ]*
# <operation> :== r | w | d
# r read
# w write
# d delete
# <action> :== a | i | e
# a allow
# i ignore
# e error
# Allow reading of application resources, but not writing.
property RESOURCE_MANAGER root ar iw
property SCREEN_RESOURCES root ar iw
# Ignore attempts to use cut buffers. Giving errors causes apps to crash,
# and allowing access may give away too much information.
property CUT_BUFFER0 root irw
property CUT_BUFFER1 root irw
property CUT_BUFFER2 root irw
property CUT_BUFFER3 root irw
property CUT_BUFFER4 root irw
property CUT_BUFFER5 root irw
property CUT_BUFFER6 root irw
property CUT_BUFFER7 root irw
# If you are using Motif, you probably want these.
property _MOTIF_DEFAULT_BINDINGS root ar iw
property _MOTIF_DRAG_WINDOW root ar iw
property _MOTIF_DRAG_TARGETS any ar iw
property _MOTIF_DRAG_ATOMS any ar iw
property _MOTIF_DRAG_ATOM_PAIRS any ar iw
# If you are running CDE you also need these
property _MOTIF_WM_INFO root arw
property TT_SESSION root irw
property WM_ICON_SIZE root irw
property "SDT Pixel Set" any irw
# The next two rules let xwininfo -tree work when untrusted.
property WM_NAME any ar
# Allow read of WM_CLASS, but only for windows with WM_NAME.
# This might be more restrictive than necessary, but demonstrates
# the <required property> facility, and is also an attempt to
# say "top level windows only."
property WM_CLASS WM_NAME ar
# These next three let xlsclients work untrusted. Think carefully
# before including these; giving away the client machine name and command
# may be exposing too much.
property WM_STATE WM_NAME ar
property WM_CLIENT_MACHINE WM_NAME ar
property WM_COMMAND WM_NAME ar
# To let untrusted clients use the standard colormaps created by
# xstdcmap, include these lines.
property RGB_DEFAULT_MAP root ar
property RGB_BEST_MAP root ar
property RGB_RED_MAP root ar
property RGB_GREEN_MAP root ar
property RGB_BLUE_MAP root ar
property RGB_GRAY_MAP root ar
# To let untrusted clients use the color management database created
# by xcmsdb, include these lines.
property XDCCC_LINEAR_RGB_CORRECTION root ar
property XDCCC_LINEAR_RGB_MATRICES root ar
property XDCCC_GRAY_SCREENWHITEPOINT root ar
property XDCCC_GRAY_CORRECTION root ar
# To let untrusted clients use the overlay visuals that many vendors
# support, include this line.
property SERVER_OVERLAY_VISUALS root ar

View File

@@ -0,0 +1,103 @@
/*
Copyright 1992, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include <nx-X11/extensions/bigreqstr.h>
#include "opaque.h"
#if 0
static unsigned char XBigReqCode;
#endif
static void BigReqResetProc(
ExtensionEntry * /* extEntry */
);
static DISPATCH_PROC(ProcBigReqDispatch);
void
BigReqExtensionInit(void)
{
#if 0
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,
BigReqResetProc, StandardMinorOpcode)) != 0)
XBigReqCode = (unsigned char)extEntry->base;
#else
(void) AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,
BigReqResetProc, StandardMinorOpcode);
#endif
DeclareExtensionSecurity(XBigReqExtensionName, TRUE);
}
/*ARGSUSED*/
static void
BigReqResetProc (extEntry)
ExtensionEntry *extEntry;
{
}
static int
ProcBigReqDispatch (client)
register ClientPtr client;
{
REQUEST(xBigReqEnableReq);
xBigReqEnableReply rep;
if (client->swapped) {
swaps(&stuff->length);
}
if (stuff->brReqType != X_BigReqEnable)
return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq);
client->big_requests = TRUE;
memset(&rep, 0, sizeof(xBigReqEnableReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.max_request_size = maxBigRequestSize;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.max_request_size);
}
WriteToClient(client, sizeof(xBigReqEnableReply), &rep);
return(client->noClientException);
}

View File

@@ -0,0 +1,429 @@
/*****************************************************************
Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
/*
* HISTORY
*
* @(#)RCSfile: dpms.c,v Revision: 1.1.4.5 (DEC) Date: 1996/03/04 15:27:00
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "opaque.h"
#define DPMS_SERVER
#include <nx-X11/extensions/dpms.h>
#include <nx-X11/extensions/dpmsstr.h>
#include "dpmsproc.h"
#if 0
static unsigned char DPMSCode;
#endif
static DISPATCH_PROC(ProcDPMSDispatch);
static DISPATCH_PROC(SProcDPMSDispatch);
static DISPATCH_PROC(ProcDPMSGetVersion);
static DISPATCH_PROC(SProcDPMSGetVersion);
static DISPATCH_PROC(ProcDPMSGetTimeouts);
static DISPATCH_PROC(SProcDPMSGetTimeouts);
static DISPATCH_PROC(ProcDPMSSetTimeouts);
static DISPATCH_PROC(SProcDPMSSetTimeouts);
static DISPATCH_PROC(ProcDPMSEnable);
static DISPATCH_PROC(SProcDPMSEnable);
static DISPATCH_PROC(ProcDPMSDisable);
static DISPATCH_PROC(SProcDPMSDisable);
static DISPATCH_PROC(ProcDPMSForceLevel);
static DISPATCH_PROC(SProcDPMSForceLevel);
static DISPATCH_PROC(ProcDPMSInfo);
static DISPATCH_PROC(SProcDPMSInfo);
static DISPATCH_PROC(ProcDPMSCapable);
static DISPATCH_PROC(SProcDPMSCapable);
static void DPMSResetProc(ExtensionEntry* extEntry);
void
DPMSExtensionInit(void)
{
#if 0
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
DPMSResetProc, StandardMinorOpcode)))
DPMSCode = (unsigned char)extEntry->base;
#else
(void) AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
DPMSResetProc, StandardMinorOpcode);
#endif
}
/*ARGSUSED*/
static void
DPMSResetProc (extEntry)
ExtensionEntry *extEntry;
{
}
static int
ProcDPMSGetVersion(client)
register ClientPtr client;
{
/* REQUEST(xDPMSGetVersionReq); */
xDPMSGetVersionReply rep = {0};
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = DPMSMajorVersion;
rep.minorVersion = DPMSMinorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xDPMSGetVersionReply), &rep);
return(client->noClientException);
}
static int
ProcDPMSCapable(register ClientPtr client)
{
/* REQUEST(xDPMSCapableReq); */
xDPMSCapableReply rep = {0};
REQUEST_SIZE_MATCH(xDPMSCapableReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.capable = DPMSCapableFlag;
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xDPMSCapableReply), &rep);
return(client->noClientException);
}
static int
ProcDPMSGetTimeouts(client)
register ClientPtr client;
{
/* REQUEST(xDPMSGetTimeoutsReq); */
xDPMSGetTimeoutsReply rep = {0};
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.standby = DPMSStandbyTime / MILLI_PER_SECOND;
rep.suspend = DPMSSuspendTime / MILLI_PER_SECOND;
rep.off = DPMSOffTime / MILLI_PER_SECOND;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.standby);
swaps(&rep.suspend);
swaps(&rep.off);
}
WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), &rep);
return(client->noClientException);
}
static int
ProcDPMSSetTimeouts(client)
register ClientPtr client;
{
REQUEST(xDPMSSetTimeoutsReq);
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
if ((stuff->off != 0)&&(stuff->off < stuff->suspend))
{
client->errorValue = stuff->off;
return BadValue;
}
if ((stuff->suspend != 0)&&(stuff->suspend < stuff->standby))
{
client->errorValue = stuff->suspend;
return BadValue;
}
DPMSStandbyTime = stuff->standby * MILLI_PER_SECOND;
DPMSSuspendTime = stuff->suspend * MILLI_PER_SECOND;
DPMSOffTime = stuff->off * MILLI_PER_SECOND;
SetScreenSaverTimer();
return(client->noClientException);
}
static int
ProcDPMSEnable(client)
register ClientPtr client;
{
Bool was_enabled = DPMSEnabled;
REQUEST_SIZE_MATCH(xDPMSEnableReq);
if (DPMSCapableFlag) {
DPMSEnabled = TRUE;
if (!was_enabled)
SetScreenSaverTimer();
}
return(client->noClientException);
}
static int
ProcDPMSDisable(client)
register ClientPtr client;
{
/* REQUEST(xDPMSDisableReq); */
REQUEST_SIZE_MATCH(xDPMSDisableReq);
DPMSSet(DPMSModeOn);
DPMSEnabled = FALSE;
return(client->noClientException);
}
static int
ProcDPMSForceLevel(client)
register ClientPtr client;
{
REQUEST(xDPMSForceLevelReq);
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
if (!DPMSEnabled)
return BadMatch;
if (stuff->level != DPMSModeOn &&
stuff->level != DPMSModeStandby &&
stuff->level != DPMSModeSuspend &&
stuff->level != DPMSModeOff) {
client->errorValue = stuff->level;
return BadValue;
}
DPMSSet(stuff->level);
return(client->noClientException);
}
static int
ProcDPMSInfo(register ClientPtr client)
{
/* REQUEST(xDPMSInfoReq); */
xDPMSInfoReply rep = {0};
REQUEST_SIZE_MATCH(xDPMSInfoReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.power_level = DPMSPowerLevel;
rep.state = DPMSEnabled;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.power_level);
}
WriteToClient(client, sizeof(xDPMSInfoReply), &rep);
return(client->noClientException);
}
static int
ProcDPMSDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_DPMSGetVersion:
return ProcDPMSGetVersion(client);
case X_DPMSCapable:
return ProcDPMSCapable(client);
case X_DPMSGetTimeouts:
return ProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
return ProcDPMSSetTimeouts(client);
case X_DPMSEnable:
return ProcDPMSEnable(client);
case X_DPMSDisable:
return ProcDPMSDisable(client);
case X_DPMSForceLevel:
return ProcDPMSForceLevel(client);
case X_DPMSInfo:
return ProcDPMSInfo(client);
default:
return BadRequest;
}
}
static int
SProcDPMSGetVersion(client)
register ClientPtr client;
{
REQUEST(xDPMSGetVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcDPMSGetVersion(client);
}
static int
SProcDPMSCapable(register ClientPtr client)
{
REQUEST(xDPMSCapableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSCapableReq);
return ProcDPMSCapable(client);
}
static int
SProcDPMSGetTimeouts(client)
register ClientPtr client;
{
REQUEST(xDPMSGetTimeoutsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
return ProcDPMSGetTimeouts(client);
}
static int
SProcDPMSSetTimeouts(client)
register ClientPtr client;
{
REQUEST(xDPMSSetTimeoutsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
swaps(&stuff->standby);
swaps(&stuff->suspend);
swaps(&stuff->off);
return ProcDPMSSetTimeouts(client);
}
static int
SProcDPMSEnable(client)
register ClientPtr client;
{
REQUEST(xDPMSEnableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSEnableReq);
return ProcDPMSEnable(client);
}
static int
SProcDPMSDisable(client)
register ClientPtr client;
{
REQUEST(xDPMSDisableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSDisableReq);
return ProcDPMSDisable(client);
}
static int
SProcDPMSForceLevel(client)
register ClientPtr client;
{
REQUEST(xDPMSForceLevelReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
swaps(&stuff->level);
return ProcDPMSForceLevel(client);
}
static int
SProcDPMSInfo(client)
register ClientPtr client;
{
REQUEST(xDPMSInfoReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSInfoReq);
return ProcDPMSInfo(client);
}
static int
SProcDPMSDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_DPMSGetVersion:
return SProcDPMSGetVersion(client);
case X_DPMSCapable:
return SProcDPMSCapable(client);
case X_DPMSGetTimeouts:
return SProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
return SProcDPMSSetTimeouts(client);
case X_DPMSEnable:
return SProcDPMSEnable(client);
case X_DPMSDisable:
return SProcDPMSDisable(client);
case X_DPMSForceLevel:
return SProcDPMSForceLevel(client);
case X_DPMSInfo:
return SProcDPMSInfo(client);
default:
return BadRequest;
}
}

View File

@@ -0,0 +1,15 @@
/* Prototypes for functions that the DDX must provide */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _DPMSPROC_H_
#define _DPMSPROC_H_
void DPMSSet(int level);
int DPMSGet(int *plevel);
Bool DPMSSupported(void);
#endif

View File

@@ -0,0 +1,52 @@
/*****************************************************************
Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
typedef int Bool;
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "dpmsproc.h"
#define FALSE 0
Bool DPMSSupported(void)
{
return FALSE;
}
int DPMSGet(int *plevel)
{
return -1;
}
void DPMSSet(int level)
{
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,100 @@
/*****************************************************************
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
/*
* PanoramiX definitions
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _PANORAMIX_H_
#define _PANORAMIX_H_
#include <nx-X11/extensions/panoramiXext.h>
/*#include "gcstruct.h"*/
typedef struct _PanoramiXData {
int x;
int y;
int width;
int height;
} PanoramiXData;
typedef struct _PanoramiXInfo {
XID id ;
} PanoramiXInfo;
typedef struct {
PanoramiXInfo info[MAXSCREENS];
RESTYPE type;
union {
struct {
char visibility;
char class;
char root;
} win;
struct {
Bool shared;
} pix;
#ifdef RENDER
struct {
Bool root;
} pict;
#endif
char raw_data[4];
} u;
} PanoramiXRes;
#define FOR_NSCREENS_FORWARD(j) for(j = 0; j < PanoramiXNumScreens; j++)
#define FOR_NSCREENS_BACKWARD(j) for(j = PanoramiXNumScreens - 1; j >= 0; j--)
#define FOR_NSCREENS(j) FOR_NSCREENS_FORWARD(j)
#define BREAK_IF(a) if ((a)) break
#define IF_RETURN(a,b) if ((a)) return (b)
#define FORCE_ROOT(a) { \
int _j; \
for (_j = PanoramiXNumScreens - 1; _j; _j--) \
if ((a).root == screenInfo.screens[_j]->root->drawable.id) \
break; \
(a).rootX += panoramiXdataPtr[_j].x; \
(a).rootY += panoramiXdataPtr[_j].y; \
(a).root = screenInfo.screens[0]->root->drawable.id; \
}
#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)
#define SKIP_FAKE_WINDOW(a) if(!LookupIDByType(a, XRT_WINDOW)) return
#endif /* _PANORAMIX_H_ */

View File

@@ -0,0 +1,140 @@
/*****************************************************************
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "cursor.h"
#include "cursorstr.h"
#include "extnsionst.h"
#include "dixstruct.h"
#include "gc.h"
#include "gcstruct.h"
#include "scrnintstr.h"
#include "window.h"
#include "windowstr.h"
#include "pixmapstr.h"
#if 0
#include <sys/workstation.h>
#include <nx-X11/Xserver/ws.h>
#endif
#include "panoramiX.h"
#include <nx-X11/extensions/panoramiXproto.h>
#include "panoramiXsrv.h"
#include "globals.h"
#include "panoramiXh.h"
static int
SProcPanoramiXQueryVersion (ClientPtr client)
{
REQUEST(xPanoramiXQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
return ProcPanoramiXQueryVersion(client);
}
static int
SProcPanoramiXGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
swaps (&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
swapl (&stuff->window);
return ProcPanoramiXGetState(client);
}
static int
SProcPanoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
swaps (&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
swapl (&stuff->window);
return ProcPanoramiXGetScreenCount(client);
}
static int
SProcPanoramiXGetScreenSize(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenSizeReq);
swaps (&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
swapl (&stuff->window);
swapl (&stuff->screen);
return ProcPanoramiXGetScreenSize(client);
}
static int
SProcXineramaIsActive(ClientPtr client)
{
REQUEST(xXineramaIsActiveReq);
swaps (&stuff->length);
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
return ProcXineramaIsActive(client);
}
static int
SProcXineramaQueryScreens(ClientPtr client)
{
REQUEST(xXineramaQueryScreensReq);
swaps (&stuff->length);
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
return ProcXineramaQueryScreens(client);
}
int
SProcPanoramiXDispatch (ClientPtr client)
{ REQUEST(xReq);
switch (stuff->data)
{
case X_PanoramiXQueryVersion:
return SProcPanoramiXQueryVersion(client);
case X_PanoramiXGetState:
return SProcPanoramiXGetState(client);
case X_PanoramiXGetScreenCount:
return SProcPanoramiXGetScreenCount(client);
case X_PanoramiXGetScreenSize:
return SProcPanoramiXGetScreenSize(client);
case X_XineramaIsActive:
return SProcXineramaIsActive(client);
case X_XineramaQueryScreens:
return SProcXineramaQueryScreens(client);
}
return BadRequest;
}

View File

@@ -0,0 +1,74 @@
/*
* Server dispatcher function replacements
*/
extern int PanoramiXCreateWindow(ClientPtr client);
extern int PanoramiXChangeWindowAttributes(ClientPtr client);
extern int PanoramiXDestroyWindow(ClientPtr client);
extern int PanoramiXDestroySubwindows(ClientPtr client);
extern int PanoramiXChangeSaveSet(ClientPtr client);
extern int PanoramiXReparentWindow(ClientPtr client);
extern int PanoramiXMapWindow(ClientPtr client);
extern int PanoramiXMapSubwindows(ClientPtr client);
extern int PanoramiXUnmapWindow(ClientPtr client);
extern int PanoramiXUnmapSubwindows(ClientPtr client);
extern int PanoramiXConfigureWindow(ClientPtr client);
extern int PanoramiXCirculateWindow(ClientPtr client);
extern int PanoramiXGetGeometry(ClientPtr client);
extern int PanoramiXTranslateCoords(ClientPtr client);
extern int PanoramiXCreatePixmap(ClientPtr client);
extern int PanoramiXFreePixmap(ClientPtr client);
extern int PanoramiXChangeGC(ClientPtr client);
extern int PanoramiXCopyGC(ClientPtr client);
extern int PanoramiXCopyColormapAndFree(ClientPtr client);
extern int PanoramiXCreateGC(ClientPtr client);
extern int PanoramiXSetDashes(ClientPtr client);
extern int PanoramiXSetClipRectangles(ClientPtr client);
extern int PanoramiXFreeGC(ClientPtr client);
extern int PanoramiXClearToBackground(ClientPtr client);
extern int PanoramiXCopyArea(ClientPtr client);
extern int PanoramiXCopyPlane(ClientPtr client);
extern int PanoramiXPolyPoint(ClientPtr client);
extern int PanoramiXPolyLine(ClientPtr client);
extern int PanoramiXPolySegment(ClientPtr client);
extern int PanoramiXPolyRectangle(ClientPtr client);
extern int PanoramiXPolyArc(ClientPtr client);
extern int PanoramiXFillPoly(ClientPtr client);
extern int PanoramiXPolyFillArc(ClientPtr client);
extern int PanoramiXPolyFillRectangle(ClientPtr client);
extern int PanoramiXPutImage(ClientPtr client);
extern int PanoramiXGetImage(ClientPtr client);
extern int PanoramiXPolyText8(ClientPtr client);
extern int PanoramiXPolyText16(ClientPtr client);
extern int PanoramiXImageText8(ClientPtr client);
extern int PanoramiXImageText16(ClientPtr client);
extern int PanoramiXCreateColormap(ClientPtr client);
extern int PanoramiXFreeColormap(ClientPtr client);
extern int PanoramiXInstallColormap(ClientPtr client);
extern int PanoramiXUninstallColormap(ClientPtr client);
extern int PanoramiXAllocColor(ClientPtr client);
extern int PanoramiXAllocNamedColor(ClientPtr client);
extern int PanoramiXAllocColorCells(ClientPtr client);
extern int PanoramiXStoreNamedColor(ClientPtr client);
extern int PanoramiXFreeColors(ClientPtr client);
extern int PanoramiXStoreColors(ClientPtr client);
extern int PanoramiXAllocColorPlanes(ClientPtr client);
#define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr)
PROC_EXTERN(ProcPanoramiXQueryVersion);
PROC_EXTERN(ProcPanoramiXGetState);
PROC_EXTERN(ProcPanoramiXGetScreenCount);
PROC_EXTERN(ProcPanoramiXGetScreenSize);
PROC_EXTERN(ProcXineramaQueryScreens);
PROC_EXTERN(ProcXineramaIsActive);
extern int SProcPanoramiXDispatch(ClientPtr client);
extern char *ConnectionInfo;
extern int connBlockScreenStart;
extern xConnSetupPrefix connSetupPrefix;
extern int (* SavedProcVector[256]) (ClientPtr client);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _PANORAMIXSRV_H_
#define _PANORAMIXSRV_H_
#include "panoramiX.h"
extern int PanoramiXNumScreens;
extern PanoramiXData *panoramiXdataPtr;
extern int PanoramiXPixWidth;
extern int PanoramiXPixHeight;
extern RegionRec PanoramiXScreenRegion;
extern XID *PanoramiXVisualTable;
extern void PanoramiXConsolidate(void);
extern Bool PanoramiXCreateConnectionBlock(void);
extern PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int);
extern PanoramiXRes * PanoramiXFindIDOnAnyScreen(RESTYPE, XID);
extern WindowPtr PanoramiXChangeWindow(int, WindowPtr);
extern Bool XineramaRegisterConnectionBlockCallback(void (*func)(void));
extern int XineramaDeleteResource(void *, XID);
extern void XineramaReinitData(ScreenPtr);
extern RegionRec XineramaScreenRegions[MAXSCREENS];
extern unsigned long XRC_DRAWABLE;
extern unsigned long XRT_WINDOW;
extern unsigned long XRT_PIXMAP;
extern unsigned long XRT_GC;
extern unsigned long XRT_COLORMAP;
extern void XineramaGetImageData(
DrawablePtr *pDrawables,
int left,
int top,
int width,
int height,
unsigned int format,
unsigned long planemask,
char *data,
int pitch,
Bool isRoot
);
#endif /* _PANORAMIXSRV_H_ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
/*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _SHMINT_H_
#define _SHMINT_H_
#define _XSHM_SERVER_
#include <X11/extensions/shmstr.h>
#include "screenint.h"
#include "pixmap.h"
#include "gc.h"
void
ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
void
ShmSetPixmapFormat(ScreenPtr pScreen, int format);
void
ShmRegisterFbFuncs(ScreenPtr pScreen);
#endif /* _SHMINT_H_ */

View File

@@ -0,0 +1,237 @@
/*
*
Copyright 1992, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
/* dixsleep.c - implement millisecond timeouts for X clients */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "sleepuntil.h"
#include <nx-X11/X.h>
#include <nx-X11/Xmd.h>
#include "misc.h"
#include "windowstr.h"
#include "dixstruct.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
typedef struct _Sertafied {
struct _Sertafied *next;
TimeStamp revive;
ClientPtr pClient;
XID id;
void (*notifyFunc)(
ClientPtr /* client */,
void * /* closure */
);
void *closure;
} SertafiedRec, *SertafiedPtr;
static SertafiedPtr pPending;
static RESTYPE SertafiedResType;
static Bool BlockHandlerRegistered;
static int SertafiedGeneration;
static void ClientAwaken(
ClientPtr /* client */,
void * /* closure */
);
static int SertafiedDelete(
void * /* value */,
XID /* id */
);
static void SertafiedBlockHandler(
void * /* data */,
OSTimePtr /* wt */,
void * /* LastSelectMask */
);
static void SertafiedWakeupHandler(
void * /* data */,
int /* i */,
void * /* LastSelectMask */
);
_X_EXPORT int
ClientSleepUntil (client, revive, notifyFunc, closure)
ClientPtr client;
TimeStamp *revive;
void (*notifyFunc)(
ClientPtr /* client */,
void * /* closure */);
void *closure;
{
SertafiedPtr pRequest, pReq, pPrev;
if (SertafiedGeneration != serverGeneration)
{
SertafiedResType = CreateNewResourceType (SertafiedDelete);
if (!SertafiedResType)
return FALSE;
SertafiedGeneration = serverGeneration;
BlockHandlerRegistered = FALSE;
}
pRequest = (SertafiedPtr) malloc (sizeof (SertafiedRec));
if (!pRequest)
return FALSE;
pRequest->pClient = client;
pRequest->revive = *revive;
pRequest->id = FakeClientID (client->index);
pRequest->closure = closure;
if (!BlockHandlerRegistered)
{
if (!RegisterBlockAndWakeupHandlers (SertafiedBlockHandler,
SertafiedWakeupHandler,
(void *) 0))
{
free (pRequest);
return FALSE;
}
BlockHandlerRegistered = TRUE;
}
pRequest->notifyFunc = 0;
if (!AddResource (pRequest->id, SertafiedResType, (void *) pRequest))
return FALSE;
if (!notifyFunc)
notifyFunc = ClientAwaken;
pRequest->notifyFunc = notifyFunc;
/* Insert into time-ordered queue, with earliest activation time coming first. */
pPrev = 0;
for (pReq = pPending; pReq; pReq = pReq->next)
{
if (CompareTimeStamps (pReq->revive, *revive) == LATER)
break;
pPrev = pReq;
}
if (pPrev)
pPrev->next = pRequest;
else
pPending = pRequest;
pRequest->next = pReq;
IgnoreClient (client);
return TRUE;
}
static void
ClientAwaken (client, closure)
ClientPtr client;
void *closure;
{
if (!client->clientGone)
AttendClient (client);
}
static int
SertafiedDelete (value, id)
void * value;
XID id;
{
SertafiedPtr pRequest = (SertafiedPtr)value;
SertafiedPtr pReq, pPrev;
pPrev = 0;
for (pReq = pPending; pReq; pPrev = pReq, pReq = pReq->next)
if (pReq == pRequest)
{
if (pPrev)
pPrev->next = pReq->next;
else
pPending = pReq->next;
break;
}
if (pRequest->notifyFunc)
(*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure);
free (pRequest);
return TRUE;
}
static void
SertafiedBlockHandler (data, wt, LastSelectMask)
void *data; /* unused */
OSTimePtr wt; /* wait time */
void *LastSelectMask;
{
SertafiedPtr pReq, pNext;
unsigned long delay;
TimeStamp now;
if (!pPending)
return;
now.milliseconds = GetTimeInMillis ();
now.months = currentTime.months;
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
now.months++;
for (pReq = pPending; pReq; pReq = pNext)
{
pNext = pReq->next;
if (CompareTimeStamps (pReq->revive, now) == LATER)
break;
FreeResource (pReq->id, RT_NONE);
/* AttendClient() may have been called via the resource delete
* function so a client may have input to be processed and so
* set delay to 0 to prevent blocking in WaitForSomething().
*/
AdjustWaitForDelay (wt, 0);
}
pReq = pPending;
if (!pReq)
return;
delay = pReq->revive.milliseconds - now.milliseconds;
AdjustWaitForDelay (wt, delay);
}
static void
SertafiedWakeupHandler (data, i, LastSelectMask)
void * data;
int i;
void * LastSelectMask;
{
SertafiedPtr pReq, pNext;
TimeStamp now;
now.milliseconds = GetTimeInMillis ();
now.months = currentTime.months;
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
now.months++;
for (pReq = pPending; pReq; pReq = pNext)
{
pNext = pReq->next;
if (CompareTimeStamps (pReq->revive, now) == LATER)
break;
FreeResource (pReq->id, RT_NONE);
}
if (!pPending)
{
RemoveBlockAndWakeupHandlers (SertafiedBlockHandler,
SertafiedWakeupHandler,
(void *) 0);
BlockHandlerRegistered = FALSE;
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2001 The XFree86 Project, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the XFree86 Project shall
* not be used in advertising or otherwise to promote the sale, use or other
* dealings in this Software without prior written authorization from the
* XFree86 Project.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _SLEEPUNTIL_H_
#define _SLEEPUNTIL_H_ 1
#include "dix.h"
extern int ClientSleepUntil(
ClientPtr client,
TimeStamp *revive,
void (*notifyFunc)(
ClientPtr /* client */,
void * /* closure */
),
void * Closure
);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,239 @@
/*
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.h"
#include <nx-X11/extensions/xcmiscstr.h>
#include <stdint.h>
#if 0
static unsigned char XCMiscCode;
#endif
static void XCMiscResetProc(
ExtensionEntry * /* extEntry */
);
static DISPATCH_PROC(ProcXCMiscDispatch);
static DISPATCH_PROC(ProcXCMiscGetVersion);
static DISPATCH_PROC(ProcXCMiscGetXIDList);
static DISPATCH_PROC(ProcXCMiscGetXIDRange);
static DISPATCH_PROC(SProcXCMiscDispatch);
static DISPATCH_PROC(SProcXCMiscGetVersion);
static DISPATCH_PROC(SProcXCMiscGetXIDList);
static DISPATCH_PROC(SProcXCMiscGetXIDRange);
void
XCMiscExtensionInit(void)
{
#if 0
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch,
XCMiscResetProc, StandardMinorOpcode)) != 0)
XCMiscCode = (unsigned char)extEntry->base;
#else
(void) AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch,
XCMiscResetProc, StandardMinorOpcode);
#endif
DeclareExtensionSecurity(XCMiscExtensionName, TRUE);
}
/*ARGSUSED*/
static void
XCMiscResetProc (extEntry)
ExtensionEntry *extEntry;
{
}
static int
ProcXCMiscGetVersion(client)
register ClientPtr client;
{
xXCMiscGetVersionReply rep;
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XCMiscMajorVersion;
rep.minorVersion = XCMiscMinorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xXCMiscGetVersionReply), &rep);
return(client->noClientException);
}
static int
ProcXCMiscGetXIDRange(client)
register ClientPtr client;
{
xXCMiscGetXIDRangeReply rep;
XID min_id, max_id;
REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq);
GetXIDRange(client->index, FALSE, &min_id, &max_id);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.start_id = min_id;
rep.count = max_id - min_id + 1;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.start_id);
swapl(&rep.count);
}
WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep);
return(client->noClientException);
}
static int
ProcXCMiscGetXIDList(client)
register ClientPtr client;
{
REQUEST(xXCMiscGetXIDListReq);
xXCMiscGetXIDListReply rep;
XID *pids;
unsigned int count;
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
if (stuff->count > UINT32_MAX / sizeof(XID))
return BadAlloc;
pids = (XID *)malloc(stuff->count * sizeof(XID));
if (!pids)
{
return BadAlloc;
}
count = GetXIDList(client, stuff->count, pids);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = count;
rep.count = count;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.count);
}
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep);
if (count)
{
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
}
free(pids);
return(client->noClientException);
}
static int
ProcXCMiscDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XCMiscGetVersion:
return ProcXCMiscGetVersion(client);
case X_XCMiscGetXIDRange:
return ProcXCMiscGetXIDRange(client);
case X_XCMiscGetXIDList:
return ProcXCMiscGetXIDList(client);
default:
return BadRequest;
}
}
static int
SProcXCMiscGetVersion(client)
register ClientPtr client;
{
REQUEST(xXCMiscGetVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcXCMiscGetVersion(client);
}
static int
SProcXCMiscGetXIDRange(client)
register ClientPtr client;
{
REQUEST(xReq);
swaps(&stuff->length);
return ProcXCMiscGetXIDRange(client);
}
static int
SProcXCMiscGetXIDList(client)
register ClientPtr client;
{
REQUEST(xXCMiscGetXIDListReq);
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
swaps(&stuff->length);
swapl(&stuff->count);
return ProcXCMiscGetXIDList(client);
}
static int
SProcXCMiscDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XCMiscGetVersion:
return SProcXCMiscGetVersion(client);
case X_XCMiscGetXIDRange:
return SProcXCMiscGetXIDRange(client);
case X_XCMiscGetXIDList:
return SProcXCMiscGetXIDList(client);
default:
return BadRequest;
}
}

View File

@@ -0,0 +1,794 @@
/*
* BIGFONT extension for sharing font metrics between clients (if possible)
* and for transmitting font metrics to clients in a compressed form.
*
* Copyright (c) 1999-2000 Bruno Haible
* Copyright (c) 1999-2000 The XFree86 Project, Inc.
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD */
/*
* Big fonts suffer from the following: All clients that have opened a
* font can access the complete glyph metrics array (the XFontStruct member
* `per_char') directly, without going through a macro. Moreover these
* glyph metrics are ink metrics, i.e. are not redundant even for a
* fixed-width font. For a Unicode font, the size of this array is 768 KB.
*
* Problems: 1. It eats a lot of memory in each client. 2. All this glyph
* metrics data is piped through the socket when the font is opened.
*
* This extension addresses these two problems for local clients, by using
* shared memory. It also addresses the second problem for non-local clients,
* by compressing the data before transmit by a factor of nearly 6.
*
* If you use this extension, your OS ought to nicely support shared memory.
* This means: Shared memory should be swappable to the swap, and the limits
* should be high enough (SHMMNI at least 64, SHMMAX at least 768 KB,
* SHMALL at least 48 MB). It is a plus if your OS allows shmat() calls
* on segments that have already been marked "removed", because it permits
* these segments to be cleaned up by the OS if the X server is killed with
* signal SIGKILL.
*
* This extension is transparently exploited by Xlib (functions XQueryFont,
* XLoadQueryFont).
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <sys/types.h>
#ifdef HAS_SHM
#if defined(linux) && (!defined(__GNU_LIBRARY__) || __GNU_LIBRARY__ < 2)
/* libc4 does not define __GNU_LIBRARY__, libc5 defines __GNU_LIBRARY__ as 1 */
/* Linux libc4 and libc5 only (because glibc doesn't include kernel headers):
Linux 2.0.x and 2.2.x define SHMLBA as PAGE_SIZE, but forget to define
PAGE_SIZE. It is defined in <asm/page.h>. */
#include <asm/page.h>
#include <limits.h>
#endif
#ifdef SVR4
#include <sys/sysmacros.h>
#endif
#if defined(__CYGWIN__) || defined(__SCO__)
#include <sys/param.h>
#include <sys/sysmacros.h>
#endif
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "gcstruct.h"
#include "dixfontstr.h"
#include "extnsionst.h"
#include "protocol-versions.h"
#define _XF86BIGFONT_SERVER_
#include <nx-X11/extensions/xf86bigfproto.h>
#ifdef HAS_XFONT2
# include <X11/fonts/libxfont2.h>
#endif /* HAS_XFONT2 */
static void XF86BigfontResetProc(
ExtensionEntry * /* extEntry */
);
static DISPATCH_PROC(ProcXF86BigfontDispatch);
static DISPATCH_PROC(ProcXF86BigfontQueryVersion);
static DISPATCH_PROC(ProcXF86BigfontQueryFont);
static DISPATCH_PROC(SProcXF86BigfontDispatch);
static DISPATCH_PROC(SProcXF86BigfontQueryVersion);
static DISPATCH_PROC(SProcXF86BigfontQueryFont);
#if 0
static unsigned char XF86BigfontReqCode;
#endif
#ifdef HAS_SHM
/* A random signature, transmitted to the clients so they can verify that the
shared memory segment they are attaching to was really established by the
X server they are talking to. */
static CARD32 signature;
/* Index for additional information stored in a FontRec's devPrivates array. */
static int FontShmdescIndex;
static unsigned int pagesize;
static Bool badSysCall = FALSE;
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
static void
SigSysHandler(
int signo)
{
badSysCall = TRUE;
}
static Bool
CheckForShmSyscall(void)
{
void (*oldHandler)(int);
int shmid = -1;
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
oldHandler = OsSignal(SIGSYS, SigSysHandler);
badSysCall = FALSE;
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
if (shmid != -1)
{
/* Successful allocation - clean up */
shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL);
}
else
{
/* Allocation failed */
badSysCall = TRUE;
}
OsSignal(SIGSYS, oldHandler);
return (!badSysCall);
}
#define MUST_CHECK_FOR_SHM_SYSCALL
#endif
#endif
void
XFree86BigfontExtensionInit()
{
#if 0
ExtensionEntry* extEntry;
if ((extEntry = AddExtension(XF86BIGFONTNAME,
XF86BigfontNumberEvents,
XF86BigfontNumberErrors,
ProcXF86BigfontDispatch,
SProcXF86BigfontDispatch,
XF86BigfontResetProc,
StandardMinorOpcode))) {
XF86BigfontReqCode = (unsigned char) extEntry->base;
#else
if (AddExtension(XF86BIGFONTNAME,
XF86BigfontNumberEvents,
XF86BigfontNumberErrors,
ProcXF86BigfontDispatch,
SProcXF86BigfontDispatch,
XF86BigfontResetProc,
StandardMinorOpcode)) {
#endif
#ifdef HAS_SHM
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
/*
* Note: Local-clients will not be optimized without shared memory
* support. Remote-client optimization does not depend on shared
* memory support. Thus, the extension is still registered even
* when shared memory support is not functional.
*/
if (!CheckForShmSyscall()) {
ErrorF(XF86BIGFONTNAME " extension local-client optimization disabled due to lack of shared memory support in the kernel\n");
return;
}
#endif
srand((unsigned int) time(NULL));
signature = ((unsigned int) (65536.0/(RAND_MAX+1.0) * rand()) << 16)
+ (unsigned int) (65536.0/(RAND_MAX+1.0) * rand());
/* fprintf(stderr, "signature = 0x%08X\n", signature); */
#ifdef HAS_XFONT2
FontShmdescIndex = xfont2_allocate_font_private_index();
#else
FontShmdescIndex = AllocateFontPrivateIndex();
#endif /* HAS_XFONT2 */
#if !defined(CSRG_BASED) && !defined(__CYGWIN__)
pagesize = SHMLBA;
#else
# ifdef _SC_PAGESIZE
pagesize = sysconf(_SC_PAGESIZE);
# else
pagesize = getpagesize();
# endif
#endif
#endif
}
}
/* ========== Management of shared memory segments ========== */
#ifdef HAS_SHM
#ifdef __linux__
/* On Linux, shared memory marked as "removed" can still be attached.
Nice feature, because the kernel will automatically free the associated
storage when the server and all clients are gone. */
#define EARLY_REMOVE
#endif
typedef struct _ShmDesc {
struct _ShmDesc *next;
struct _ShmDesc **prev;
int shmid;
char *attach_addr;
} ShmDescRec, *ShmDescPtr;
static ShmDescPtr ShmList = (ShmDescPtr) NULL;
static ShmDescPtr
shmalloc(
unsigned int size)
{
ShmDescPtr pDesc;
int shmid;
char *addr;
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
if (pagesize == 0)
return (ShmDescPtr) NULL;
#endif
/* On some older Linux systems, the number of shared memory segments
system-wide is 127. In Linux 2.4, it is 4095.
Therefore there is a tradeoff to be made between allocating a
shared memory segment on one hand, and allocating memory and piping
the glyph metrics on the other hand. If the glyph metrics size is
small, we prefer the traditional way. */
if (size < 3500)
return (ShmDescPtr) NULL;
pDesc = (ShmDescRec *) malloc(sizeof(ShmDescRec));
if (!pDesc)
return (ShmDescPtr) NULL;
size = (size + pagesize-1) & -pagesize;
shmid = shmget(IPC_PRIVATE, size, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
if (shmid == -1) {
ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, errno = %d\n",
size, errno);
free(pDesc);
return (ShmDescPtr) NULL;
}
if ((addr = shmat(shmid, 0, 0)) == (char *)-1) {
ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, errno = %d\n",
size, errno);
shmctl(shmid, IPC_RMID, (void *) 0);
free(pDesc);
return (ShmDescPtr) NULL;
}
#ifdef EARLY_REMOVE
shmctl(shmid, IPC_RMID, (void *) 0);
#endif
pDesc->shmid = shmid;
pDesc->attach_addr = addr;
if (ShmList) ShmList->prev = &pDesc->next;
pDesc->next = ShmList;
pDesc->prev = &ShmList;
ShmList = pDesc;
return pDesc;
}
static void
shmdealloc(
ShmDescPtr pDesc)
{
#ifndef EARLY_REMOVE
shmctl(pDesc->shmid, IPC_RMID, (void *) 0);
#endif
shmdt(pDesc->attach_addr);
if (pDesc->next) pDesc->next->prev = pDesc->prev;
*pDesc->prev = pDesc->next;
free(pDesc);
}
#endif
/* Called when a font is closed. */
void
XF86BigfontFreeFontShm(
FontPtr pFont)
{
#ifdef HAS_SHM
ShmDescPtr pDesc;
/* If during shutdown of the server, XF86BigfontCleanup() has already
* called shmdealloc() for all segments, we don't need to do it here.
*/
if (!ShmList)
return;
pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
if (pDesc)
shmdealloc(pDesc);
#endif
}
/* Called upon fatal signal. */
void
XF86BigfontCleanup()
{
#ifdef HAS_SHM
while (ShmList)
shmdealloc(ShmList);
#endif
}
/* Called when a server generation dies. */
static void
XF86BigfontResetProc(
ExtensionEntry* extEntry)
{
/* This function is normally called from CloseDownExtensions(), called
* from main(). It will be followed by a call to FreeAllResources(),
* which will call XF86BigfontFreeFontShm() for each font. Thus it
* appears that we do not need to do anything in this function. --
* But I prefer to write robust code, and not keep shared memory lying
* around when it's not needed any more. (Someone might close down the
* extension without calling FreeAllResources()...)
*/
XF86BigfontCleanup();
}
/* ========== Handling of extension specific requests ========== */
static int
ProcXF86BigfontQueryVersion(
ClientPtr client)
{
xXF86BigfontQueryVersionReply reply;
REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
memset(&reply, 0, sizeof(xXF86BigfontQueryVersionReply));
reply.type = X_Reply;
reply.length = 0;
reply.sequenceNumber = client->sequence;
reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION;
reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION;
reply.uid = geteuid();
reply.gid = getegid();
#ifdef HAS_SHM
reply.signature = signature;
#else
reply.signature = 0; /* This is redundant. Avoids uninitialized memory. */
#endif
reply.capabilities =
#ifdef HAS_SHM
(client->local && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
#else
0
#endif
; /* may add more bits here in future versions */
if (client->swapped) {
swaps(&reply.sequenceNumber);
swapl(&reply.length);
swaps(&reply.majorVersion);
swaps(&reply.minorVersion);
swapl(&reply.uid);
swapl(&reply.gid);
swapl(&reply.signature);
}
WriteToClient(client,
sizeof(xXF86BigfontQueryVersionReply), &reply);
return client->noClientException;
}
static void
swapCharInfo(
xCharInfo *pCI)
{
swaps(&pCI->leftSideBearing);
swaps(&pCI->rightSideBearing);
swaps(&pCI->characterWidth);
swaps(&pCI->ascent);
swaps(&pCI->descent);
swaps(&pCI->attributes);
}
/* static CARD32 hashCI (xCharInfo *p); */
#define hashCI(p) \
(CARD32)(((p->leftSideBearing << 27) + (p->leftSideBearing >> 5) + \
(p->rightSideBearing << 23) + (p->rightSideBearing >> 9) + \
(p->characterWidth << 16) + \
(p->ascent << 11) + (p->descent << 6)) ^ p->attributes)
static int
ProcXF86BigfontQueryFont(
ClientPtr client)
{
FontPtr pFont;
REQUEST(xXF86BigfontQueryFontReq);
CARD32 stuff_flags;
xCharInfo* pmax;
xCharInfo* pmin;
int nCharInfos;
int shmid;
#ifdef HAS_SHM
ShmDescPtr pDesc = NULL;
#else
#define pDesc 0
#endif
xCharInfo* pCI;
CARD16* pIndex2UniqIndex;
CARD16* pUniqIndex2Index;
CARD32 nUniqCharInfos;
#if 0
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
#else
switch (client->req_len) {
case 2: /* client with version 1.0 libX11 */
stuff_flags = (client->local && !client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
break;
case 3: /* client with version 1.1 libX11 */
stuff_flags = stuff->flags;
break;
default:
return BadLength;
}
#endif
client->errorValue = stuff->id; /* EITHER font or gc */
pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT,
DixReadAccess);
if (!pFont) {
/* can't use VERIFY_GC because it might return BadGC */
GC *pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC,
DixReadAccess);
if (!pGC) {
client->errorValue = stuff->id;
return BadFont; /* procotol spec says only error is BadFont */
}
pFont = pGC->font;
}
pmax = FONTINKMAX(pFont);
pmin = FONTINKMIN(pFont);
nCharInfos =
(pmax->rightSideBearing == pmin->rightSideBearing
&& pmax->leftSideBearing == pmin->leftSideBearing
&& pmax->descent == pmin->descent
&& pmax->ascent == pmin->ascent
&& pmax->characterWidth == pmin->characterWidth)
? 0 : N2dChars(pFont);
shmid = -1;
pCI = NULL;
pIndex2UniqIndex = NULL;
pUniqIndex2Index = NULL;
nUniqCharInfos = 0;
if (nCharInfos > 0) {
#ifdef HAS_SHM
if (!badSysCall)
pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
else
pDesc = NULL;
if (pDesc) {
pCI = (xCharInfo *) pDesc->attach_addr;
if (stuff_flags & XF86Bigfont_FLAGS_Shm)
shmid = pDesc->shmid;
} else {
if (stuff_flags & XF86Bigfont_FLAGS_Shm && !badSysCall)
pDesc = shmalloc(nCharInfos * sizeof(xCharInfo)
+ sizeof(CARD32));
if (pDesc) {
pCI = (xCharInfo *) pDesc->attach_addr;
shmid = pDesc->shmid;
} else {
#endif
pCI = (xCharInfo *)
malloc(nCharInfos * sizeof(xCharInfo));
if (!pCI)
return BadAlloc;
#ifdef HAS_SHM
}
#endif
/* Fill nCharInfos starting at pCI. */
{
xCharInfo* prCI = pCI;
int ninfos = 0;
int ncols = pFont->info.lastCol - pFont->info.firstCol + 1;
int row;
for (row = pFont->info.firstRow;
row <= pFont->info.lastRow && ninfos < nCharInfos;
row++) {
unsigned char chars[512];
xCharInfo* tmpCharInfos[256];
unsigned long count;
int col;
unsigned long i;
i = 0;
for (col = pFont->info.firstCol;
col <= pFont->info.lastCol;
col++) {
chars[i++] = row;
chars[i++] = col;
}
(*pFont->get_metrics) (pFont, ncols, chars, TwoD16Bit,
&count, tmpCharInfos);
for (i = 0; i < count && ninfos < nCharInfos; i++) {
*prCI++ = *tmpCharInfos[i];
ninfos++;
}
}
}
#ifdef HAS_SHM
if (pDesc && !badSysCall) {
*(CARD32 *)(pCI + nCharInfos) = signature;
#ifdef HAS_XFONT2
if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) {
#else
if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) {
#endif /* HAS_XFONT2 */
shmdealloc(pDesc);
return BadAlloc;
}
}
}
#endif
if (shmid == -1) {
/* Cannot use shared memory, so remove-duplicates the xCharInfos
using a temporary hash table. */
/* Note that CARD16 is suitable as index type, because
nCharInfos <= 0x10000. */
CARD32 hashModulus;
CARD16* pHash2UniqIndex;
CARD16* pUniqIndex2NextUniqIndex;
CARD32 NextIndex;
CARD32 NextUniqIndex;
CARD16* tmp;
CARD32 i, j;
hashModulus = 67;
if (hashModulus > nCharInfos+1)
hashModulus = nCharInfos+1;
tmp = (CARD16*)
malloc((4*nCharInfos+1) * sizeof(CARD16));
if (!tmp) {
if (!pDesc) free(pCI);
return BadAlloc;
}
pIndex2UniqIndex = tmp;
/* nCharInfos elements */
pUniqIndex2Index = tmp + nCharInfos;
/* max. nCharInfos elements */
pUniqIndex2NextUniqIndex = tmp + 2*nCharInfos;
/* max. nCharInfos elements */
pHash2UniqIndex = tmp + 3*nCharInfos;
/* hashModulus (<= nCharInfos+1) elements */
/* Note that we can use 0xffff as end-of-list indicator, because
even if nCharInfos = 0x10000, 0xffff can not occur as valid
entry before the last element has been inserted. And once the
last element has been inserted, we don't need the hash table
any more. */
for (j = 0; j < hashModulus; j++)
pHash2UniqIndex[j] = (CARD16)(-1);
NextUniqIndex = 0;
for (NextIndex = 0; NextIndex < nCharInfos; NextIndex++) {
xCharInfo* p = &pCI[NextIndex];
CARD32 hashCode = hashCI(p) % hashModulus;
for (i = pHash2UniqIndex[hashCode];
i != (CARD16)(-1);
i = pUniqIndex2NextUniqIndex[i]) {
j = pUniqIndex2Index[i];
if (pCI[j].leftSideBearing == p->leftSideBearing
&& pCI[j].rightSideBearing == p->rightSideBearing
&& pCI[j].characterWidth == p->characterWidth
&& pCI[j].ascent == p->ascent
&& pCI[j].descent == p->descent
&& pCI[j].attributes == p->attributes)
break;
}
if (i != (CARD16)(-1)) {
/* Found *p at Index j, UniqIndex i */
pIndex2UniqIndex[NextIndex] = i;
} else {
/* Allocate a new entry in the Uniq table */
if (hashModulus <= 2*NextUniqIndex
&& hashModulus < nCharInfos+1) {
/* Time to increate hash table size */
hashModulus = 2*hashModulus+1;
if (hashModulus > nCharInfos+1)
hashModulus = nCharInfos+1;
for (j = 0; j < hashModulus; j++)
pHash2UniqIndex[j] = (CARD16)(-1);
for (i = 0; i < NextUniqIndex; i++)
pUniqIndex2NextUniqIndex[i] = (CARD16)(-1);
for (i = 0; i < NextUniqIndex; i++) {
j = pUniqIndex2Index[i];
p = &pCI[j];
hashCode = hashCI(p) % hashModulus;
pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode];
pHash2UniqIndex[hashCode] = i;
}
p = &pCI[NextIndex];
hashCode = hashCI(p) % hashModulus;
}
i = NextUniqIndex++;
pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode];
pHash2UniqIndex[hashCode] = i;
pUniqIndex2Index[i] = NextIndex;
pIndex2UniqIndex[NextIndex] = i;
}
}
nUniqCharInfos = NextUniqIndex;
/* fprintf(stderr, "font metrics: nCharInfos = %d, nUniqCharInfos = %d, hashModulus = %d\n", nCharInfos, nUniqCharInfos, hashModulus); */
}
}
{
int nfontprops = pFont->info.nprops;
int rlength =
sizeof(xXF86BigfontQueryFontReply)
+ nfontprops * sizeof(xFontProp)
+ (nCharInfos > 0 && shmid == -1
? nUniqCharInfos * sizeof(xCharInfo)
+ (nCharInfos+1)/2 * 2 * sizeof(CARD16)
: 0);
xXF86BigfontQueryFontReply* reply =
(xXF86BigfontQueryFontReply *) calloc(1, rlength);
char* p;
if (!reply) {
if (nCharInfos > 0) {
if (shmid == -1) free(pIndex2UniqIndex);
if (!pDesc) free(pCI);
}
return BadAlloc;
}
reply->type = X_Reply;
reply->length = (rlength - sizeof(xGenericReply)) >> 2;
reply->sequenceNumber = client->sequence;
reply->minBounds = pFont->info.ink_minbounds;
reply->maxBounds = pFont->info.ink_maxbounds;
reply->minCharOrByte2 = pFont->info.firstCol;
reply->maxCharOrByte2 = pFont->info.lastCol;
reply->defaultChar = pFont->info.defaultCh;
reply->nFontProps = pFont->info.nprops;
reply->drawDirection = pFont->info.drawDirection;
reply->minByte1 = pFont->info.firstRow;
reply->maxByte1 = pFont->info.lastRow;
reply->allCharsExist = pFont->info.allExist;
reply->fontAscent = pFont->info.fontAscent;
reply->fontDescent = pFont->info.fontDescent;
reply->nCharInfos = nCharInfos;
reply->nUniqCharInfos = nUniqCharInfos;
reply->shmid = shmid;
reply->shmsegoffset = 0;
if (client->swapped) {
swaps(&reply->sequenceNumber);
swapl(&reply->length);
swapCharInfo(&reply->minBounds);
swapCharInfo(&reply->maxBounds);
swaps(&reply->minCharOrByte2);
swaps(&reply->maxCharOrByte2);
swaps(&reply->defaultChar);
swaps(&reply->nFontProps);
swaps(&reply->fontAscent);
swaps(&reply->fontDescent);
swapl(&reply->nCharInfos);
swapl(&reply->nUniqCharInfos);
swapl(&reply->shmid);
swapl(&reply->shmsegoffset);
}
p = (char*) &reply[1];
{
FontPropPtr pFP;
xFontProp* prFP;
int i;
for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) p;
i < nfontprops;
i++, pFP++, prFP++) {
prFP->name = pFP->name;
prFP->value = pFP->value;
if (client->swapped) {
swapl(&prFP->name);
swapl(&prFP->value);
}
}
p = (char*) prFP;
}
if (nCharInfos > 0 && shmid == -1) {
xCharInfo* pci;
CARD16* ps;
int i, j;
pci = (xCharInfo*) p;
for (i = 0; i < nUniqCharInfos; i++, pci++) {
*pci = pCI[pUniqIndex2Index[i]];
if (client->swapped)
swapCharInfo(pci);
}
ps = (CARD16*) pci;
for (j = 0; j < nCharInfos; j++, ps++) {
*ps = pIndex2UniqIndex[j];
if (client->swapped) {
swaps(ps);
}
}
}
WriteToClient(client, rlength, reply);
free(reply);
if (nCharInfos > 0) {
if (shmid == -1) free(pIndex2UniqIndex);
if (!pDesc) free(pCI);
}
return (client->noClientException);
}
}
static int
ProcXF86BigfontDispatch(
ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_XF86BigfontQueryVersion:
return ProcXF86BigfontQueryVersion(client);
case X_XF86BigfontQueryFont:
return ProcXF86BigfontQueryFont(client);
default:
return BadRequest;
}
}
static int
SProcXF86BigfontQueryVersion(
ClientPtr client)
{
REQUEST(xXF86BigfontQueryVersionReq);
swaps(&stuff->length);
return ProcXF86BigfontQueryVersion(client);
}
static int
SProcXF86BigfontQueryFont(
ClientPtr client)
{
REQUEST(xXF86BigfontQueryFontReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
swapl(&stuff->id);
return ProcXF86BigfontQueryFont(client);
}
static int
SProcXF86BigfontDispatch(
ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_XF86BigfontQueryVersion:
return SProcXF86BigfontQueryVersion(client);
case X_XF86BigfontQueryFont:
return SProcXF86BigfontQueryFont(client);
default:
return BadRequest;
}
}

View File

@@ -0,0 +1,378 @@
/*
Copyright (c) 2002 XFree86 Inc
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.h"
#include <nx-X11/extensions/XResproto.h>
#include "pixmapstr.h"
#include "windowstr.h"
#include "gcstruct.h"
#include "protocol-versions.h"
static int
ProcXResQueryVersion (ClientPtr client)
{
xXResQueryVersionReply rep;
REQUEST_SIZE_MATCH (xXResQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.server_major = SERVER_XRES_MAJOR_VERSION;
rep.server_minor = SERVER_XRES_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.server_major);
swaps(&rep.server_minor);
}
WriteToClient(client, sizeof (xXResQueryVersionReply), &rep);
return (client->noClientException);
}
static int
ProcXResQueryClients (ClientPtr client)
{
/* REQUEST(xXResQueryClientsReq); */
xXResQueryClientsReply rep;
int *current_clients;
int i, num_clients;
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
current_clients = malloc((currentMaxClients - 1) * sizeof(int));
num_clients = 0;
for(i = 1; i < currentMaxClients; i++) {
if(clients[i]) {
current_clients[num_clients] = i;
num_clients++;
}
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.num_clients = num_clients;
rep.length = rep.num_clients * sz_xXResClient >> 2;
if (client->swapped) {
swaps (&rep.sequenceNumber);
swapl (&rep.length);
swapl (&rep.num_clients);
}
WriteToClient (client, sizeof (xXResQueryClientsReply), &rep);
if(num_clients) {
xXResClient scratch;
for(i = 0; i < num_clients; i++) {
scratch.resource_base = clients[current_clients[i]]->clientAsMask;
scratch.resource_mask = RESOURCE_ID_MASK;
if(client->swapped) {
swapl (&scratch.resource_base);
swapl (&scratch.resource_mask);
}
WriteToClient (client, sz_xXResClient, &scratch);
}
}
free(current_clients);
return (client->noClientException);
}
static void
ResFindAllRes (void * value, XID id, RESTYPE type, void * cdata)
{
int *counts = (int *)cdata;
counts[(type & TypeMask) - 1]++;
}
static int
ProcXResQueryClientResources (ClientPtr client)
{
REQUEST(xXResQueryClientResourcesReq);
xXResQueryClientResourcesReply rep;
int i, clientID, num_types;
int *counts;
REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq);
clientID = CLIENT_ID(stuff->xid);
/* we could remove the (clientID == 0) check if we wanted to allow
probing the X-server's resource usage */
if(!clientID || (clientID >= currentMaxClients) || !clients[clientID]) {
client->errorValue = stuff->xid;
return BadValue;
}
counts = malloc((lastResourceType + 1) * sizeof(int));
memset(counts, 0, (lastResourceType + 1) * sizeof(int));
FindAllClientResources(clients[clientID], ResFindAllRes, counts);
num_types = 0;
for(i = 0; i <= lastResourceType; i++) {
if(counts[i]) num_types++;
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.num_types = num_types;
rep.length = rep.num_types * sz_xXResType >> 2;
if (client->swapped) {
swaps (&rep.sequenceNumber);
swapl (&rep.length);
swapl (&rep.num_types);
}
WriteToClient (client,sizeof(xXResQueryClientResourcesReply),&rep);
if(num_types) {
xXResType scratch;
for(i = 0; i < lastResourceType; i++) {
if(!counts[i]) continue;
if(!ResourceNames[i + 1]) {
char buf[40];
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
RegisterResourceName(i + 1, buf);
}
scratch.resource_type = ResourceNames[i + 1];
scratch.count = counts[i];
if(client->swapped) {
swapl (&scratch.resource_type);
swapl (&scratch.count);
}
WriteToClient (client, sz_xXResType, &scratch);
}
}
free(counts);
return (client->noClientException);
}
static unsigned long
ResGetApproxPixmapBytes (PixmapPtr pix)
{
unsigned long nPixels;
int bytesPerPixel;
bytesPerPixel = pix->drawable.bitsPerPixel>>3;
nPixels = pix->drawable.width * pix->drawable.height;
/* Divide by refcnt as pixmap could be shared between clients,
* so total pixmap mem is shared between these.
*/
return ( nPixels * bytesPerPixel ) / pix->refcnt;
}
static void
ResFindPixmaps (void * value, XID id, void * cdata)
{
unsigned long *bytes = (unsigned long *)cdata;
PixmapPtr pix = (PixmapPtr)value;
*bytes += ResGetApproxPixmapBytes(pix);
}
static void
ResFindWindowPixmaps (void * value, XID id, void * cdata)
{
unsigned long *bytes = (unsigned long *)cdata;
WindowPtr pWin = (WindowPtr)value;
if (pWin->backgroundState == BackgroundPixmap)
*bytes += ResGetApproxPixmapBytes(pWin->background.pixmap);
if (pWin->border.pixmap != NULL && !pWin->borderIsPixel)
*bytes += ResGetApproxPixmapBytes(pWin->border.pixmap);
}
static void
ResFindGCPixmaps (void * value, XID id, void * cdata)
{
unsigned long *bytes = (unsigned long *)cdata;
GCPtr pGC = (GCPtr)value;
if (pGC->stipple != NULL)
*bytes += ResGetApproxPixmapBytes(pGC->stipple);
if (pGC->tile.pixmap != NULL && !pGC->tileIsPixel)
*bytes += ResGetApproxPixmapBytes(pGC->tile.pixmap);
}
static int
ProcXResQueryClientPixmapBytes (ClientPtr client)
{
REQUEST(xXResQueryClientPixmapBytesReq);
xXResQueryClientPixmapBytesReply rep;
int clientID;
unsigned long bytes;
REQUEST_SIZE_MATCH(xXResQueryClientPixmapBytesReq);
clientID = CLIENT_ID(stuff->xid);
/* we could remove the (clientID == 0) check if we wanted to allow
probing the X-server's resource usage */
if(!clientID || (clientID >= currentMaxClients) || !clients[clientID]) {
client->errorValue = stuff->xid;
return BadValue;
}
bytes = 0;
FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps,
(void *)(&bytes));
/*
* Make sure win background pixmaps also held to account.
*/
FindClientResourcesByType(clients[clientID], RT_WINDOW,
ResFindWindowPixmaps,
(void *)(&bytes));
/*
* GC Tile & Stipple pixmaps too.
*/
FindClientResourcesByType(clients[clientID], RT_GC,
ResFindGCPixmaps,
(void *)(&bytes));
#ifdef COMPOSITE
/* FIXME: include composite pixmaps too */
#endif
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.bytes = bytes;
#ifdef _XSERVER64
rep.bytes_overflow = bytes >> 32;
#else
rep.bytes_overflow = 0;
#endif
if (client->swapped) {
swaps (&rep.sequenceNumber);
swapl (&rep.length);
swapl (&rep.bytes);
swapl (&rep.bytes_overflow);
}
WriteToClient (client,sizeof(xXResQueryClientPixmapBytesReply),&rep);
return (client->noClientException);
}
static void
ResResetProc (ExtensionEntry *extEntry) { }
static int
ProcResDispatch (ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_XResQueryVersion:
return ProcXResQueryVersion(client);
case X_XResQueryClients:
return ProcXResQueryClients(client);
case X_XResQueryClientResources:
return ProcXResQueryClientResources(client);
case X_XResQueryClientPixmapBytes:
return ProcXResQueryClientPixmapBytes(client);
default: break;
}
return BadRequest;
}
static int
SProcXResQueryVersion (ClientPtr client)
{
REQUEST_SIZE_MATCH (xXResQueryVersionReq);
return ProcXResQueryVersion(client);
}
static int
SProcXResQueryClientResources (ClientPtr client)
{
REQUEST(xXResQueryClientResourcesReq);
REQUEST_SIZE_MATCH (xXResQueryClientResourcesReq);
swapl(&stuff->xid);
return ProcXResQueryClientResources(client);
}
static int
SProcXResQueryClientPixmapBytes (ClientPtr client)
{
REQUEST(xXResQueryClientPixmapBytesReq);
REQUEST_SIZE_MATCH (xXResQueryClientPixmapBytesReq);
swapl(&stuff->xid);
return ProcXResQueryClientPixmapBytes(client);
}
static int
SProcResDispatch (ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_XResQueryVersion:
return SProcXResQueryVersion(client);
case X_XResQueryClients: /* nothing to swap */
return ProcXResQueryClients(client);
case X_XResQueryClientResources:
return SProcXResQueryClientResources(client);
case X_XResQueryClientPixmapBytes:
return SProcXResQueryClientPixmapBytes(client);
default: break;
}
return BadRequest;
}
void
ResExtensionInit(void)
{
(void) AddExtension(XRES_NAME, 0, 0,
ProcResDispatch, SProcResDispatch,
ResResetProc, StandardMinorOpcode);
RegisterResourceName(RT_NONE, "NONE");
RegisterResourceName(RT_WINDOW, "WINDOW");
RegisterResourceName(RT_PIXMAP, "PIXMAP");
RegisterResourceName(RT_GC, "GC");
RegisterResourceName(RT_FONT, "FONT");
RegisterResourceName(RT_CURSOR, "CURSOR");
RegisterResourceName(RT_COLORMAP, "COLORMAP");
RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY");
RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT");
RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB");
}

View File

@@ -0,0 +1,594 @@
/*
Copyright 1992, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "windowstr.h"
#include "inputstr.h"
#include "scrnintstr.h"
#include "dixevents.h"
#include "sleepuntil.h"
#define _XTEST_SERVER_
#include <nx-X11/extensions/xtestconst.h>
#include <nx-X11/extensions/xteststr.h>
#ifdef XINPUT
#include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h>
#define EXTENSION_EVENT_BASE 64
#include "extinit.h" /* LookupDeviceIntRec */
#endif /* XINPUT */
#if 0
static unsigned char XTestReqCode;
#endif
#ifdef XINPUT
extern int DeviceValuator;
#endif /* XINPUT */
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
static void XTestResetProc(
ExtensionEntry * /* extEntry */
);
static int XTestSwapFakeInput(
ClientPtr /* client */,
xReq * /* req */
);
static DISPATCH_PROC(ProcXTestCompareCursor);
static DISPATCH_PROC(ProcXTestDispatch);
static DISPATCH_PROC(ProcXTestFakeInput);
static DISPATCH_PROC(ProcXTestGetVersion);
static DISPATCH_PROC(ProcXTestGrabControl);
static DISPATCH_PROC(SProcXTestCompareCursor);
static DISPATCH_PROC(SProcXTestDispatch);
static DISPATCH_PROC(SProcXTestFakeInput);
static DISPATCH_PROC(SProcXTestGetVersion);
static DISPATCH_PROC(SProcXTestGrabControl);
void
XTestExtensionInit(void)
{
#if 0
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
XTestResetProc, StandardMinorOpcode)) != 0)
XTestReqCode = (unsigned char)extEntry->base;
#else
(void) AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
XTestResetProc, StandardMinorOpcode);
#endif
}
/*ARGSUSED*/
static void
XTestResetProc (extEntry)
ExtensionEntry *extEntry;
{
}
static int
ProcXTestGetVersion(client)
register ClientPtr client;
{
xXTestGetVersionReply rep = {0};
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XTestMajorVersion;
rep.minorVersion = XTestMinorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xXTestGetVersionReply), &rep);
return(client->noClientException);
}
static int
ProcXTestCompareCursor(client)
register ClientPtr client;
{
REQUEST(xXTestCompareCursorReq);
xXTestCompareCursorReply rep = {0};
WindowPtr pWin;
CursorPtr pCursor;
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
pWin = (WindowPtr)LookupWindow(stuff->window, client);
if (!pWin)
return(BadWindow);
if (stuff->cursor == None)
pCursor = NullCursor;
else if (stuff->cursor == XTestCurrentCursor)
pCursor = GetSpriteCursor();
else {
pCursor = (CursorPtr)LookupIDByType(stuff->cursor, RT_CURSOR);
if (!pCursor)
{
client->errorValue = stuff->cursor;
return (BadCursor);
}
}
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.same = (wCursor(pWin) == pCursor);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xXTestCompareCursorReply), &rep);
return(client->noClientException);
}
static int
ProcXTestFakeInput(client)
register ClientPtr client;
{
REQUEST(xXTestFakeInputReq);
int nev, n, type;
xEvent *ev;
DeviceIntPtr dev = NULL;
WindowPtr root;
#ifdef XINPUT
Bool extension = FALSE;
deviceValuator *dv = NULL;
int base;
int *values;
#endif /* XINPUT */
nev = (stuff->length << 2) - sizeof(xReq);
if ((nev % sizeof(xEvent)) || !nev)
return BadLength;
nev /= sizeof(xEvent);
UpdateCurrentTime();
ev = (xEvent *)&((xReq *)stuff)[1];
type = ev->u.u.type & 0177;
#ifdef XINPUT
if (type >= EXTENSION_EVENT_BASE)
{
type -= DeviceValuator;
switch (type) {
case XI_DeviceKeyPress:
case XI_DeviceKeyRelease:
case XI_DeviceButtonPress:
case XI_DeviceButtonRelease:
case XI_DeviceMotionNotify:
case XI_ProximityIn:
case XI_ProximityOut:
break;
default:
client->errorValue = ev->u.u.type;
return BadValue;
}
if (nev == 1 && type == XI_DeviceMotionNotify)
return BadLength;
if (type == XI_DeviceMotionNotify)
base = ((deviceValuator *)(ev+1))->first_valuator;
else
base = 0;
for (n = 1; n < nev; n++)
{
dv = (deviceValuator *)(ev + n);
if (dv->type != DeviceValuator)
{
client->errorValue = dv->type;
return BadValue;
}
if (dv->first_valuator != base)
{
client->errorValue = dv->first_valuator;
return BadValue;
}
if (!dv->num_valuators || dv->num_valuators > 6)
{
client->errorValue = dv->num_valuators;
return BadValue;
}
base += dv->num_valuators;
}
type = type - XI_DeviceKeyPress + KeyPress;
extension = TRUE;
}
else
#endif /* XINPUT */
{
if (nev != 1)
return BadLength;
switch (type)
{
case KeyPress:
case KeyRelease:
case MotionNotify:
case ButtonPress:
case ButtonRelease:
break;
default:
client->errorValue = ev->u.u.type;
return BadValue;
}
}
if (ev->u.keyButtonPointer.time)
{
TimeStamp activateTime;
CARD32 ms;
activateTime = currentTime;
ms = activateTime.milliseconds + ev->u.keyButtonPointer.time;
if (ms < activateTime.milliseconds)
activateTime.months++;
activateTime.milliseconds = ms;
ev->u.keyButtonPointer.time = 0;
/* see mbuf.c:QueueDisplayRequest for code similar to this */
if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
{
return BadAlloc;
}
/* swap the request back so we can simply re-execute it */
if (client->swapped)
{
(void) XTestSwapFakeInput(client, (xReq *)stuff);
swaps(&stuff->length);
}
ResetCurrentRequest (client);
client->sequence--;
return Success;
}
#ifdef XINPUT
if (extension)
{
dev = LookupDeviceIntRec(stuff->deviceid & 0177);
if (!dev)
{
client->errorValue = stuff->deviceid & 0177;
return BadValue;
}
if (nev > 1)
{
dv = (deviceValuator *)(ev + 1);
if (!dev->valuator || dv->first_valuator >= dev->valuator->numAxes)
{
client->errorValue = dv->first_valuator;
return BadValue;
}
if (dv->first_valuator + dv->num_valuators >
dev->valuator->numAxes)
{
client->errorValue = dv->num_valuators;
return BadValue;
}
}
}
#endif /* XINPUT */
switch (type)
{
case KeyPress:
case KeyRelease:
#ifdef XINPUT
if (!extension)
#endif /* XINPUT */
dev = (DeviceIntPtr)LookupKeyboardDevice();
if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode ||
ev->u.u.detail > dev->key->curKeySyms.maxKeyCode)
{
client->errorValue = ev->u.u.detail;
return BadValue;
}
break;
case MotionNotify:
#ifdef XINPUT
if (extension)
{
if (ev->u.u.detail != xFalse && ev->u.u.detail != xTrue)
{
client->errorValue = ev->u.u.detail;
return BadValue;
}
if (ev->u.u.detail == xTrue && dev->valuator->mode == Absolute)
{
values = dev->valuator->axisVal + dv->first_valuator;
for (n = 1; n < nev; n++)
{
dv = (deviceValuator *)(ev + n);
switch (dv->num_valuators)
{
case 6:
dv->valuator5 += values[5];
case 5:
dv->valuator4 += values[4];
case 4:
dv->valuator3 += values[3];
case 3:
dv->valuator2 += values[2];
case 2:
dv->valuator1 += values[1];
case 1:
dv->valuator0 += values[0];
}
values += 6;
}
}
break;
}
#endif /* XINPUT */
dev = (DeviceIntPtr)LookupPointerDevice();
if (ev->u.keyButtonPointer.root == None)
root = GetCurrentRootWindow();
else
{
root = LookupWindow(ev->u.keyButtonPointer.root, client);
if (!root)
return BadWindow;
if (root->parent)
{
client->errorValue = ev->u.keyButtonPointer.root;
return BadValue;
}
}
if (ev->u.u.detail == xTrue)
{
int x, y;
GetSpritePosition(&x, &y);
ev->u.keyButtonPointer.rootX += x;
ev->u.keyButtonPointer.rootY += y;
}
else if (ev->u.u.detail != xFalse)
{
client->errorValue = ev->u.u.detail;
return BadValue;
}
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
ScreenPtr pScreen = root->drawable.pScreen;
BoxRec box;
int i;
int x = ev->u.keyButtonPointer.rootX + panoramiXdataPtr[0].x;
int y = ev->u.keyButtonPointer.rootY + panoramiXdataPtr[0].y;
if (!RegionContainsPoint(&XineramaScreenRegions[pScreen->myNum],
x, y, &box)) {
FOR_NSCREENS(i) {
if (i == pScreen->myNum) continue;
if (RegionContainsPoint(
&XineramaScreenRegions[i],
x, y, &box)) {
root = screenInfo.screens[i]->root;
x -= panoramiXdataPtr[i].x;
y -= panoramiXdataPtr[i].y;
ev->u.keyButtonPointer.rootX = x;
ev->u.keyButtonPointer.rootY = y;
break;
}
}
}
}
#endif
if (ev->u.keyButtonPointer.rootX < 0)
ev->u.keyButtonPointer.rootX = 0;
else if (ev->u.keyButtonPointer.rootX >= root->drawable.width)
ev->u.keyButtonPointer.rootX = root->drawable.width - 1;
if (ev->u.keyButtonPointer.rootY < 0)
ev->u.keyButtonPointer.rootY = 0;
else if (ev->u.keyButtonPointer.rootY >= root->drawable.height)
ev->u.keyButtonPointer.rootY = root->drawable.height - 1;
#ifdef PANORAMIX
if ((!noPanoramiXExtension
&& root->drawable.pScreen->myNum != XineramaGetCursorScreen())
|| (noPanoramiXExtension && root != GetCurrentRootWindow()))
#else
if (root != GetCurrentRootWindow())
#endif
{
NewCurrentScreen(root->drawable.pScreen,
ev->u.keyButtonPointer.rootX,
ev->u.keyButtonPointer.rootY);
return client->noClientException;
}
(*root->drawable.pScreen->SetCursorPosition)
(root->drawable.pScreen,
ev->u.keyButtonPointer.rootX,
ev->u.keyButtonPointer.rootY, FALSE);
dev->valuator->lastx = ev->u.keyButtonPointer.rootX;
dev->valuator->lasty = ev->u.keyButtonPointer.rootY;
break;
case ButtonPress:
case ButtonRelease:
#ifdef XINPUT
if (!extension)
#endif /* XINPUT */
dev = (DeviceIntPtr)LookupPointerDevice();
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
{
client->errorValue = ev->u.u.detail;
return BadValue;
}
break;
}
if (screenIsSaved == SCREEN_SAVER_ON)
SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
ev->u.keyButtonPointer.time = currentTime.milliseconds;
(*dev->public.processInputProc)(ev, dev, nev);
return client->noClientException;
}
static int
ProcXTestGrabControl(client)
register ClientPtr client;
{
REQUEST(xXTestGrabControlReq);
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse))
{
client->errorValue = stuff->impervious;
return(BadValue);
}
if (stuff->impervious)
MakeClientGrabImpervious(client);
else
MakeClientGrabPervious(client);
return(client->noClientException);
}
static int
ProcXTestDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XTestGetVersion:
return ProcXTestGetVersion(client);
case X_XTestCompareCursor:
return ProcXTestCompareCursor(client);
case X_XTestFakeInput:
return ProcXTestFakeInput(client);
case X_XTestGrabControl:
return ProcXTestGrabControl(client);
default:
return BadRequest;
}
}
static int
SProcXTestGetVersion(client)
register ClientPtr client;
{
REQUEST(xXTestGetVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
swaps(&stuff->minorVersion);
return ProcXTestGetVersion(client);
}
static int
SProcXTestCompareCursor(client)
register ClientPtr client;
{
REQUEST(xXTestCompareCursorReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
swapl(&stuff->window);
swapl(&stuff->cursor);
return ProcXTestCompareCursor(client);
}
static int
XTestSwapFakeInput(client, req)
register ClientPtr client;
xReq *req;
{
register int nev;
register xEvent *ev;
xEvent sev;
EventSwapPtr proc;
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
for (ev = (xEvent *)&req[1]; --nev >= 0; ev++)
{
/* Swap event */
proc = EventSwapVector[ev->u.u.type & 0177];
/* no swapping proc; invalid event type? */
if (!proc || proc == NotImplemented) {
client->errorValue = ev->u.u.type;
return BadValue;
}
(*proc)(ev, &sev);
*ev = sev;
}
return Success;
}
static int
SProcXTestFakeInput(client)
register ClientPtr client;
{
register int n;
REQUEST(xReq);
swaps(&stuff->length);
n = XTestSwapFakeInput(client, stuff);
if (n != Success)
return n;
return ProcXTestFakeInput(client);
}
static int
SProcXTestGrabControl(client)
register ClientPtr client;
{
REQUEST(xXTestGrabControlReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
return ProcXTestGrabControl(client);
}
static int
SProcXTestDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XTestGetVersion:
return SProcXTestGetVersion(client);
case X_XTestCompareCursor:
return SProcXTestCompareCursor(client);
case X_XTestFakeInput:
return SProcXTestFakeInput(client);
case X_XTestGrabControl:
return SProcXTestGrabControl(client);
default:
return BadRequest;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
extern void XineramifyXv(void);

View File

@@ -0,0 +1,290 @@
/***********************************************************
Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef XVDIX_H
#define XVDIX_H
/*
** File:
**
** xvdix.h --- Xv device independent header file
**
** Author:
**
** David Carver (Digital Workstation Engineering/Project Athena)
**
** Revisions:
**
** 29.08.91 Carver
** - removed UnrealizeWindow wrapper unrealizing windows no longer
** preempts video
**
** 11.06.91 Carver
** - changed SetPortControl to SetPortAttribute
** - changed GetPortControl to GetPortAttribute
** - changed QueryBestSize
**
** 15.05.91 Carver
** - version 2.0 upgrade
**
** 24.01.91 Carver
** - version 1.4 upgrade
**
*/
#include "scrnintstr.h"
#include <nx-X11/extensions/Xvproto.h>
extern int XvScreenIndex;
extern unsigned long XvExtensionGeneration;
extern unsigned long XvScreenGeneration;
extern unsigned long XvResourceGeneration;
extern int XvReqCode;
extern int XvEventBase;
extern int XvErrorBase;
extern unsigned long XvRTPort;
extern unsigned long XvRTEncoding;
extern unsigned long XvRTGrab;
extern unsigned long XvRTVideoNotify;
extern unsigned long XvRTVideoNotifyList;
extern unsigned long XvRTPortNotify;
typedef struct {
int numerator;
int denominator;
} XvRationalRec, *XvRationalPtr;
typedef struct {
char depth;
unsigned long visual;
} XvFormatRec, *XvFormatPtr;
typedef struct {
unsigned long id;
ClientPtr client;
} XvGrabRec, *XvGrabPtr;
typedef struct _XvVideoNotifyRec {
struct _XvVideoNotifyRec *next;
ClientPtr client;
unsigned long id;
unsigned long mask;
} XvVideoNotifyRec, *XvVideoNotifyPtr;
typedef struct _XvPortNotifyRec {
struct _XvPortNotifyRec *next;
ClientPtr client;
unsigned long id;
} XvPortNotifyRec, *XvPortNotifyPtr;
typedef struct {
int id;
ScreenPtr pScreen;
char *name;
unsigned short width, height;
XvRationalRec rate;
} XvEncodingRec, *XvEncodingPtr;
typedef struct _XvAttributeRec {
int flags;
int min_value;
int max_value;
char *name;
} XvAttributeRec, *XvAttributePtr;
typedef struct {
int id;
int type;
int byte_order;
char guid[16];
int bits_per_pixel;
int format;
int num_planes;
/* for RGB formats only */
int depth;
unsigned int red_mask;
unsigned int green_mask;
unsigned int blue_mask;
/* for YUV formats only */
unsigned int y_sample_bits;
unsigned int u_sample_bits;
unsigned int v_sample_bits;
unsigned int horz_y_period;
unsigned int horz_u_period;
unsigned int horz_v_period;
unsigned int vert_y_period;
unsigned int vert_u_period;
unsigned int vert_v_period;
char component_order[32];
int scanline_order;
} XvImageRec, *XvImagePtr;
typedef struct {
unsigned long base_id;
unsigned char type;
char *name;
int nEncodings;
XvEncodingPtr pEncodings;
int nFormats;
XvFormatPtr pFormats;
int nAttributes;
XvAttributePtr pAttributes;
int nImages;
XvImagePtr pImages;
int nPorts;
struct _XvPortRec *pPorts;
ScreenPtr pScreen;
int (* ddAllocatePort)(unsigned long, struct _XvPortRec*,
struct _XvPortRec**);
int (* ddFreePort)(struct _XvPortRec*);
int (* ddPutVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (* ddPutStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (* ddGetVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (* ddGetStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (* ddStopVideo)(ClientPtr, struct _XvPortRec*, DrawablePtr);
int (* ddSetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32);
int (* ddGetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32*);
int (* ddQueryBestSize)(ClientPtr, struct _XvPortRec*, CARD8,
CARD16, CARD16,CARD16, CARD16,
unsigned int*, unsigned int*);
int (* ddPutImage)(ClientPtr, DrawablePtr, struct _XvPortRec*, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16,
XvImagePtr, unsigned char*, Bool,
CARD16, CARD16);
int (* ddQueryImageAttributes)(ClientPtr, struct _XvPortRec*, XvImagePtr,
CARD16*, CARD16*, int*, int*);
DevUnion devPriv;
} XvAdaptorRec, *XvAdaptorPtr;
typedef struct _XvPortRec {
unsigned long id;
XvAdaptorPtr pAdaptor;
XvPortNotifyPtr pNotify;
DrawablePtr pDraw;
ClientPtr client;
XvGrabRec grab;
TimeStamp time;
DevUnion devPriv;
} XvPortRec, *XvPortPtr;
#define LOOKUP_PORT(_id, client)\
((XvPortPtr)LookupIDByType(_id, XvRTPort))
#define LOOKUP_ENCODING(_id, client)\
((XvEncodingPtr)LookupIDByType(_id, XvRTEncoding))
#define LOOKUP_VIDEONOTIFY_LIST(_id, client)\
((XvVideoNotifyPtr)LookupIDByType(_id, XvRTVideoNotifyList))
#define LOOKUP_PORTNOTIFY_LIST(_id, client)\
((XvPortNotifyPtr)LookupIDByType(_id, XvRTPortNotifyList))
typedef struct {
int version, revision;
int nAdaptors;
XvAdaptorPtr pAdaptors;
DestroyWindowProcPtr DestroyWindow;
DestroyPixmapProcPtr DestroyPixmap;
CloseScreenProcPtr CloseScreen;
Bool (* ddCloseScreen)(ScreenPtr);
int (* ddQueryAdaptors)(ScreenPtr, XvAdaptorPtr*, int*);
DevUnion devPriv;
} XvScreenRec, *XvScreenPtr;
#define SCREEN_PROLOGUE(pScreen, field)\
((pScreen)->field = \
((XvScreenPtr) \
(pScreen)->devPrivates[XvScreenIndex].ptr)->field)
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
/* Errors */
#define _XvBadPort (XvBadPort+XvErrorBase)
#define _XvBadEncoding (XvBadEncoding+XvErrorBase)
extern int ProcXvDispatch(ClientPtr);
extern int SProcXvDispatch(ClientPtr);
extern void XvExtensionInit(void);
extern int XvScreenInit(ScreenPtr);
extern int XvGetScreenIndex(void);
extern unsigned long XvGetRTPort(void);
extern int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
extern int XvdiVideoStopped(XvPortPtr, int);
extern int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
extern int XvdiPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
extern int XvdiGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
extern int XvdiGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
extern int XvdiPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16,
XvImagePtr, unsigned char*, Bool,
CARD16, CARD16);
extern int XvdiSelectVideoNotify(ClientPtr, DrawablePtr, BOOL);
extern int XvdiSelectPortNotify(ClientPtr, XvPortPtr, BOOL);
extern int XvdiSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
extern int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*);
extern int XvdiStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
extern int XvdiPreemptVideo(ClientPtr, XvPortPtr, DrawablePtr);
extern int XvdiMatchPort(XvPortPtr, DrawablePtr);
extern int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
extern int XvdiUngrabPort( ClientPtr, XvPortPtr, Time);
#if !defined(UNIXCPP)
#define XVCALL(name) Xv##name
#else
#define XVCALL(name) Xv/**/name
#endif
#endif /* XVDIX_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,790 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "resource.h"
#include "scrnintstr.h"
#include "extnsionst.h"
#include "servermd.h"
#include <nx-X11/Xfuncproto.h>
#include "xvdix.h"
#include <nx-X11/extensions/XvMC.h>
#include <nx-X11/extensions/Xvproto.h>
#include <nx-X11/extensions/XvMCproto.h>
#include "xvmcext.h"
#ifdef HAS_XVMCSHM
#include <sys/ipc.h>
#include <sys/types.h>
#include <sys/shm.h>
#endif /* HAS_XVMCSHM */
#define DR_CLIENT_DRIVER_NAME_SIZE 48
#define DR_BUSID_SIZE 48
int XvMCScreenIndex = -1;
unsigned long XvMCGeneration = 0;
int XvMCReqCode;
int XvMCEventBase;
int XvMCErrorBase;
unsigned long XvMCRTContext;
unsigned long XvMCRTSurface;
unsigned long XvMCRTSubpicture;
typedef struct {
int num_adaptors;
XvMCAdaptorPtr adaptors;
CloseScreenProcPtr CloseScreen;
char clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE];
char busID[DR_BUSID_SIZE];
int major;
int minor;
int patchLevel;
} XvMCScreenRec, *XvMCScreenPtr;
#define XVMC_GET_PRIVATE(pScreen) \
(XvMCScreenPtr)((pScreen)->devPrivates[XvMCScreenIndex].ptr)
static int
XvMCDestroyContextRes(void * data, XID id)
{
XvMCContextPtr pContext = (XvMCContextPtr)data;
pContext->refcnt--;
if(!pContext->refcnt) {
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num].DestroyContext)(pContext);
free(pContext);
}
return Success;
}
static int
XvMCDestroySurfaceRes(void * data, XID id)
{
XvMCSurfacePtr pSurface = (XvMCSurfacePtr)data;
XvMCContextPtr pContext = pSurface->context;
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num].DestroySurface)(pSurface);
free(pSurface);
XvMCDestroyContextRes((void *)pContext, pContext->context_id);
return Success;
}
static int
XvMCDestroySubpictureRes(void * data, XID id)
{
XvMCSubpicturePtr pSubpict = (XvMCSubpicturePtr)data;
XvMCContextPtr pContext = pSubpict->context;
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num].DestroySubpicture)(pSubpict);
free(pSubpict);
XvMCDestroyContextRes((void *)pContext, pContext->context_id);
return Success;
}
static void
XvMCResetProc (ExtensionEntry *extEntry)
{
}
static int
ProcXvMCQueryVersion(ClientPtr client)
{
xvmcQueryVersionReply rep;
/* REQUEST(xvmcQueryVersionReq); */
REQUEST_SIZE_MATCH(xvmcQueryVersionReq);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.major = XvMCVersion;
rep.minor = XvMCRevision;
WriteToClient(client, sizeof(xvmcQueryVersionReply), &rep);
return Success;
}
static int
ProcXvMCListSurfaceTypes(ClientPtr client)
{
XvPortPtr pPort;
int i;
XvMCScreenPtr pScreenPriv;
xvmcListSurfaceTypesReply rep;
xvmcSurfaceInfo info;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface;
REQUEST(xvmcListSurfaceTypesReq);
REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq);
if(!(pPort = LOOKUP_PORT(stuff->port, client))) {
client->errorValue = stuff->port;
return _XvBadPort;
}
if(XvMCScreenIndex >= 0) { /* any adaptors at all */
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
if((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */
for(i = 0; i < pScreenPriv->num_adaptors; i++) {
if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
adaptor = &(pScreenPriv->adaptors[i]);
break;
}
}
}
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.num = (adaptor) ? adaptor->num_surfaces : 0;
rep.length = rep.num * sizeof(xvmcSurfaceInfo) >> 2;
WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
for(i = 0; i < rep.num; i++) {
surface = adaptor->surfaces[i];
info.surface_type_id = surface->surface_type_id;
info.chroma_format = surface->chroma_format;
info.max_width = surface->max_width;
info.max_height = surface->max_height;
info.subpicture_max_width = surface->subpicture_max_width;
info.subpicture_max_height = surface->subpicture_max_height;
info.mc_type = surface->mc_type;
info.flags = surface->flags;
WriteToClient(client, sizeof(xvmcSurfaceInfo), &info);
}
return Success;
}
static int
ProcXvMCCreateContext(ClientPtr client)
{
XvPortPtr pPort;
CARD32 *data = NULL;
int dwords = 0;
int i, result, adapt_num = -1;
ScreenPtr pScreen;
XvMCContextPtr pContext;
XvMCScreenPtr pScreenPriv;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface = NULL;
xvmcCreateContextReply rep;
REQUEST(xvmcCreateContextReq);
REQUEST_SIZE_MATCH(xvmcCreateContextReq);
if(!(pPort = LOOKUP_PORT(stuff->port, client))) {
client->errorValue = stuff->port;
return _XvBadPort;
}
pScreen = pPort->pAdaptor->pScreen;
if(XvMCScreenIndex < 0) /* no XvMC adaptors */
return BadMatch;
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) /* none this screen */
return BadMatch;
for(i = 0; i < pScreenPriv->num_adaptors; i++) {
if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
adaptor = &(pScreenPriv->adaptors[i]);
adapt_num = i;
break;
}
}
if(adapt_num < 0) /* none this port */
return BadMatch;
for(i = 0; i < adaptor->num_surfaces; i++) {
if(adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) {
surface = adaptor->surfaces[i];
break;
}
}
/* adaptor doesn't support this suface_type_id */
if(!surface) return BadMatch;
if((stuff->width > surface->max_width) ||
(stuff->height > surface->max_height))
return BadValue;
if(!(pContext = malloc(sizeof(XvMCContextRec)))) {
return BadAlloc;
}
pContext->pScreen = pScreen;
pContext->adapt_num = adapt_num;
pContext->context_id = stuff->context_id;
pContext->surface_type_id = stuff->surface_type_id;
pContext->width = stuff->width;
pContext->height = stuff->height;
pContext->flags = stuff->flags;
pContext->refcnt = 1;
result = (*adaptor->CreateContext)(pPort, pContext, &dwords, &data);
if(result != Success) {
free(pContext);
return result;
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.width_actual = pContext->width;
rep.height_actual = pContext->height;
rep.flags_return = pContext->flags;
rep.length = dwords;
WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
if(dwords)
WriteToClient(client, dwords << 2, data);
AddResource(pContext->context_id, XvMCRTContext, pContext);
if(data)
free(data);
return Success;
}
static int
ProcXvMCDestroyContext(ClientPtr client)
{
REQUEST(xvmcDestroyContextReq);
REQUEST_SIZE_MATCH(xvmcDestroyContextReq);
if(!LookupIDByType(stuff->context_id, XvMCRTContext))
return (XvMCBadContext + XvMCErrorBase);
FreeResource(stuff->context_id, RT_NONE);
return Success;
}
static int
ProcXvMCCreateSurface(ClientPtr client)
{
CARD32 *data = NULL;
int dwords = 0;
int result;
XvMCContextPtr pContext;
XvMCSurfacePtr pSurface;
XvMCScreenPtr pScreenPriv;
xvmcCreateSurfaceReply rep;
REQUEST(xvmcCreateSurfaceReq);
REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);
if(!(pContext = LookupIDByType(stuff->context_id, XvMCRTContext)))
return (XvMCBadContext + XvMCErrorBase);
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
if(!(pSurface = malloc(sizeof(XvMCSurfaceRec))))
return BadAlloc;
pSurface->surface_id = stuff->surface_id;
pSurface->surface_type_id = pContext->surface_type_id;
pSurface->context = pContext;
result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSurface)(
pSurface, &dwords, &data);
if(result != Success) {
free(pSurface);
return result;
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = dwords;
WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
if(dwords)
WriteToClient(client, dwords << 2, data);
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
if(data)
free(data);
pContext->refcnt++;
return Success;
}
static int
ProcXvMCDestroySurface(ClientPtr client)
{
REQUEST(xvmcDestroySurfaceReq);
REQUEST_SIZE_MATCH(xvmcDestroySurfaceReq);
if(!LookupIDByType(stuff->surface_id, XvMCRTSurface))
return (XvMCBadSurface + XvMCErrorBase);
FreeResource(stuff->surface_id, RT_NONE);
return Success;
}
static int
ProcXvMCCreateSubpicture(ClientPtr client)
{
Bool image_supported = FALSE;
CARD32 *data = NULL;
int i, result, dwords = 0;
XvMCContextPtr pContext;
XvMCSubpicturePtr pSubpicture;
XvMCScreenPtr pScreenPriv;
xvmcCreateSubpictureReply rep;
XvMCAdaptorPtr adaptor;
XvMCSurfaceInfoPtr surface = NULL;
REQUEST(xvmcCreateSubpictureReq);
REQUEST_SIZE_MATCH(xvmcCreateSubpictureReq);
if(!(pContext = LookupIDByType(stuff->context_id, XvMCRTContext)))
return (XvMCBadContext + XvMCErrorBase);
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
adaptor = &(pScreenPriv->adaptors[pContext->adapt_num]);
/* find which surface this context supports */
for(i = 0; i < adaptor->num_surfaces; i++) {
if(adaptor->surfaces[i]->surface_type_id == pContext->surface_type_id){
surface = adaptor->surfaces[i];
break;
}
}
if(!surface) return BadMatch;
/* make sure this surface supports that xvimage format */
if(!surface->compatible_subpictures) return BadMatch;
for(i = 0; i < surface->compatible_subpictures->num_xvimages; i++) {
if(surface->compatible_subpictures->xvimage_ids[i] == stuff->xvimage_id) {
image_supported = TRUE;
break;
}
}
if(!image_supported) return BadMatch;
/* make sure the size is OK */
if((stuff->width > surface->subpicture_max_width) ||
(stuff->height > surface->subpicture_max_height))
return BadValue;
if(!(pSubpicture = malloc(sizeof(XvMCSubpictureRec))))
return BadAlloc;
pSubpicture->subpicture_id = stuff->subpicture_id;
pSubpicture->xvimage_id = stuff->xvimage_id;
pSubpicture->width = stuff->width;
pSubpicture->height = stuff->height;
pSubpicture->num_palette_entries = 0; /* overwritten by DDX */
pSubpicture->entry_bytes = 0; /* overwritten by DDX */
pSubpicture->component_order[0] = 0; /* overwritten by DDX */
pSubpicture->component_order[1] = 0;
pSubpicture->component_order[2] = 0;
pSubpicture->component_order[3] = 0;
pSubpicture->context = pContext;
result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSubpicture)(
pSubpicture, &dwords, &data);
if(result != Success) {
free(pSubpicture);
return result;
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.width_actual = pSubpicture->width;
rep.height_actual = pSubpicture->height;
rep.num_palette_entries = pSubpicture->num_palette_entries;
rep.entry_bytes = pSubpicture->entry_bytes;
rep.component_order[0] = pSubpicture->component_order[0];
rep.component_order[1] = pSubpicture->component_order[1];
rep.component_order[2] = pSubpicture->component_order[2];
rep.component_order[3] = pSubpicture->component_order[3];
rep.length = dwords;
WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
if(dwords)
WriteToClient(client, dwords << 2, data);
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
if(data)
free(data);
pContext->refcnt++;
return Success;
}
static int
ProcXvMCDestroySubpicture(ClientPtr client)
{
REQUEST(xvmcDestroySubpictureReq);
REQUEST_SIZE_MATCH(xvmcDestroySubpictureReq);
if(!LookupIDByType(stuff->subpicture_id, XvMCRTSubpicture))
return (XvMCBadSubpicture + XvMCErrorBase);
FreeResource(stuff->subpicture_id, RT_NONE);
return Success;
}
static int
ProcXvMCListSubpictureTypes(ClientPtr client)
{
XvPortPtr pPort;
xvmcListSubpictureTypesReply rep;
XvMCScreenPtr pScreenPriv;
ScreenPtr pScreen;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface = NULL;
xvImageFormatInfo info;
XvImagePtr pImage;
int i, j;
REQUEST(xvmcListSubpictureTypesReq);
REQUEST_SIZE_MATCH(xvmcListSubpictureTypesReq);
if(!(pPort = LOOKUP_PORT(stuff->port, client))) {
client->errorValue = stuff->port;
return _XvBadPort;
}
pScreen = pPort->pAdaptor->pScreen;
if(XvMCScreenIndex < 0) /* No XvMC adaptors */
return BadMatch;
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
return BadMatch; /* None this screen */
for(i = 0; i < pScreenPriv->num_adaptors; i++) {
if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
adaptor = &(pScreenPriv->adaptors[i]);
break;
}
}
if(!adaptor) return BadMatch;
for(i = 0; i < adaptor->num_surfaces; i++) {
if(adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) {
surface = adaptor->surfaces[i];
break;
}
}
if(!surface) return BadMatch;
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.num = 0;
if(surface->compatible_subpictures)
rep.num = surface->compatible_subpictures->num_xvimages;
rep.length = rep.num * sizeof(xvImageFormatInfo) >> 2;
WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep);
for(i = 0; i < rep.num; i++) {
pImage = NULL;
for(j = 0; j < adaptor->num_subpictures; j++) {
if(surface->compatible_subpictures->xvimage_ids[i] ==
adaptor->subpictures[j]->id)
{
pImage = adaptor->subpictures[j];
break;
}
}
if(!pImage) return BadImplementation;
info.id = pImage->id;
info.type = pImage->type;
info.byte_order = pImage->byte_order;
memcpy(&info.guid, pImage->guid, 16);
info.bpp = pImage->bits_per_pixel;
info.num_planes = pImage->num_planes;
info.depth = pImage->depth;
info.red_mask = pImage->red_mask;
info.green_mask = pImage->green_mask;
info.blue_mask = pImage->blue_mask;
info.format = pImage->format;
info.y_sample_bits = pImage->y_sample_bits;
info.u_sample_bits = pImage->u_sample_bits;
info.v_sample_bits = pImage->v_sample_bits;
info.horz_y_period = pImage->horz_y_period;
info.horz_u_period = pImage->horz_u_period;
info.horz_v_period = pImage->horz_v_period;
info.vert_y_period = pImage->vert_y_period;
info.vert_u_period = pImage->vert_u_period;
info.vert_v_period = pImage->vert_v_period;
memcpy(&info.comp_order, pImage->component_order, 32);
info.scanline_order = pImage->scanline_order;
WriteToClient(client, sizeof(xvImageFormatInfo), &info);
}
return Success;
}
static int
ProcXvMCGetDRInfo(ClientPtr client)
{
xvmcGetDRInfoReply rep;
XvPortPtr pPort;
ScreenPtr pScreen;
XvMCScreenPtr pScreenPriv;
#ifdef HAS_XVMCSHM
volatile CARD32 *patternP;
#endif
REQUEST(xvmcGetDRInfoReq);
REQUEST_SIZE_MATCH(xvmcGetDRInfoReq);
if(!(pPort = LOOKUP_PORT(stuff->port, client))) {
client->errorValue = stuff->port;
return _XvBadPort;
}
pScreen = pPort->pAdaptor->pScreen;
pScreenPriv = XVMC_GET_PRIVATE(pScreen);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.major = pScreenPriv->major;
rep.minor = pScreenPriv->minor;
rep.patchLevel = pScreenPriv->patchLevel;
rep.nameLen = (strlen(pScreenPriv->clientDriverName) + 4) >> 2;
rep.busIDLen = (strlen(pScreenPriv->busID) + 4) >> 2;
rep.length = rep.nameLen + rep.busIDLen;
rep.nameLen <<=2;
rep.busIDLen <<=2;
/*
* Read back to the client what she has put in the shared memory
* segment she prepared for us.
*/
rep.isLocal = 1;
#ifdef HAS_XVMCSHM
patternP = (CARD32 *)shmat( stuff->shmKey, NULL, SHM_RDONLY );
if ( -1 != (long) patternP) {
register volatile CARD32 *patternC = patternP;
register int i;
CARD32 magic = stuff->magic;
rep.isLocal = 1;
i = 1024 / sizeof(CARD32);
while ( i-- ) {
if (*patternC++ != magic) {
rep.isLocal = 0;
break;
}
magic = ~magic;
}
shmdt( (char *)patternP );
}
#endif /* HAS_XVMCSHM */
WriteToClient(client, sizeof(xvmcGetDRInfoReply),
&rep);
if (rep.length) {
WriteToClient(client, rep.nameLen,
pScreenPriv->clientDriverName);
WriteToClient(client, rep.busIDLen,
pScreenPriv->busID);
}
return Success;
}
int (*ProcXvMCVector[xvmcNumRequest])(ClientPtr) = {
ProcXvMCQueryVersion,
ProcXvMCListSurfaceTypes,
ProcXvMCCreateContext,
ProcXvMCDestroyContext,
ProcXvMCCreateSurface,
ProcXvMCDestroySurface,
ProcXvMCCreateSubpicture,
ProcXvMCDestroySubpicture,
ProcXvMCListSubpictureTypes,
ProcXvMCGetDRInfo
};
static int
ProcXvMCDispatch (ClientPtr client)
{
REQUEST(xReq);
if(stuff->data < xvmcNumRequest)
return (*ProcXvMCVector[stuff->data])(client);
else
return BadRequest;
}
static int
SProcXvMCDispatch (ClientPtr client)
{
/* We only support local */
return BadImplementation;
}
void
XvMCExtensionInit(void)
{
ExtensionEntry *extEntry;
if(XvMCScreenIndex < 0) /* nobody supports it */
return;
if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes)))
return;
if(!(XvMCRTSurface = CreateNewResourceType(XvMCDestroySurfaceRes)))
return;
if(!(XvMCRTSubpicture = CreateNewResourceType(XvMCDestroySubpictureRes)))
return;
extEntry = AddExtension(XvMCName, XvMCNumEvents, XvMCNumErrors,
ProcXvMCDispatch, SProcXvMCDispatch,
XvMCResetProc, StandardMinorOpcode);
if(!extEntry) return;
XvMCReqCode = extEntry->base;
XvMCEventBase = extEntry->eventBase;
XvMCErrorBase = extEntry->errorBase;
}
static Bool
XvMCCloseScreen (ScreenPtr pScreen)
{
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
free(pScreenPriv);
return (*pScreen->CloseScreen)(pScreen);
}
int
XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
{
XvMCScreenPtr pScreenPriv;
if(XvMCGeneration != serverGeneration) {
if((XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0)
return BadAlloc;
XvMCGeneration = serverGeneration;
}
if(!(pScreenPriv = (XvMCScreenPtr)malloc(sizeof(XvMCScreenRec))))
return BadAlloc;
pScreen->devPrivates[XvMCScreenIndex].ptr = (void *)pScreenPriv;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = XvMCCloseScreen;
pScreenPriv->num_adaptors = num;
pScreenPriv->adaptors = pAdapt;
pScreenPriv->clientDriverName[0] = 0;
pScreenPriv->busID[0] = 0;
pScreenPriv->major = 0;
pScreenPriv->minor = 0;
pScreenPriv->patchLevel = 0;
return Success;
}
XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
{
XvImagePtr pImage = NULL;
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
XvMCScreenPtr pScreenPriv;
XvMCAdaptorPtr adaptor = NULL;
int i;
if(XvMCScreenIndex < 0) return NULL;
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
return NULL;
for(i = 0; i < pScreenPriv->num_adaptors; i++) {
if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
adaptor = &(pScreenPriv->adaptors[i]);
break;
}
}
if(!adaptor) return NULL;
for(i = 0; i < adaptor->num_subpictures; i++) {
if(adaptor->subpictures[i]->id == id) {
pImage = adaptor->subpictures[i];
break;
}
}
return pImage;
}
int
xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
char *busID, int major, int minor,
int patchLevel)
{
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
strncpy(pScreenPriv->clientDriverName, name,
DR_CLIENT_DRIVER_NAME_SIZE);
strncpy(pScreenPriv->busID, busID, DR_BUSID_SIZE);
pScreenPriv->major = major;
pScreenPriv->minor = minor;
pScreenPriv->patchLevel = patchLevel;
pScreenPriv->clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE-1] = 0;
pScreenPriv->busID[DR_BUSID_SIZE-1] = 0;
return Success;
}

View File

@@ -0,0 +1,115 @@
#ifndef _XVMC_H
#define _XVMC_H
#include <nx-X11/extensions/Xv.h>
#include "xvdix.h"
typedef struct {
int num_xvimages;
int *xvimage_ids;
} XvMCImageIDList;
typedef struct {
int surface_type_id;
int chroma_format;
int color_description;
unsigned short max_width;
unsigned short max_height;
unsigned short subpicture_max_width;
unsigned short subpicture_max_height;
int mc_type;
int flags;
XvMCImageIDList *compatible_subpictures;
} XvMCSurfaceInfoRec, *XvMCSurfaceInfoPtr;
typedef struct {
XID context_id;
ScreenPtr pScreen;
int adapt_num;
int surface_type_id;
unsigned short width;
unsigned short height;
CARD32 flags;
int refcnt;
void * port_priv;
void * driver_priv;
} XvMCContextRec, *XvMCContextPtr;
typedef struct {
XID surface_id;
int surface_type_id;
XvMCContextPtr context;
void * driver_priv;
} XvMCSurfaceRec, *XvMCSurfacePtr;
typedef struct {
XID subpicture_id;
int xvimage_id;
unsigned short width;
unsigned short height;
int num_palette_entries;
int entry_bytes;
char component_order[4];
XvMCContextPtr context;
void * driver_priv;
} XvMCSubpictureRec, *XvMCSubpicturePtr;
typedef int (*XvMCCreateContextProcPtr) (
XvPortPtr port,
XvMCContextPtr context,
int *num_priv,
CARD32 **priv
);
typedef void (*XvMCDestroyContextProcPtr) (
XvMCContextPtr context
);
typedef int (*XvMCCreateSurfaceProcPtr) (
XvMCSurfacePtr surface,
int *num_priv,
CARD32 **priv
);
typedef void (*XvMCDestroySurfaceProcPtr) (
XvMCSurfacePtr surface
);
typedef int (*XvMCCreateSubpictureProcPtr) (
XvMCSubpicturePtr subpicture,
int *num_priv,
CARD32 **priv
);
typedef void (*XvMCDestroySubpictureProcPtr) (
XvMCSubpicturePtr subpicture
);
typedef struct {
XvAdaptorPtr xv_adaptor;
int num_surfaces;
XvMCSurfaceInfoPtr *surfaces;
int num_subpictures;
XvImagePtr *subpictures;
XvMCCreateContextProcPtr CreateContext;
XvMCDestroyContextProcPtr DestroyContext;
XvMCCreateSurfaceProcPtr CreateSurface;
XvMCDestroySurfaceProcPtr DestroySurface;
XvMCCreateSubpictureProcPtr CreateSubpicture;
XvMCDestroySubpictureProcPtr DestroySubpicture;
} XvMCAdaptorRec, *XvMCAdaptorPtr;
void XvMCExtensionInit(void);
int XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr adapt);
XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
char *busID, int major, int minor,
int patchLevel);
#endif /* _XVMC_H */