Merge branch 'master' of git://anongit.freedesktop.org/git/xorg/xserver

This commit is contained in:
Peter Hutterer 2006-12-19 10:51:01 +10:30 committed by Peter Hutterer
commit ca5ebe3971
186 changed files with 8772 additions and 3433 deletions

View File

@ -441,6 +441,7 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId,
__GLcontextModes *modes;
__GLXdrawable *pGlxDraw;
__GLXpixmap *drawPixmap = NULL;
int rc;
/* This is the GLX 1.3 case - the client passes in a GLXWindow and
* we just return the __GLXdrawable. The first time a GLXPixmap
@ -466,8 +467,8 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId,
* GLXWindow with the same XID as an X Window, so we wont get any
* resource ID clashes. Effectively, the X Window is now also a
* GLXWindow. */
pDraw = (DrawablePtr) LookupDrawable(drawId, client);
if (pDraw) {
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) {
VisualID vid = wVisual((WindowPtr)pDraw);
@ -1199,12 +1200,12 @@ static int ValidateCreateDrawable(ClientPtr client,
ScreenPtr pScreen;
VisualPtr pVisual;
__GLXscreen *pGlxScreen;
int i;
int i, rc;
LEGAL_NEW_RESOURCE(glxDrawableId, client);
pDraw = (DrawablePtr) LookupDrawable(drawablId, client);
if (!pDraw || pDraw->type != type) {
rc = dixLookupDrawable(&pDraw, drawablId, client, 0, DixUnknownAccess);
if (rc != Success || pDraw->type != type) {
client->errorValue = drawablId;
return type == DRAWABLE_WINDOW ? BadWindow : BadPixmap;
}
@ -2034,10 +2035,11 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc;
XID drawable = req->drawable;
int barrier = req->barrier;
DrawablePtr pDraw = (DrawablePtr) LookupDrawable(drawable, client);
int screen;
DrawablePtr pDraw;
int screen, rc;
if (pDraw && (pDraw->type == DRAWABLE_WINDOW)) {
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixUnknownAccess);
if (rc == Success && (pDraw->type == DRAWABLE_WINDOW)) {
screen = pDraw->pScreen->myNum;
if (__glXSwapBarrierFuncs &&
__glXSwapBarrierFuncs[screen].bindSwapBarrierFunc) {

View File

@ -237,7 +237,7 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
* __glXDispatch() or as a callback from the resource manager. In
* the latter case we need to lift the DRI lock manually. */
if (glxBlockClients) {
if (!glxBlockClients) {
__glXleaveServer();
cx->destroy(cx);
__glXenterServer();

View File

@ -85,8 +85,6 @@ extern HIDDEN void __glXDisp_EvalCoord2fv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_EvalCoord2fv(GLbyte * pc);
extern HIDDEN int __glXDisp_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc);
extern HIDDEN int __glXDisp_GetMapiv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetMapiv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_SwapBuffers(struct __GLXclientStateRec *, GLbyte *);
@ -123,6 +121,8 @@ extern HIDDEN int __glXDisp_VendorPrivate(struct __GLXclientStateRec *, GLbyte *
extern HIDDEN int __glXDispSwap_VendorPrivate(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_VertexAttrib1fvNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc);
extern HIDDEN void __glXDisp_Vertex3iv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Vertex3iv(GLbyte * pc);
extern HIDDEN void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc);
@ -279,6 +279,8 @@ extern HIDDEN void __glXDisp_ClearStencil(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ClearStencil(GLbyte * pc);
extern HIDDEN void __glXDisp_VertexAttrib3dvARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc);
extern HIDDEN void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc);
extern HIDDEN void __glXDisp_ConvolutionParameteriv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc);
extern HIDDEN void __glXDisp_RasterPos2fv(GLbyte * pc);
@ -327,6 +329,8 @@ extern HIDDEN int __glXDisp_GetVertexAttribdvNV(struct __GLXclientStateRec *, GL
extern HIDDEN int __glXDispSwap_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_Normal3fv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Normal3fv(GLbyte * pc);
extern HIDDEN void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc);
extern HIDDEN void __glXDisp_VertexAttrib4ivARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib4ivARB(GLbyte * pc);
extern HIDDEN void __glXDisp_End(GLbyte * pc);
@ -457,8 +461,6 @@ extern HIDDEN void __glXDisp_BindFramebufferEXT(GLbyte * pc);
extern HIDDEN void __glXDispSwap_BindFramebufferEXT(GLbyte * pc);
extern HIDDEN void __glXDisp_PushAttrib(GLbyte * pc);
extern HIDDEN void __glXDispSwap_PushAttrib(GLbyte * pc);
extern HIDDEN void __glXDisp_VertexAttrib4usvARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc);
extern HIDDEN int __glXDisp_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_TexParameteriv(GLbyte * pc);
@ -615,6 +617,8 @@ extern HIDDEN void __glXDisp_PrioritizeTextures(GLbyte * pc);
extern HIDDEN void __glXDispSwap_PrioritizeTextures(GLbyte * pc);
extern HIDDEN int __glXDisp_PixelStorei(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_PixelStorei(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_VertexAttrib4usvARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc);
extern HIDDEN void __glXDisp_Color4iv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc);
extern HIDDEN void __glXDisp_EvalCoord2dv(GLbyte * pc);
@ -783,8 +787,6 @@ extern HIDDEN void __glXDisp_VertexAttribs2fvNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc);
extern HIDDEN void __glXDisp_Rectiv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Rectiv(GLbyte * pc);
extern HIDDEN void __glXDisp_VertexAttrib1fvNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc);
extern HIDDEN void __glXDisp_SecondaryColor3dvEXT(GLbyte * pc);
extern HIDDEN void __glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc);
extern HIDDEN void __glXDisp_Vertex2fv(GLbyte * pc);
@ -919,8 +921,6 @@ extern HIDDEN void __glXDisp_DrawBuffersARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_DrawBuffersARB(GLbyte * pc);
extern HIDDEN void __glXDisp_LoadName(GLbyte * pc);
extern HIDDEN void __glXDispSwap_LoadName(GLbyte * pc);
extern HIDDEN void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc);
extern HIDDEN void __glXDisp_CopyTexSubImage1D(GLbyte * pc);
extern HIDDEN void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc);
extern HIDDEN void __glXDisp_CullFace(GLbyte * pc);

View File

@ -28,7 +28,7 @@
#include <X11/Xmd.h>
#include <GL/gl.h>
#include <GL/glxproto.h>
#if defined(__linux__) || defined(__GNU__)
#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>

View File

@ -46,7 +46,7 @@
#include "dispatch.h"
#include "glapioffsets.h"
#ifdef __linux__
#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>

View File

@ -31,7 +31,7 @@
#include "indirect_size.h"
#include "indirect_reqsize.h"
#if defined(__linux__) || defined(__GNU__)
#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__)
# include <byteswap.h>
# define SWAP_32(v) do { (v) = bswap_32(v); } while(0)
#else

View File

@ -645,7 +645,7 @@ static const void *Render_function_table[400][2] = {
/* [ 302] = 4182 */ {__glXDisp_RequestResidentProgramsNV, __glXDispSwap_RequestResidentProgramsNV},
/* [ 303] = 4183 */ {__glXDisp_LoadProgramNV, __glXDispSwap_LoadProgramNV},
/* [ 304] = 4184 */ {__glXDisp_ProgramParameter4fvNV, __glXDispSwap_ProgramParameter4fvNV},
/* [ 305] = 4185 */ {__glXDisp_ProgramParameter4dvNV, __glXDispSwap_ProgramParameter4dvNV},
/* [ 305] = 4185 */ {__glXDisp_ProgramEnvParameter4dvARB, __glXDispSwap_ProgramEnvParameter4dvARB},
/* [ 306] = 4186 */ {__glXDisp_ProgramParameters4fvNV, __glXDispSwap_ProgramParameters4fvNV},
/* [ 307] = 4187 */ {__glXDisp_ProgramParameters4dvNV, __glXDispSwap_ProgramParameters4dvNV},
/* [ 308] = 4188 */ {__glXDisp_TrackMatrixNV, __glXDispSwap_TrackMatrixNV},
@ -886,10 +886,10 @@ static const int_fast16_t Render_size_table[400][2] = {
/* [140] = 140 */ { 0, ~0},
/* [141] = 141 */ { 4, ~0},
/* [142] = 142 */ { 8, ~0},
/* [143] = 143 */ { 40, 20},
/* [144] = 144 */ { 28, 21},
/* [145] = 145 */ { 64, 22},
/* [146] = 146 */ { 44, 23},
/* [143] = 143 */ { 28, 20},
/* [144] = 144 */ { 20, 21},
/* [145] = 145 */ { 48, 22},
/* [146] = 146 */ { 32, 23},
/* [147] = 147 */ { 24, ~0},
/* [148] = 148 */ { 16, ~0},
/* [149] = 149 */ { 44, ~0},

View File

@ -39,7 +39,7 @@
#include "glthread.h"
#include "dispatch.h"
#ifdef __linux__
#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>

View File

@ -28,7 +28,7 @@
#include <X11/Xmd.h>
#include <GL/gl.h>
#include <GL/glxproto.h>
#if defined(__linux__) || defined(__GNU__)
#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>

View File

@ -40,7 +40,7 @@
#include "dispatch.h"
#include "glapioffsets.h"
#ifdef __linux__
#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>

View File

@ -1092,8 +1092,8 @@ int XETrapRequestVector(ClientPtr client)
pdata->hdr.client = client->index; /* stuff client index in hdr */
if (BitIsTrue(penv->cur.data_config_flags_data,XETrapWinXY))
{
window_ptr = (WindowPtr) LookupDrawable(stuff->id, client);
if (window_ptr == 0L)
if (Success != dixLookupDrawable(&window_ptr, stuff->id,
client, 0, DixUnknownAccess))
{ /* Failed...invalidate the X and Y coordinate data. */
pdata->hdr.win_x = -1L;
pdata->hdr.win_y = -1L;

View File

@ -355,13 +355,15 @@ int AttrValidate(
AppGroupPtr pAppGrp)
{
WindowPtr pWin;
int idepth, ivids, found;
int idepth, ivids, found, rc;
ScreenPtr pScreen;
DepthPtr pDepth;
ColormapPtr pColormap;
pWin = LookupWindow (pAppGrp->default_root, client);
/* XXX check that pWin is not NULL */
rc = dixLookupWindow(&pWin, pAppGrp->default_root, client,
DixUnknownAccess);
if (rc != Success)
return rc;
pScreen = pWin->drawable.pScreen;
if (WindowTable[pScreen->myNum]->drawable.id != pAppGrp->default_root)
return BadWindow;
@ -432,7 +434,7 @@ int ProcXagDestroy(
REQUEST_SIZE_MATCH (xXagDestroyReq);
pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
(XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess);
(XID)stuff->app_group, RT_APPGROUP, DixReadAccess);
if (!pAppGrp) return XagBadAppGroup;
FreeResource ((XID)stuff->app_group, RT_NONE);
if (--XagCallbackRefCount == 0)
@ -451,7 +453,7 @@ int ProcXagGetAttr(
REQUEST_SIZE_MATCH (xXagGetAttrReq);
pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
(XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess);
(XID)stuff->app_group, RT_APPGROUP, DixReadAccess);
if (!pAppGrp) return XagBadAppGroup;
rep.type = X_Reply;
rep.length = 0;
@ -483,10 +485,13 @@ int ProcXagQuery(
ClientPtr pClient;
AppGroupPtr pAppGrp;
REQUEST (xXagQueryReq);
int n;
int n, rc;
REQUEST_SIZE_MATCH (xXagQueryReq);
pClient = LookupClient (stuff->resource, client);
rc = dixLookupClient(&pClient, stuff->resource, client, DixUnknownAccess);
if (rc != Success)
return rc;
for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
for (n = 0; n < pAppGrp->nclients; n++)
if (pAppGrp->clients[n] == pClient) {

View File

@ -227,7 +227,7 @@ int ProcStoreColors(
REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
pcmp = (ColormapPtr) SecurityLookupIDByType (client, stuff->cmap,
RT_COLORMAP, SecurityWriteAccess);
RT_COLORMAP, DixWriteAccess);
if (pcmp) {
int ncolors, n;

View File

@ -448,16 +448,15 @@ ProcCreateImageBuffers (client)
register int n;
WindowPtr pWin;
XID *ids;
int len, nbuf;
int i;
int err;
int len, nbuf, i, err, rc;
REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
len = stuff->length - (sizeof(xMbufCreateImageBuffersReq) >> 2);
if (len == 0)
return BadLength;
if (!(pWin = LookupWindow (stuff->window, client)))
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
if (pWin->drawable.class == InputOnly)
return BadMatch;
switch (stuff->updateAction)
@ -584,10 +583,12 @@ ProcDestroyImageBuffers (client)
{
REQUEST (xMbufDestroyImageBuffersReq);
WindowPtr pWin;
int rc;
REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
if (!(pWin = LookupWindow (stuff->window, client)))
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
DestroyImageBuffers (pWin);
return Success;
}
@ -599,16 +600,16 @@ ProcSetMBufferAttributes (client)
REQUEST (xMbufSetMBufferAttributesReq);
WindowPtr pWin;
MultibuffersPtr pMultibuffers;
int len;
int len, rc;
Mask vmask;
Mask index2;
CARD32 updateHint;
XID *vlist;
REQUEST_AT_LEAST_SIZE (xMbufSetMBufferAttributesReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
if (!pMultibuffers)
return BadMatch;
@ -655,12 +656,12 @@ ProcGetMBufferAttributes (client)
MultibuffersPtr pMultibuffers;
XID *ids;
xMbufGetMBufferAttributesReply rep;
int i, n;
int i, n, rc;
REQUEST_SIZE_MATCH (xMbufGetMBufferAttributesReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
if (!pMultibuffers)
return BadAccess;
@ -785,15 +786,15 @@ ProcGetBufferInfo (client)
DrawablePtr pDrawable;
xMbufGetBufferInfoReply rep;
ScreenPtr pScreen;
int i, j, k;
int n;
int i, j, k, n, rc;
xMbufBufferInfo *pInfo;
int nInfo;
DepthPtr pDepth;
pDrawable = (DrawablePtr) LookupDrawable (stuff->drawable, client);
if (!pDrawable)
return BadDrawable;
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
pScreen = pDrawable->pScreen;
nInfo = 0;
for (i = 0; i < pScreen->numDepths; i++)

View File

@ -958,12 +958,13 @@ ProcPanoramiXGetState(ClientPtr client)
REQUEST(xPanoramiXGetStateReq);
WindowPtr pWin;
xPanoramiXGetStateReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -984,12 +985,13 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
REQUEST(xPanoramiXGetScreenCountReq);
WindowPtr pWin;
xPanoramiXGetScreenCountReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -1009,12 +1011,13 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
REQUEST(xPanoramiXGetScreenSizeReq);
WindowPtr pWin;
xPanoramiXGetScreenSizeReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;

View File

@ -91,7 +91,7 @@ int PanoramiXCreateWindow(ClientPtr client)
return BadLength;
if (!(parent = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->parent, XRT_WINDOW, SecurityWriteAccess)))
client, stuff->parent, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
if(stuff->class == CopyFromParent)
@ -105,7 +105,7 @@ int PanoramiXCreateWindow(ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + pback_offset);
if ((tmp != None) && (tmp != ParentRelative)) {
if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_PIXMAP, SecurityReadAccess)))
client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@ -114,7 +114,7 @@ int PanoramiXCreateWindow(ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + pbord_offset);
if (tmp != CopyFromParent) {
if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_PIXMAP, SecurityReadAccess)))
client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@ -123,7 +123,7 @@ int PanoramiXCreateWindow(ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
if ((tmp != CopyFromParent) && (tmp != None)) {
if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_COLORMAP, SecurityReadAccess)))
client, tmp, XRT_COLORMAP, DixReadAccess)))
return BadColor;
}
}
@ -192,7 +192,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
return BadLength;
if (!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
client, stuff->window, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
if((win->u.win.class == InputOnly) &&
@ -204,7 +204,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + pback_offset);
if ((tmp != None) && (tmp != ParentRelative)) {
if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_PIXMAP, SecurityReadAccess)))
client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@ -213,7 +213,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + pbord_offset);
if (tmp != CopyFromParent) {
if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_PIXMAP, SecurityReadAccess)))
client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@ -222,7 +222,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
if ((tmp != CopyFromParent) && (tmp != None)) {
if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_COLORMAP, SecurityReadAccess)))
client, tmp, XRT_COLORMAP, DixReadAccess)))
return BadColor;
}
}
@ -251,7 +251,7 @@ int PanoramiXDestroyWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->id, XRT_WINDOW, SecurityDestroyAccess)))
client, stuff->id, XRT_WINDOW, DixDestroyAccess)))
return BadWindow;
FOR_NSCREENS_BACKWARD(j) {
@ -276,7 +276,7 @@ int PanoramiXDestroySubwindows(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->id, XRT_WINDOW, SecurityDestroyAccess)))
client, stuff->id, XRT_WINDOW, DixDestroyAccess)))
return BadWindow;
FOR_NSCREENS_BACKWARD(j) {
@ -301,7 +301,7 @@ int PanoramiXChangeSaveSet(ClientPtr client)
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->window, XRT_WINDOW, SecurityReadAccess)))
client, stuff->window, XRT_WINDOW, DixReadAccess)))
return BadWindow;
FOR_NSCREENS_BACKWARD(j) {
@ -325,11 +325,11 @@ int PanoramiXReparentWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xReparentWindowReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
client, stuff->window, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
if(!(parent = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->parent, XRT_WINDOW, SecurityWriteAccess)))
client, stuff->parent, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
x = stuff->x;
@ -360,7 +360,7 @@ int PanoramiXMapWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
client, stuff->id, XRT_WINDOW, DixReadAccess)))
return BadWindow;
FOR_NSCREENS_FORWARD(j) {
@ -382,7 +382,7 @@ int PanoramiXMapSubwindows(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
client, stuff->id, XRT_WINDOW, DixReadAccess)))
return BadWindow;
FOR_NSCREENS_FORWARD(j) {
@ -404,7 +404,7 @@ int PanoramiXUnmapWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
client, stuff->id, XRT_WINDOW, DixReadAccess)))
return BadWindow;
FOR_NSCREENS_FORWARD(j) {
@ -426,7 +426,7 @@ int PanoramiXUnmapSubwindows(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
client, stuff->id, XRT_WINDOW, DixReadAccess)))
return BadWindow;
FOR_NSCREENS_FORWARD(j) {
@ -457,11 +457,11 @@ int PanoramiXConfigureWindow(ClientPtr client)
/* because we need the parent */
if (!(pWin = (WindowPtr)SecurityLookupIDByType(
client, stuff->window, RT_WINDOW, SecurityWriteAccess)))
client, stuff->window, RT_WINDOW, DixWriteAccess)))
return BadWindow;
if (!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
client, stuff->window, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
if ((Mask)stuff->mask & CWSibling) {
@ -469,7 +469,7 @@ int PanoramiXConfigureWindow(ClientPtr client)
sib_offset = Ones((Mask)stuff->mask & (CWSibling - 1));
if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) {
if(!(sib = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_WINDOW, SecurityReadAccess)))
client, tmp, XRT_WINDOW, DixReadAccess)))
return BadWindow;
}
}
@ -514,7 +514,7 @@ int PanoramiXCirculateWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xCirculateWindowReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
client, stuff->window, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
FOR_NSCREENS_FORWARD(j) {
@ -531,10 +531,14 @@ int PanoramiXGetGeometry(ClientPtr client)
{
xGetGeometryReply rep;
DrawablePtr pDraw;
int rc;
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
VERIFY_GEOMETRABLE (pDraw, stuff->id, client);
rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -573,19 +577,17 @@ int PanoramiXTranslateCoords(ClientPtr client)
{
INT16 x, y;
REQUEST(xTranslateCoordsReq);
register WindowPtr pWin, pDst;
int rc;
WindowPtr pWin, pDst;
xTranslateCoordsReply rep;
REQUEST_SIZE_MATCH(xTranslateCoordsReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client,
SecurityReadAccess);
if (!pWin)
return(BadWindow);
pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client,
SecurityReadAccess);
if (!pDst)
return(BadWindow);
rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess);
if (rc != Success)
return rc;
rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -655,7 +657,7 @@ int PanoramiXCreatePixmap(ClientPtr client)
client->errorValue = stuff->pid;
if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityReadAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixReadAccess)))
return BadDrawable;
if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
@ -694,7 +696,7 @@ int PanoramiXFreePixmap(ClientPtr client)
client->errorValue = stuff->id;
if(!(pix = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->id, XRT_PIXMAP, SecurityDestroyAccess)))
client, stuff->id, XRT_PIXMAP, DixDestroyAccess)))
return BadPixmap;
FOR_NSCREENS_BACKWARD(j) {
@ -730,14 +732,14 @@ int PanoramiXCreateGC(ClientPtr client)
return BadLength;
if (!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityReadAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixReadAccess)))
return BadDrawable;
if ((Mask)stuff->mask & GCTile) {
tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
if(!(tile = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_PIXMAP, SecurityReadAccess)))
client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@ -745,7 +747,7 @@ int PanoramiXCreateGC(ClientPtr client)
stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
if(!(stip = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_PIXMAP, SecurityReadAccess)))
client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@ -753,7 +755,7 @@ int PanoramiXCreateGC(ClientPtr client)
clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
if(!(clip = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_PIXMAP, SecurityReadAccess)))
client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@ -805,14 +807,14 @@ int PanoramiXChangeGC(ClientPtr client)
return BadLength;
if (!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if ((Mask)stuff->mask & GCTile) {
tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
if(!(tile = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_PIXMAP, SecurityReadAccess)))
client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@ -820,7 +822,7 @@ int PanoramiXChangeGC(ClientPtr client)
stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
if(!(stip = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_PIXMAP, SecurityReadAccess)))
client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@ -828,7 +830,7 @@ int PanoramiXChangeGC(ClientPtr client)
clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
if(!(clip = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_PIXMAP, SecurityReadAccess)))
client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@ -859,11 +861,11 @@ int PanoramiXCopyGC(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyGCReq);
if(!(srcGC = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->srcGC, XRT_GC, SecurityReadAccess)))
client, stuff->srcGC, XRT_GC, DixReadAccess)))
return BadGC;
if(!(dstGC = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->dstGC, XRT_GC, SecurityWriteAccess)))
client, stuff->dstGC, XRT_GC, DixWriteAccess)))
return BadGC;
FOR_NSCREENS(j) {
@ -886,7 +888,7 @@ int PanoramiXSetDashes(ClientPtr client)
REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityWriteAccess)))
client, stuff->gc, XRT_GC, DixWriteAccess)))
return BadGC;
FOR_NSCREENS_BACKWARD(j) {
@ -908,7 +910,7 @@ int PanoramiXSetClipRectangles(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityWriteAccess)))
client, stuff->gc, XRT_GC, DixWriteAccess)))
return BadGC;
FOR_NSCREENS_BACKWARD(j) {
@ -930,7 +932,7 @@ int PanoramiXFreeGC(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->id, XRT_GC, SecurityDestroyAccess)))
client, stuff->id, XRT_GC, DixDestroyAccess)))
return BadGC;
FOR_NSCREENS_BACKWARD(j) {
@ -956,7 +958,7 @@ int PanoramiXClearToBackground(ClientPtr client)
REQUEST_SIZE_MATCH(xClearAreaReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
client, stuff->window, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
x = stuff->x;
@ -998,13 +1000,13 @@ int PanoramiXCopyArea(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyAreaReq);
if(!(src = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->srcDrawable, XRC_DRAWABLE, SecurityReadAccess)))
client, stuff->srcDrawable, XRC_DRAWABLE, DixReadAccess)))
return BadDrawable;
srcShared = IS_SHARED_PIXMAP(src);
if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->dstDrawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->dstDrawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
dstShared = IS_SHARED_PIXMAP(dst);
@ -1013,7 +1015,7 @@ int PanoramiXCopyArea(ClientPtr client)
return (* SavedProcVector[X_CopyArea])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if((dst->type == XRT_WINDOW) && dst->u.win.root)
@ -1028,10 +1030,14 @@ int PanoramiXCopyArea(ClientPtr client)
DrawablePtr pDst;
GCPtr pGC;
char *data;
int pitch;
int pitch, rc;
FOR_NSCREENS(j)
VERIFY_DRAWABLE(drawables[j], src->info[j].id, client);
FOR_NSCREENS(j) {
rc = dixLookupDrawable(drawables+j, src->info[j].id, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
}
pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
if(!(data = xcalloc(1, stuff->height * pitch)))
@ -1065,6 +1071,7 @@ int PanoramiXCopyArea(ClientPtr client)
DrawablePtr pDst = NULL, pSrc = NULL;
GCPtr pGC = NULL;
RegionPtr pRgn[MAXSCREENS];
int rc;
FOR_NSCREENS_BACKWARD(j) {
stuff->dstDrawable = dst->info[j].id;
@ -1081,8 +1088,11 @@ int PanoramiXCopyArea(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);
if (stuff->dstDrawable != stuff->srcDrawable) {
SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client,
SecurityReadAccess);
rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
DixReadAccess);
if (rc != Success)
return rc;
if ((pDst->pScreen != pSrc->pScreen) ||
(pDst->depth != pSrc->depth)) {
client->errorValue = stuff->dstDrawable;
@ -1133,7 +1143,7 @@ int PanoramiXCopyArea(ClientPtr client)
int PanoramiXCopyPlane(ClientPtr client)
{
int j, srcx, srcy, dstx, dsty;
int j, srcx, srcy, dstx, dsty, rc;
PanoramiXRes *gc, *src, *dst;
Bool srcIsRoot = FALSE;
Bool dstIsRoot = FALSE;
@ -1146,13 +1156,13 @@ int PanoramiXCopyPlane(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyPlaneReq);
if(!(src = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->srcDrawable, XRC_DRAWABLE, SecurityReadAccess)))
client, stuff->srcDrawable, XRC_DRAWABLE, DixReadAccess)))
return BadDrawable;
srcShared = IS_SHARED_PIXMAP(src);
if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->dstDrawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->dstDrawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
dstShared = IS_SHARED_PIXMAP(dst);
@ -1161,7 +1171,7 @@ int PanoramiXCopyPlane(ClientPtr client)
return (* SavedProcVector[X_CopyPlane])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if((dst->type == XRT_WINDOW) && dst->u.win.root)
@ -1187,8 +1197,11 @@ int PanoramiXCopyPlane(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client);
if (stuff->dstDrawable != stuff->srcDrawable) {
SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client,
SecurityReadAccess);
rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
DixReadAccess);
if (rc != Success)
return rc;
if (pdstDraw->pScreen != psrcDraw->pScreen) {
client->errorValue = stuff->dstDrawable;
return (BadMatch);
@ -1246,14 +1259,14 @@ int PanoramiXPolyPoint(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyPointReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyPoint])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1304,14 +1317,14 @@ int PanoramiXPolyLine(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyLineReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyLine])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1362,14 +1375,14 @@ int PanoramiXPolySegment(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolySegment])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1424,14 +1437,14 @@ int PanoramiXPolyRectangle(ClientPtr client)
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyRectangle])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1484,14 +1497,14 @@ int PanoramiXPolyArc(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyArcReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyArc])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1542,14 +1555,14 @@ int PanoramiXFillPoly(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xFillPolyReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_FillPoly])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1601,14 +1614,14 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyFillRectangle])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1660,14 +1673,14 @@ int PanoramiXPolyFillArc(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyFillArc])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1718,14 +1731,14 @@ int PanoramiXPutImage(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPutImageReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PutImage])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1754,7 +1767,7 @@ int PanoramiXGetImage(ClientPtr client)
xGetImageReply xgi;
Bool isRoot;
char *pBuf;
int i, x, y, w, h, format;
int i, x, y, w, h, format, rc;
Mask plane = 0, planemask;
int linesDone, nlines, linesPerBuf;
long widthBytesLine, length;
@ -1769,13 +1782,16 @@ int PanoramiXGetImage(ClientPtr client)
}
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(draw->type == XRT_PIXMAP)
return (*SavedProcVector[X_GetImage])(client);
VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
if(!((WindowPtr)pDraw)->realized)
return(BadMatch);
@ -1809,8 +1825,12 @@ int PanoramiXGetImage(ClientPtr client)
}
drawables[0] = pDraw;
for(i = 1; i < PanoramiXNumScreens; i++)
VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client);
for(i = 1; i < PanoramiXNumScreens; i++) {
rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
}
xgi.visual = wVisual (((WindowPtr) pDraw));
xgi.type = X_Reply;
@ -1909,14 +1929,14 @@ PanoramiXPolyText8(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyTextReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyText8])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1948,14 +1968,14 @@ PanoramiXPolyText16(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyTextReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyText16])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1987,14 +2007,14 @@ int PanoramiXImageText8(ClientPtr client)
REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_ImageText8])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -2026,14 +2046,14 @@ int PanoramiXImageText16(ClientPtr client)
REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_ImageText16])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -2064,7 +2084,7 @@ int PanoramiXCreateColormap(ClientPtr client)
REQUEST_SIZE_MATCH(xCreateColormapReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->window, XRT_WINDOW, SecurityReadAccess)))
client, stuff->window, XRT_WINDOW, DixReadAccess)))
return BadWindow;
if(!stuff->visual || (stuff->visual > 255))
@ -2107,7 +2127,7 @@ int PanoramiXFreeColormap(ClientPtr client)
client->errorValue = stuff->id;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->id, XRT_COLORMAP, SecurityDestroyAccess)))
client, stuff->id, XRT_COLORMAP, DixDestroyAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j) {
@ -2136,7 +2156,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->srcCmap, XRT_COLORMAP,
SecurityReadAccess | SecurityWriteAccess)))
DixReadAccess | DixWriteAccess)))
return BadColor;
if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
@ -2174,7 +2194,7 @@ int PanoramiXInstallColormap(ClientPtr client)
client->errorValue = stuff->id;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->id, XRT_COLORMAP, SecurityReadAccess)))
client, stuff->id, XRT_COLORMAP, DixReadAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
@ -2197,7 +2217,7 @@ int PanoramiXUninstallColormap(ClientPtr client)
client->errorValue = stuff->id;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->id, XRT_COLORMAP, SecurityReadAccess)))
client, stuff->id, XRT_COLORMAP, DixReadAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j) {
@ -2220,7 +2240,7 @@ int PanoramiXAllocColor(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
@ -2243,7 +2263,7 @@ int PanoramiXAllocNamedColor(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
@ -2266,7 +2286,7 @@ int PanoramiXAllocColorCells(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
@ -2289,7 +2309,7 @@ int PanoramiXAllocColorPlanes(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
@ -2313,7 +2333,7 @@ int PanoramiXFreeColors(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j) {
@ -2335,7 +2355,7 @@ int PanoramiXStoreColors(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
@ -2358,7 +2378,7 @@ int PanoramiXStoreNamedColor(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){

View File

@ -780,16 +780,17 @@ ProcScreenSaverQueryInfo (client)
{
REQUEST(xScreenSaverQueryInfoReq);
xScreenSaverQueryInfoReply rep;
register int n;
register int n, rc;
ScreenSaverStuffPtr pSaver;
DrawablePtr pDraw;
CARD32 lastInput;
ScreenSaverScreenPrivatePtr pPriv;
REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq);
pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client);
if (!pDraw)
return BadDrawable;
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
pSaver = &savedScreenInfo[pDraw->pScreen->myNum];
pPriv = GetScreenPrivate (pDraw->pScreen);
@ -852,11 +853,13 @@ ProcScreenSaverSelectInput (client)
{
REQUEST(xScreenSaverSelectInputReq);
DrawablePtr pDraw;
int rc;
REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq);
pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client);
if (!pDraw)
return BadDrawable;
rc = dixLookupDrawable (&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
if (!setEventMask (pDraw->pScreen, client, stuff->eventMask))
return BadAlloc;
return Success;
@ -871,9 +874,7 @@ ScreenSaverSetAttributes (ClientPtr client)
ScreenPtr pScreen;
ScreenSaverScreenPrivatePtr pPriv = 0;
ScreenSaverAttrPtr pAttr = 0;
int ret;
int len;
int class, bw, depth;
int ret, len, class, bw, depth;
unsigned long visual;
int idepth, ivisual;
Bool fOK;
@ -891,9 +892,10 @@ ScreenSaverSetAttributes (ClientPtr client)
ColormapPtr pCmap;
REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq);
pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client);
if (!pDraw)
return BadDrawable;
ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (ret != Success)
return ret;
pScreen = pDraw->pScreen;
pParent = WindowTable[pScreen->myNum];
@ -1246,11 +1248,13 @@ ScreenSaverUnsetAttributes (ClientPtr client)
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
ScreenSaverScreenPrivatePtr pPriv;
int rc;
REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq);
pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client);
if (!pDraw)
return BadDrawable;
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
pPriv = GetScreenPrivate (pDraw->pScreen);
if (pPriv && pPriv->attr && pPriv->attr->client == client)
{
@ -1279,7 +1283,7 @@ ProcScreenSaverSetAttributes (ClientPtr client)
REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2);
@ -1291,7 +1295,7 @@ ProcScreenSaverSetAttributes (ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + pback_offset);
if ((tmp != None) && (tmp != ParentRelative)) {
if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_PIXMAP, SecurityReadAccess)))
client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@ -1301,7 +1305,7 @@ ProcScreenSaverSetAttributes (ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + pbord_offset);
if (tmp != CopyFromParent) {
if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_PIXMAP, SecurityReadAccess)))
client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@ -1311,7 +1315,7 @@ ProcScreenSaverSetAttributes (ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
if ((tmp != CopyFromParent) && (tmp != None)) {
if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType(
client, tmp, XRT_COLORMAP, SecurityReadAccess)))
client, tmp, XRT_COLORMAP, DixReadAccess)))
return BadColor;
}
}
@ -1351,7 +1355,7 @@ ProcScreenSaverUnsetAttributes (ClientPtr client)
int i;
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
for(i = PanoramiXNumScreens - 1; i > 0; i--) {

View File

@ -600,7 +600,7 @@ ProcSecurityRevokeAuthorization(
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client,
stuff->authId, SecurityAuthorizationResType, SecurityDestroyAccess);
stuff->authId, SecurityAuthorizationResType, DixDestroyAccess);
if (!pAuth)
return SecurityErrorBase + XSecurityBadAuthorization;
@ -966,7 +966,7 @@ CALLBACK(SecurityCheckResourceIDAccess)
int cid, reqtype;
if (TRUSTLEVEL(client) == XSecurityClientTrusted ||
SecurityUnknownAccess == access_mode)
DixUnknownAccess == access_mode)
return; /* for compatibility, we have to allow access */
cid = CLIENT_ID(id);
@ -1217,7 +1217,7 @@ CALLBACK(SecurityCheckHostlistAccess)
if (TRUSTLEVEL(rec->client) != XSecurityClientTrusted)
{
rec->rval = FALSE;
if (rec->access_mode == SecurityWriteAccess)
if (rec->access_mode == DixWriteAccess)
SecurityAudit("client %d attempted to change host access\n",
rec->client->index);
else
@ -1251,7 +1251,7 @@ typedef struct _PropertyAccessRec {
} PropertyAccessRec, *PropertyAccessPtr;
static PropertyAccessPtr PropertyAccessList = NULL;
static char SecurityDefaultAction = SecurityErrorOperation;
static char SecurityDefaultAction = XaceErrorOperation;
static char *SecurityPolicyFile = DEFAULTPOLICYFILE;
static ATOM SecurityMaxPropertyName = 0;
@ -1410,9 +1410,9 @@ SecurityParsePropertyAccessRule(
{
switch (c)
{
case 'i': action = SecurityIgnoreOperation; break;
case 'a': action = SecurityAllowOperation; break;
case 'e': action = SecurityErrorOperation; break;
case 'i': action = XaceIgnoreOperation; break;
case 'a': action = XaceAllowOperation; break;
case 'e': action = XaceErrorOperation; break;
case 'r': readAction = action; break;
case 'w': writeAction = action; break;
@ -1797,22 +1797,22 @@ CALLBACK(SecurityCheckPropertyAccess)
* If pacl doesn't apply, something above should have
* executed a continue, which will skip the follwing code.
*/
action = SecurityAllowOperation;
if (access_mode & SecurityReadAccess)
action = XaceAllowOperation;
if (access_mode & DixReadAccess)
action = max(action, pacl->readAction);
if (access_mode & SecurityWriteAccess)
if (access_mode & DixWriteAccess)
action = max(action, pacl->writeAction);
if (access_mode & SecurityDestroyAccess)
if (access_mode & DixDestroyAccess)
action = max(action, pacl->destroyAction);
break;
} /* end for each pacl */
} /* end if propertyName <= SecurityMaxPropertyName */
if (SecurityAllowOperation != action)
if (XaceAllowOperation != action)
{ /* audit the access violation */
int cid = CLIENT_ID(pWin->drawable.id);
int reqtype = ((xReq *)client->requestBuffer)->reqType;
char *actionstr = (SecurityIgnoreOperation == action) ?
char *actionstr = (XaceIgnoreOperation == action) ?
"ignored" : "error";
SecurityAudit("client %d attempted request %d with window 0x%x property %s (atom 0x%x) of client %d, %s\n",
client->index, reqtype, pWin->drawable.id,

View File

@ -316,16 +316,16 @@ ProcShapeRectangles (client)
ScreenPtr pScreen;
REQUEST(xShapeRectanglesReq);
xRectangle *prects;
int nrects, ctype;
int nrects, ctype, rc;
RegionPtr srcRgn;
RegionPtr *destRgn;
CreateDftPtr createDefault;
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
UpdateCurrentTime();
pWin = LookupWindow (stuff->dest, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->dest, client, DixUnknownAccess);
if (rc != Success)
return rc;
switch (stuff->destKind) {
case ShapeBounding:
createDefault = CreateBoundingShape;
@ -390,7 +390,7 @@ ProcPanoramiXShapeRectangles(
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
client, stuff->dest, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
FOR_NSCREENS(j) {
@ -419,12 +419,13 @@ ProcShapeMask (client)
RegionPtr *destRgn;
PixmapPtr pPixmap;
CreateDftPtr createDefault;
int rc;
REQUEST_SIZE_MATCH (xShapeMaskReq);
UpdateCurrentTime();
pWin = SecurityLookupWindow (stuff->dest, client, SecurityWriteAccess);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->dest, client, DixWriteAccess);
if (rc != Success)
return rc;
switch (stuff->destKind) {
case ShapeBounding:
createDefault = CreateBoundingShape;
@ -444,7 +445,7 @@ ProcShapeMask (client)
srcRgn = 0;
else {
pPixmap = (PixmapPtr) SecurityLookupIDByType(client, stuff->src,
RT_PIXMAP, SecurityReadAccess);
RT_PIXMAP, DixReadAccess);
if (!pPixmap)
return BadPixmap;
if (pPixmap->drawable.pScreen != pScreen ||
@ -488,12 +489,12 @@ ProcPanoramiXShapeMask(
REQUEST_SIZE_MATCH (xShapeMaskReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
client, stuff->dest, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
if(stuff->src != None) {
if(!(pmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->src, XRT_PIXMAP, SecurityReadAccess)))
client, stuff->src, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
} else
pmap = NULL;
@ -526,12 +527,13 @@ ProcShapeCombine (client)
CreateDftPtr createDefault;
CreateDftPtr createSrc;
RegionPtr tmp;
int rc;
REQUEST_SIZE_MATCH (xShapeCombineReq);
UpdateCurrentTime();
pDestWin = LookupWindow (stuff->dest, client);
if (!pDestWin)
return BadWindow;
rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixUnknownAccess);
if (rc != Success)
return rc;
if (!pDestWin->optional)
MakeWindowOptional (pDestWin);
switch (stuff->destKind) {
@ -550,9 +552,9 @@ ProcShapeCombine (client)
}
pScreen = pDestWin->drawable.pScreen;
pSrcWin = LookupWindow (stuff->src, client);
if (!pSrcWin)
return BadWindow;
rc = dixLookupWindow(&pSrcWin, stuff->src, client, DixUnknownAccess);
if (rc != Success)
return rc;
switch (stuff->srcKind) {
case ShapeBounding:
srcRgn = wBoundingShape (pSrcWin);
@ -616,11 +618,11 @@ ProcPanoramiXShapeCombine(
REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
client, stuff->dest, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
if(!(win2 = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->src, XRT_WINDOW, SecurityReadAccess)))
client, stuff->src, XRT_WINDOW, DixReadAccess)))
return BadWindow;
FOR_NSCREENS(j) {
@ -645,12 +647,13 @@ ProcShapeOffset (client)
ScreenPtr pScreen;
REQUEST(xShapeOffsetReq);
RegionPtr srcRgn;
int rc;
REQUEST_SIZE_MATCH (xShapeOffsetReq);
UpdateCurrentTime();
pWin = LookupWindow (stuff->dest, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->dest, client, DixUnknownAccess);
if (rc != Success)
return rc;
switch (stuff->destKind) {
case ShapeBounding:
srcRgn = wBoundingShape (pWin);
@ -688,7 +691,7 @@ ProcPanoramiXShapeOffset(
REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
client, stuff->dest, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
FOR_NSCREENS(j) {
@ -709,13 +712,13 @@ ProcShapeQueryExtents (client)
WindowPtr pWin;
xShapeQueryExtentsReply rep;
BoxRec extents, *pExtents;
register int n;
register int n, rc;
RegionPtr region;
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -820,13 +823,14 @@ ProcShapeSelectInput (client)
WindowPtr pWin;
ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead;
XID clientResource;
int rc;
REQUEST_SIZE_MATCH (xShapeSelectInputReq);
pWin = SecurityLookupWindow (stuff->window, client, SecurityWriteAccess);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (rc != Success)
return rc;
pHead = (ShapeEventPtr *)SecurityLookupIDByType(client,
pWin->drawable.id, EventType, SecurityWriteAccess);
pWin->drawable.id, EventType, DixWriteAccess);
switch (stuff->enable) {
case xTrue:
if (pHead) {
@ -990,16 +994,16 @@ ProcShapeInputSelected (client)
REQUEST(xShapeInputSelectedReq);
WindowPtr pWin;
ShapeEventPtr pShapeEvent, *pHead;
int enabled;
int enabled, rc;
xShapeInputSelectedReply rep;
register int n;
REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
pHead = (ShapeEventPtr *) SecurityLookupIDByType(client,
pWin->drawable.id, EventType, SecurityReadAccess);
pWin->drawable.id, EventType, DixReadAccess);
enabled = xFalse;
if (pHead) {
for (pShapeEvent = *pHead;
@ -1032,14 +1036,14 @@ ProcShapeGetRectangles (client)
WindowPtr pWin;
xShapeGetRectanglesReply rep;
xRectangle *rects;
int nrects, i;
int nrects, i, rc;
RegionPtr region;
register int n;
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
switch (stuff->kind) {
case ShapeBounding:
region = wBoundingShape(pWin);

View File

@ -571,11 +571,11 @@ ProcPanoramiXShmPutImage(register ClientPtr client)
REQUEST_SIZE_MATCH(xShmPutImageReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -606,7 +606,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
DrawablePtr pDraw;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
int i, x, y, w, h, format;
int i, x, y, w, h, format, rc;
Mask plane = 0, planemask;
long lenPer = 0, length, widthBytesLine;
Bool isRoot;
@ -621,13 +621,16 @@ ProcPanoramiXShmGetImage(ClientPtr client)
}
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if (draw->type == XRT_PIXMAP)
return ProcShmGetImage(client);
VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
@ -660,8 +663,12 @@ ProcPanoramiXShmGetImage(ClientPtr client)
}
drawables[0] = pDraw;
for(i = 1; i < PanoramiXNumScreens; i++)
VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client);
for(i = 1; i < PanoramiXNumScreens; i++) {
rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
}
xgi.visual = wVisual(((WindowPtr)pDraw));
xgi.type = X_Reply;
@ -720,7 +727,7 @@ ProcPanoramiXShmCreatePixmap(
PixmapPtr pMap = NULL;
DrawablePtr pDraw;
DepthPtr pDepth;
int i, j, result;
int i, j, result, rc;
ShmDescPtr shmdesc;
REQUEST(xShmCreatePixmapReq);
PanoramiXRes *newPix;
@ -730,7 +737,11 @@ ProcPanoramiXShmCreatePixmap(
if (!sharedPixmaps)
return BadImplementation;
LEGAL_NEW_RESOURCE(stuff->pid, client);
VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
DixUnknownAccess);
if (rc != Success)
return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
if (!stuff->width || !stuff->height)
{
@ -805,8 +816,8 @@ static int
ProcShmPutImage(client)
register ClientPtr client;
{
register GCPtr pGC;
register DrawablePtr pDraw;
GCPtr pGC;
DrawablePtr pDraw;
long length;
ShmDescPtr shmdesc;
REQUEST(xShmPutImageReq);
@ -909,12 +920,12 @@ static int
ProcShmGetImage(client)
register ClientPtr client;
{
register DrawablePtr pDraw;
DrawablePtr pDraw;
long lenPer = 0, length;
Mask plane = 0;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
int n;
int n, rc;
REQUEST(xShmGetImageReq);
@ -924,7 +935,10 @@ ProcShmGetImage(client)
client->errorValue = stuff->format;
return(BadValue);
}
VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
if (pDraw->type == DRAWABLE_WINDOW)
{
@ -1042,9 +1056,9 @@ ProcShmCreatePixmap(client)
register ClientPtr client;
{
PixmapPtr pMap;
register DrawablePtr pDraw;
DrawablePtr pDraw;
DepthPtr pDepth;
register int i;
register int i, rc;
ShmDescPtr shmdesc;
REQUEST(xShmCreatePixmapReq);
@ -1053,7 +1067,11 @@ ProcShmCreatePixmap(client)
if (!sharedPixmaps)
return BadImplementation;
LEGAL_NEW_RESOURCE(stuff->pid, client);
VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
DixUnknownAccess);
if (rc != Success)
return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
if (!stuff->width || !stuff->height)
{

View File

@ -436,7 +436,7 @@ SyncInitTrigger(client, pTrigger, counter, changes)
if (counter == None)
pCounter = NULL;
else if (!(pCounter = (SyncCounter *)SecurityLookupIDByType(
client, counter, RTCounter, SecurityReadAccess)))
client, counter, RTCounter, DixReadAccess)))
{
client->errorValue = counter;
return SyncErrorBase + XSyncBadCounter;
@ -1452,15 +1452,17 @@ ProcSyncSetPriority(client)
{
REQUEST(xSyncSetPriorityReq);
ClientPtr priorityclient;
int rc;
REQUEST_SIZE_MATCH(xSyncSetPriorityReq);
if (stuff->id == None)
priorityclient = client;
else if (!(priorityclient = LookupClient(stuff->id, client)))
{
client->errorValue = stuff->id;
return BadMatch;
else {
rc = dixLookupClient(&priorityclient, stuff->id, client,
DixUnknownAccess);
if (rc != Success)
return rc;
}
if (priorityclient->priority != stuff->priority)
@ -1487,15 +1489,17 @@ ProcSyncGetPriority(client)
REQUEST(xSyncGetPriorityReq);
xSyncGetPriorityReply rep;
ClientPtr priorityclient;
int rc;
REQUEST_SIZE_MATCH(xSyncGetPriorityReq);
if (stuff->id == None)
priorityclient = client;
else if (!(priorityclient = LookupClient(stuff->id, client)))
{
client->errorValue = stuff->id;
return BadMatch;
else {
rc = dixLookupClient(&priorityclient, stuff->id, client,
DixUnknownAccess);
if (rc != Success)
return rc;
}
rep.type = X_Reply;
@ -1550,7 +1554,7 @@ ProcSyncSetCounter(client)
REQUEST_SIZE_MATCH(xSyncSetCounterReq);
pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->cid,
RTCounter, SecurityWriteAccess);
RTCounter, DixWriteAccess);
if (pCounter == NULL)
{
client->errorValue = stuff->cid;
@ -1583,7 +1587,7 @@ ProcSyncChangeCounter(client)
REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
pCounter = (SyncCounter *) SecurityLookupIDByType(client, stuff->cid,
RTCounter, SecurityWriteAccess);
RTCounter, DixWriteAccess);
if (pCounter == NULL)
{
client->errorValue = stuff->cid;
@ -1621,7 +1625,7 @@ ProcSyncDestroyCounter(client)
REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter,
RTCounter, SecurityDestroyAccess);
RTCounter, DixDestroyAccess);
if (pCounter == NULL)
{
client->errorValue = stuff->counter;
@ -1767,7 +1771,7 @@ ProcSyncQueryCounter(client)
REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter,
RTCounter, SecurityReadAccess);
RTCounter, DixReadAccess);
if (pCounter == NULL)
{
client->errorValue = stuff->counter;
@ -1896,7 +1900,7 @@ ProcSyncChangeAlarm(client)
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
if (!(pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm,
RTAlarm, SecurityWriteAccess)))
RTAlarm, DixWriteAccess)))
{
client->errorValue = stuff->alarm;
return SyncErrorBase + XSyncBadAlarm;
@ -1937,7 +1941,7 @@ ProcSyncQueryAlarm(client)
REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm,
RTAlarm, SecurityReadAccess);
RTAlarm, DixReadAccess);
if (!pAlarm)
{
client->errorValue = stuff->alarm;
@ -1997,7 +2001,7 @@ ProcSyncDestroyAlarm(client)
REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
if (!((SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm,
RTAlarm, SecurityDestroyAccess)))
RTAlarm, DixDestroyAccess)))
{
client->errorValue = stuff->alarm;
return SyncErrorBase + XSyncBadAlarm;

View File

@ -99,7 +99,7 @@ int XaceHook(int hook, ...)
va_arg(ap, WindowPtr),
va_arg(ap, Atom),
va_arg(ap, Mask),
SecurityAllowOperation /* default allow */
XaceAllowOperation /* default allow */
};
calldata = &rec;
prv = &rec.rval;

View File

@ -20,6 +20,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef _XACE_H
#define _XACE_H
/* Hook return codes */
#define XaceErrorOperation 0
#define XaceAllowOperation 1
#define XaceIgnoreOperation 2
#ifdef XACE
#define XACE_EXTENSION_NAME "XAccessControlExtension"
#define XACE_MAJOR_VERSION 1
#define XACE_MINOR_VERSION 0
@ -75,11 +82,6 @@ extern int XaceHook(
/* From the original Security extension...
*/
/* Hook return codes */
#define SecurityAllowOperation 0
#define SecurityIgnoreOperation 1
#define SecurityErrorOperation 2
/* Proc vectors for untrusted clients, swapped and unswapped versions.
* These are the same as the normal proc vectors except that extensions
* that haven't declared themselves secure will have ProcBadRequest plugged
@ -100,4 +102,18 @@ extern void XaceCensorImage(
char * pBuf
);
#else /* XACE */
/* Define calls away when XACE is not being built. */
#ifdef __GNUC__
#define XaceHook(args...) XaceAllowOperation
#define XaceCensorImage(args...) { ; }
#else
#define XaceHook(...) XaceAllowOperation
#define XaceCensorImage(...) { ; }
#endif
#endif /* XACE */
#endif /* _XACE_H */

View File

@ -445,11 +445,10 @@ ProcXF86BigfontQueryFont(
#endif
client->errorValue = stuff->id; /* EITHER font or gc */
pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT,
SecurityReadAccess);
DixReadAccess);
if (!pFont) {
/* can't use VERIFY_GC because it might return BadGC */
GC *pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC,
SecurityReadAccess);
DixReadAccess);
if (!pGC) {
client->errorValue = stuff->id;
return BadFont; /* procotol spec says only error is BadFont */

View File

@ -749,7 +749,7 @@ ProcXpGetPageDimensions(ClientPtr client)
if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
stuff->printContext,
RTcontext,
SecurityReadAccess))
DixReadAccess))
== (XpContextPtr)NULL)
{
client->errorValue = stuff->printContext;
@ -811,7 +811,7 @@ ProcXpSetImageResolution(ClientPtr client)
if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
stuff->printContext,
RTcontext,
SecurityWriteAccess))
DixWriteAccess))
== (XpContextPtr)NULL)
{
client->errorValue = stuff->printContext;
@ -859,7 +859,7 @@ ProcXpGetImageResolution(ClientPtr client)
if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
stuff->printContext,
RTcontext,
SecurityReadAccess))
DixReadAccess))
== (XpContextPtr)NULL)
{
client->errorValue = stuff->printContext;
@ -1068,7 +1068,7 @@ ProcXpSetContext(ClientPtr client)
if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
stuff->printContext,
RTcontext,
SecurityWriteAccess))
DixWriteAccess))
== (XpContextPtr)NULL)
{
client->errorValue = stuff->printContext;
@ -1141,7 +1141,7 @@ ProcXpDestroyContext(ClientPtr client)
if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
stuff->printContext,
RTcontext,
SecurityDestroyAccess))
DixDestroyAccess))
== (XpContextPtr)NULL)
{
client->errorValue = stuff->printContext;
@ -1167,7 +1167,7 @@ ProcXpGetContextScreen(ClientPtr client)
if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
stuff->printContext,
RTcontext,
SecurityReadAccess))
DixReadAccess))
== (XpContextPtr)NULL)
return XpErrorBase+XPBadContext;
@ -1852,9 +1852,10 @@ ProcXpStartPage(ClientPtr client)
if(pContext->state & PAGE_STARTED)
return XpErrorBase+XPBadSequence;
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
SecurityWriteAccess);
if (!pWin || pWin->drawable.pScreen->myNum != pContext->screenNum)
result = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (result != Success)
return result;
if (pWin->drawable.pScreen->myNum != pContext->screenNum)
return BadWindow;
if((c = (XpStPagePtr)xalloc(sizeof(XpStPageRec))) == (XpStPagePtr)NULL)
@ -1943,8 +1944,11 @@ ProcXpPutDocumentData(ClientPtr client)
if (stuff->drawable) {
if (pContext->state & DOC_RAW_STARTED)
return BadDrawable;
pDraw = (DrawablePtr)LookupDrawable(stuff->drawable, client);
if (!pDraw || pDraw->pScreen->myNum != pContext->screenNum)
result = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (result != Success)
return result;
if (pDraw->pScreen->myNum != pContext->screenNum)
return BadDrawable;
} else {
if (pContext->state & DOC_COOKED_STARTED)
@ -1994,7 +1998,7 @@ ProcXpGetDocumentData(ClientPtr client)
if((pContext = (XpContextPtr)SecurityLookupIDByType(client,
stuff->printContext,
RTcontext,
SecurityWriteAccess))
DixWriteAccess))
== (XpContextPtr)NULL)
{
client->errorValue = stuff->printContext;
@ -2077,7 +2081,7 @@ ProcXpGetAttributes(ClientPtr client)
client,
stuff->printContext,
RTcontext,
SecurityReadAccess))
DixReadAccess))
== (XpContextPtr)NULL)
{
client->errorValue = stuff->printContext;
@ -2149,7 +2153,7 @@ ProcXpSetAttributes(ClientPtr client)
client,
stuff->printContext,
RTcontext,
SecurityWriteAccess))
DixWriteAccess))
== (XpContextPtr)NULL)
{
client->errorValue = stuff->printContext;
@ -2229,7 +2233,7 @@ ProcXpGetOneAttribute(ClientPtr client)
client,
stuff->printContext,
RTcontext,
SecurityReadAccess))
DixReadAccess))
== (XpContextPtr)NULL)
{
client->errorValue = stuff->printContext;
@ -2300,7 +2304,7 @@ ProcXpSelectInput(ClientPtr client)
if((pContext=(XpContextPtr)SecurityLookupIDByType(client,
stuff->printContext,
RTcontext,
SecurityWriteAccess))
DixWriteAccess))
== (XpContextPtr)NULL)
{
client->errorValue = stuff->printContext;
@ -2336,7 +2340,7 @@ ProcXpInputSelected(ClientPtr client)
if((pContext=(XpContextPtr)SecurityLookupIDByType(client,
stuff->printContext,
RTcontext,
SecurityReadAccess))
DixReadAccess))
== (XpContextPtr)NULL)
{
client->errorValue = stuff->printContext;

View File

@ -139,12 +139,12 @@ ProcXTestCompareCursor(client)
xXTestCompareCursorReply rep;
WindowPtr pWin;
CursorPtr pCursor;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
pWin = (WindowPtr)LookupWindow(stuff->window, client);
if (!pWin)
return(BadWindow);
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
if (stuff->cursor == None)
pCursor = NullCursor;
else if (stuff->cursor == XTestCurrentCursor)
@ -173,12 +173,10 @@ ProcXTestFakeInput(client)
register ClientPtr client;
{
REQUEST(xXTestFakeInputReq);
int nev;
int n;
int nev, n, type, rc;
xEvent *ev;
DeviceIntPtr dev = NULL;
WindowPtr root;
int type;
#ifdef XINPUT
Bool extension = FALSE;
deviceValuator *dv = NULL;
@ -367,9 +365,10 @@ ProcXTestFakeInput(client)
root = GetCurrentRootWindow();
else
{
root = LookupWindow(ev->u.keyButtonPointer.root, client);
if (!root)
return BadWindow;
rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root, client,
DixUnknownAccess);
if (rc != Success)
return rc;
if (root->parent)
{
client->errorValue = ev->u.keyButtonPointer.root;

View File

@ -373,10 +373,8 @@ ProcXvQueryAdaptors(ClientPtr client)
xvFormat format;
xvAdaptorInfo ainfo;
xvQueryAdaptorsReply rep;
int totalSize;
int na;
int totalSize, na, nf, rc;
XvAdaptorPtr pa;
int nf;
XvFormatPtr pf;
WindowPtr pWin;
ScreenPtr pScreen;
@ -385,11 +383,9 @@ ProcXvQueryAdaptors(ClientPtr client)
REQUEST(xvQueryAdaptorsReq);
REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
if(!(pWin = (WindowPtr)LookupWindow(stuff->window, client) ))
{
client->errorValue = stuff->window;
return (BadWindow);
}
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
pScreen = pWin->drawable.pScreen;
pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
@ -531,9 +527,9 @@ ProcXvQueryEncodings(ClientPtr client)
static int
ProcXvPutVideo(ClientPtr client)
{
register DrawablePtr pDraw;
DrawablePtr pDraw;
XvPortPtr pPort;
register GCPtr pGC;
GCPtr pGC;
int status;
REQUEST(xvPutVideoReq);
@ -577,9 +573,9 @@ ProcXvPutVideo(ClientPtr client)
static int
ProcXvPutStill(ClientPtr client)
{
register DrawablePtr pDraw;
DrawablePtr pDraw;
XvPortPtr pPort;
register GCPtr pGC;
GCPtr pGC;
int status;
REQUEST(xvPutStillReq);
@ -624,9 +620,9 @@ ProcXvPutStill(ClientPtr client)
static int
ProcXvGetVideo(ClientPtr client)
{
register DrawablePtr pDraw;
DrawablePtr pDraw;
XvPortPtr pPort;
register GCPtr pGC;
GCPtr pGC;
int status;
REQUEST(xvGetVideoReq);
@ -671,9 +667,9 @@ ProcXvGetVideo(ClientPtr client)
static int
ProcXvGetStill(ClientPtr client)
{
register DrawablePtr pDraw;
DrawablePtr pDraw;
XvPortPtr pPort;
register GCPtr pGC;
GCPtr pGC;
int status;
REQUEST(xvGetStillReq);
@ -717,15 +713,14 @@ ProcXvGetStill(ClientPtr client)
static int
ProcXvSelectVideoNotify(ClientPtr client)
{
register DrawablePtr pDraw;
DrawablePtr pDraw;
int rc;
REQUEST(xvSelectVideoNotifyReq);
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
if(!(pDraw = (DrawablePtr)LOOKUP_DRAWABLE(stuff->drawable, client) ))
{
client->errorValue = stuff->drawable;
return (BadWindow);
}
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixUnknownAccess);
if (rc != Success)
return rc;
return XVCALL(diSelectVideoNotify)(client, pDraw, stuff->onoff);
@ -822,8 +817,8 @@ ProcXvUngrabPort(ClientPtr client)
static int
ProcXvStopVideo(ClientPtr client)
{
int status;
register DrawablePtr pDraw;
int status, rc;
DrawablePtr pDraw;
XvPortPtr pPort;
REQUEST(xvStopVideoReq);
REQUEST_SIZE_MATCH(xvStopVideoReq);
@ -840,11 +835,9 @@ ProcXvStopVideo(ClientPtr client)
return (status);
}
if(!(pDraw = LOOKUP_DRAWABLE(stuff->drawable, client) ))
{
client->errorValue = stuff->drawable;
return (BadDrawable);
}
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixUnknownAccess);
if (rc != Success)
return rc;
return XVCALL(diStopVideo)(client, pPort, pDraw);
@ -1877,11 +1870,11 @@ XineramaXvStopVideo(ClientPtr client)
REQUEST_SIZE_MATCH(xvStopVideoReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->port, XvXRTPort, SecurityReadAccess)))
client, stuff->port, XvXRTPort, DixReadAccess)))
return _XvBadPort;
FOR_NSCREENS_BACKWARD(i) {
@ -1905,7 +1898,7 @@ XineramaXvSetPortAttribute(ClientPtr client)
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->port, XvXRTPort, SecurityReadAccess)))
client, stuff->port, XvXRTPort, DixReadAccess)))
return _XvBadPort;
FOR_NSCREENS_BACKWARD(i) {
@ -1931,15 +1924,15 @@ XineramaXvShmPutImage(ClientPtr client)
REQUEST_SIZE_MATCH(xvShmPutImageReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->port, XvXRTPort, SecurityReadAccess)))
client, stuff->port, XvXRTPort, DixReadAccess)))
return _XvBadPort;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1978,15 +1971,15 @@ XineramaXvPutImage(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->port, XvXRTPort, SecurityReadAccess)))
client, stuff->port, XvXRTPort, DixReadAccess)))
return _XvBadPort;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -2023,15 +2016,15 @@ XineramaXvPutVideo(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xvPutVideoReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->port, XvXRTPort, SecurityReadAccess)))
client, stuff->port, XvXRTPort, DixReadAccess)))
return _XvBadPort;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -2068,15 +2061,15 @@ XineramaXvPutStill(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->port, XvXRTPort, SecurityReadAccess)))
client, stuff->port, XvXRTPort, DixReadAccess)))
return _XvBadPort;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;

View File

@ -106,7 +106,7 @@ SProcXChangeDeviceDontPropagateList(register ClientPtr client)
int
ProcXChangeDeviceDontPropagateList(register ClientPtr client)
{
int i;
int i, rc;
WindowPtr pWin;
struct tmask tmp[EMASKSIZE];
OtherInputMasks *others;
@ -121,11 +121,10 @@ ProcXChangeDeviceDontPropagateList(register ClientPtr client)
return Success;
}
pWin = (WindowPtr) LookupWindow(stuff->window, client);
if (!pWin) {
client->errorValue = stuff->window;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadWindow);
rc);
return Success;
}

View File

@ -505,6 +505,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
WindowPtr pWin, confineTo;
CursorPtr cursor;
GrabPtr grab;
int rc;
if ((this_device_mode != GrabModeSync) &&
(this_device_mode != GrabModeAsync)) {
@ -524,15 +525,15 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
client->errorValue = ownerEvents;
return BadValue;
}
pWin = LookupWindow(grabWindow, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, grabWindow, client, DixUnknownAccess);
if (rc != Success)
return rc;
if (rconfineTo == None)
confineTo = NullWindow;
else {
confineTo = LookupWindow(rconfineTo, client);
if (!confineTo)
return BadWindow;
rc = dixLookupWindow(&confineTo, rconfineTo, client, DixUnknownAccess);
if (rc != Success)
return rc;
}
if (rcursor == None)
cursor = NullCursor;
@ -562,6 +563,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
WindowPtr pWin;
GrabPtr grab;
KeyClassPtr k = dev->key;
int rc;
if (k == NULL)
return BadMatch;
@ -588,9 +590,9 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
client->errorValue = ownerEvents;
return BadValue;
}
pWin = LookupWindow(grabWindow, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, grabWindow, client, DixUnknownAccess);
if (rc != Success)
return rc;
grab = CreateGrab(client->index, dev, pWin,
mask, ownerEvents, this_device_mode, other_devices_mode,
@ -810,7 +812,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
} else
effectiveFocus = pWin = inputFocus;
} else
pWin = LookupWindow(dest, client);
dixLookupWindow(&pWin, dest, client, DixUnknownAccess);
if (!pWin)
return BadWindow;
if ((propagate != xFalse) && (propagate != xTrue)) {

View File

@ -100,7 +100,7 @@ int
ProcXGetDeviceDontPropagateList(register ClientPtr client)
{
CARD16 count = 0;
int i;
int i, rc;
XEventClass *buf = NULL, *tbuf;
WindowPtr pWin;
xGetDeviceDontPropagateListReply rep;
@ -115,11 +115,10 @@ ProcXGetDeviceDontPropagateList(register ClientPtr client)
rep.length = 0;
rep.count = 0;
pWin = (WindowPtr) LookupWindow(stuff->window, client);
if (!pWin) {
client->errorValue = stuff->window;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0,
BadWindow);
rc);
return Success;
}

View File

@ -98,8 +98,7 @@ SProcXGetSelectedExtensionEvents(register ClientPtr client)
int
ProcXGetSelectedExtensionEvents(register ClientPtr client)
{
int i;
int total_length = 0;
int i, rc, total_length = 0;
xGetSelectedExtensionEventsReply rep;
WindowPtr pWin;
XEventClass *buf = NULL;
@ -118,9 +117,10 @@ ProcXGetSelectedExtensionEvents(register ClientPtr client)
rep.this_client_count = 0;
rep.all_clients_count = 0;
if (!(pWin = LookupWindow(stuff->window, client))) {
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0,
BadWindow);
rc);
return Success;
}

View File

@ -170,11 +170,9 @@ ProcXSelectExtensionEvent(register ClientPtr client)
return Success;
}
pWin = (WindowPtr) LookupWindow(stuff->window, client);
if (!pWin) {
client->errorValue = stuff->window;
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
BadWindow);
ret = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (ret != Success) {
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, ret);
return Success;
}

View File

@ -105,6 +105,7 @@ ProcXUngrabDeviceButton(ClientPtr client)
DeviceIntPtr mdev;
WindowPtr pWin;
GrabRec temporaryGrab;
int rc;
REQUEST(xUngrabDeviceButtonReq);
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
@ -134,9 +135,9 @@ ProcXUngrabDeviceButton(ClientPtr client)
} else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
pWin = LookupWindow(stuff->grabWindow, client);
if (!pWin) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadWindow);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, rc);
return Success;
}

View File

@ -105,6 +105,7 @@ ProcXUngrabDeviceKey(ClientPtr client)
DeviceIntPtr mdev;
WindowPtr pWin;
GrabRec temporaryGrab;
int rc;
REQUEST(xUngrabDeviceKeyReq);
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
@ -133,9 +134,9 @@ ProcXUngrabDeviceKey(ClientPtr client)
} else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
pWin = LookupWindow(stuff->grabWindow, client);
if (!pWin) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadWindow);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, rc);
return Success;
}
if (((stuff->key > dev->key->curKeySyms.maxKeyCode) ||

View File

@ -269,7 +269,10 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
client->errorValue = stuff->window;
return BadWindow;
}
if (!pWin->viewable)
return BadMatch;
LEGAL_NEW_RESOURCE (stuff->pixmap, client);
cw = GetCompWindow (pWin);

View File

@ -93,10 +93,10 @@ typedef struct _compPixmapVisit {
static Bool
compRepaintBorder (ClientPtr pClient, pointer closure)
{
WindowPtr pWindow = LookupWindow ((XID) closure, pClient);
WindowPtr pWindow;
int rc = dixLookupWindow(&pWindow, (XID)closure, pClient,DixUnknownAccess);
if (pWindow)
{
if (rc == Success) {
RegionRec exposed;
REGION_NULL(pScreen, &exposed);

View File

@ -36,10 +36,10 @@
/* the above comment lies. there is no better way. */
#include "input.h"
#include "inputstr.h"
#include "config.h"
#include "hotplug.h"
#include "os.h"
#define MATCH_RULE "type='method_call',interface='org.x.config.input'"
#define CONFIG_MATCH_RULE "type='method_call',interface='org.x.config.input'"
#define MALFORMED_MSG "[config] malformed message, dropping"
#define MALFORMED_MESSAGE() { DebugF(MALFORMED_MSG "\n"); \
@ -50,18 +50,44 @@
ret = BadValue; \
goto unwind; }
static DBusConnection *configConnection = NULL;
static int configfd = -1;
static char busobject[32] = { 0 };
static char busname[64] = { 0 };
/* How often to attempt reconnecting when we get booted off the bus. */
#define RECONNECT_DELAY 10000 /* in ms */
void
configDispatch()
struct config_data {
int fd;
DBusConnection *connection;
char busobject[32];
char busname[64];
};
static struct config_data *configData;
static CARD32 configReconnect(OsTimerPtr timer, CARD32 time, pointer arg);
static void
configWakeupHandler(pointer blockData, int err, pointer pReadMask)
{
if (!configConnection)
return;
struct config_data *data = blockData;
dbus_connection_read_write_dispatch(configConnection, 0);
if (data->connection && FD_ISSET(data->fd, (fd_set *) pReadMask))
dbus_connection_read_write_dispatch(data->connection, 0);
}
static void
configBlockHandler(pointer data, struct timeval **tv, pointer pReadMask)
{
}
static void
configTeardown(void)
{
if (configData) {
RemoveGeneralSocket(configData->fd);
RemoveBlockAndWakeupHandlers(configBlockHandler, configWakeupHandler,
configData);
xfree(configData);
configData = NULL;
}
}
static int
@ -217,23 +243,22 @@ configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
ret = configAddDevice(message, &iter, &error);
else if (strcmp(dbus_message_get_member(message), "remove") == 0)
ret = configRemoveDevice(message, &iter, &error);
}
if (ret != BadDrawable && ret != BadAlloc) {
reply = dbus_message_new_method_return(message);
dbus_message_iter_init_append(reply, &iter);
if (ret != BadDrawable && ret != BadAlloc) {
reply = dbus_message_new_method_return(message);
dbus_message_iter_init_append(reply, &iter);
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret)) {
ErrorF("[config] couldn't append to iterator\n");
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_HANDLED;
}
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret)) {
ErrorF("[config] couldn't append to iterator\n");
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_HANDLED;
if (!dbus_connection_send(bus, reply, NULL))
ErrorF("[config] failed to send reply\n");
dbus_connection_flush(bus);
dbus_message_unref(reply);
}
if (!dbus_connection_send(bus, reply, NULL))
ErrorF("[config] failed to send reply\n");
dbus_connection_flush(bus);
dbus_message_unref(reply);
}
dbus_error_free(&error);
@ -246,71 +271,147 @@ configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
return DBUS_HANDLER_RESULT_HANDLED;
}
void
configInitialise()
/**
* This is a filter, which only handles the disconnected signal, which
* doesn't go to the normal message handling function. This takes
* precedence over the message handling function, so have have to be
* careful to ignore anything we don't want to deal with here.
*
* Yes, this is brutally stupid.
*/
static DBusHandlerResult
configFilter(DBusConnection *connection, DBusMessage *message, void *closure)
{
if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL,
"Disconnected")) {
ErrorF("[dbus] disconnected from bus\n");
TimerSet(NULL, 0, RECONNECT_DELAY, configReconnect, NULL);
configTeardown();
return DBUS_HANDLER_RESULT_HANDLED;
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
static Bool
configSetup(void)
{
DBusConnection *bus = NULL;
DBusError error;
DBusObjectPathVTable vtable = { .message_function = configMessage };
configConnection = NULL;
if (!configData)
configData = (struct config_data *) xcalloc(sizeof(struct config_data), 1);
if (!configData) {
ErrorF("[dbus] failed to allocate data struct.\n");
return FALSE;
}
dbus_error_init(&error);
bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
if (!bus || dbus_error_is_set(&error)) {
configData->connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
if (!configData->connection || dbus_error_is_set(&error)) {
ErrorF("[dbus] some kind of error occurred: %s (%s)\n", error.name,
error.message);
dbus_error_free(&error);
return;
xfree(configData);
configData = NULL;
return FALSE;
}
if (!dbus_connection_get_unix_fd(bus, &configfd)) {
dbus_connection_unref(bus);
dbus_connection_set_exit_on_disconnect(configData->connection, FALSE);
if (!dbus_connection_get_unix_fd(configData->connection, &configData->fd)) {
dbus_connection_unref(configData->connection);
ErrorF("[dbus] couldn't get fd for bus\n");
dbus_error_free(&error);
configfd = -1;
return;
xfree(configData);
configData = NULL;
return FALSE;
}
snprintf(busname, sizeof(busname), "org.x.config.display%d", atoi(display));
if (!dbus_bus_request_name(bus, busname, 0, &error) ||
dbus_error_is_set(&error)) {
snprintf(configData->busname, sizeof(configData->busname),
"org.x.config.display%d", atoi(display));
if (!dbus_bus_request_name(configData->connection, configData->busname,
0, &error) || dbus_error_is_set(&error)) {
ErrorF("[dbus] couldn't take over org.x.config: %s (%s)\n",
error.name, error.message);
dbus_error_free(&error);
dbus_connection_unref(bus);
configfd = -1;
return;
dbus_connection_unref(configData->connection);
xfree(configData);
configData = NULL;
return FALSE;
}
/* blocks until we get a reply. */
dbus_bus_add_match(bus, MATCH_RULE, &error);
dbus_bus_add_match(configData->connection, CONFIG_MATCH_RULE, &error);
if (dbus_error_is_set(&error)) {
ErrorF("[dbus] couldn't match X.Org rule: %s (%s)\n", error.name,
error.message);
dbus_error_free(&error);
dbus_bus_release_name(bus, busname, &error);
dbus_connection_unref(bus);
configfd = -1;
return;
dbus_bus_release_name(configData->connection, configData->busname,
&error);
dbus_connection_unref(configData->connection);
xfree(configData);
configData = NULL;
return FALSE;
}
snprintf(busobject, sizeof(busobject), "/org/x/config/%d", atoi(display));
if (!dbus_connection_register_object_path(bus, busobject, &vtable, bus)) {
ErrorF("[dbus] couldn't register object path\n");
configfd = -1;
dbus_bus_release_name(bus, busname, &error);
dbus_bus_remove_match(bus, MATCH_RULE, &error);
dbus_connection_unref(bus);
if (!dbus_connection_add_filter(configData->connection, configFilter,
configData, NULL)) {
ErrorF("[dbus] couldn't add signal filter: %s (%s)\n", error.name,
error.message);
dbus_error_free(&error);
return;
dbus_bus_release_name(configData->connection, configData->busname,
&error);
dbus_bus_remove_match(configData->connection, CONFIG_MATCH_RULE,
&error);
dbus_connection_unref(configData->connection);
xfree(configData);
configData = NULL;
return FALSE;
}
DebugF("[dbus] registered object path %s\n", busobject);
snprintf(configData->busobject, sizeof(configData->busobject),
"/org/x/config/%d", atoi(display));
if (!dbus_connection_register_object_path(configData->connection,
configData->busobject, &vtable,
configData->connection)) {
ErrorF("[dbus] couldn't register object path\n");
dbus_bus_release_name(configData->connection, configData->busname,
&error);
dbus_bus_remove_match(configData->connection, CONFIG_MATCH_RULE,
&error);
dbus_connection_unref(configData->connection);
dbus_error_free(&error);
xfree(configData);
configData = NULL;
return FALSE;
}
DebugF("[dbus] registered object path %s\n", configData->busobject);
dbus_error_free(&error);
configConnection = bus;
AddGeneralSocket(configfd);
AddGeneralSocket(configData->fd);
RegisterBlockAndWakeupHandlers(configBlockHandler, configWakeupHandler,
configData);
return TRUE;
}
static CARD32
configReconnect(OsTimerPtr timer, CARD32 time, pointer arg)
{
if (configSetup())
return 0;
else
return RECONNECT_DELAY;
}
void
configInitialise()
{
TimerSet(NULL, 0, 1, configReconnect, NULL);
}
void
@ -318,26 +419,24 @@ configFini()
{
DBusError error;
if (configConnection) {
if (configData) {
dbus_error_init(&error);
dbus_connection_unregister_object_path(configConnection, busobject);
dbus_bus_remove_match(configConnection, MATCH_RULE, &error);
dbus_bus_release_name(configConnection, busname, &error);
dbus_connection_unref(configConnection);
RemoveGeneralSocket(configfd);
configConnection = NULL;
configfd = -1;
dbus_connection_unregister_object_path(configData->connection,
configData->busobject);
dbus_connection_remove_filter(configData->connection, configFilter,
configData);
dbus_bus_remove_match(configData->connection, CONFIG_MATCH_RULE,
&error);
dbus_bus_release_name(configData->connection, configData->busname,
&error);
dbus_connection_unref(configData->connection);
dbus_error_free(&error);
configTeardown();
}
}
#else /* !HAVE_DBUS */
void
configDispatch()
{
}
void
configInitialise()
{

View File

@ -174,7 +174,7 @@ AC_CACHE_CHECK([for SYSV IPC],
[AC_TRY_LINK([
#include <sys/shm.h>
],[
int main () {
{
int id;
id = shmget(IPC_PRIVATE, 512, SHM_W | SHM_R);
if (id < 0) return -1;
@ -391,7 +391,7 @@ AC_ARG_WITH(mesa-source, AS_HELP_STRING([--with-mesa-source=MESA_SOURCE], [P
AC_ARG_WITH(fontdir, AS_HELP_STRING([--with-fontdir=FONTDIR], [Path to top level dir where fonts are installed (default: ${libdir}/X11/fonts)]),
[ FONTDIR="$withval" ],
[ FONTDIR="${libdir}/X11/fonts" ])
DEFAULT_FONT_PATH="${FONTDIR}/misc/,${FONTDIR}/TTF/,${FONTDIR}/OTF,${FONTDIR}/Type1/,${FONTDIR}/CID/,${FONTDIR}/100dpi/,${FONTDIR}/75dpi/"
DEFAULT_FONT_PATH="${FONTDIR}/misc/,${FONTDIR}/TTF/,${FONTDIR}/OTF,${FONTDIR}/Type1/,${FONTDIR}/100dpi/,${FONTDIR}/75dpi/"
AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
[ FONTPATH="$withval" ],
[ FONTPATH="${DEFAULT_FONT_PATH}" ])
@ -545,7 +545,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
dnl Core modules for most extensions, et al.
REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto xproto xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4] [kbproto >= 1.0.3]"
REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto xproto xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4] [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc"
if test "x$DBUS" = xauto; then
@ -655,6 +655,9 @@ if test "x$DRI" = xyes; then
PKG_CHECK_MODULES([DRIPROTO], [xf86driproto])
PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.0])
PKG_CHECK_MODULES([GL], [glproto >= 1.4.1])
PKG_CHECK_EXISTS(libdrm >= 2.2.0,
[AC_DEFINE([HAVE_LIBDRM_2_2], 1,
[Has version 2.2 (or newer) of the drm library])])
AC_SUBST(DRIPROTO_CFLAGS)
AC_SUBST(LIBDRM_CFLAGS)
AC_SUBST(LIBDRM_LIBS)
@ -1004,7 +1007,7 @@ dnl ---------------------------------------------------------------------------
dnl DMX DDX
AC_MSG_CHECKING([whether to build Xdmx DDX])
PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no])
PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfixes xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no])
if test "x$DMX" = xauto; then
DMX="$have_dmx"
fi
@ -1056,7 +1059,7 @@ AC_MSG_RESULT([$XVFB])
AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
if test "x$XVFB" = xyes; then
XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB $LIBS"
XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB $LIBS"
AC_SUBST([XVFB_LIBS])
fi
@ -1383,6 +1386,7 @@ dnl has it in libc), or if libdl is needed to get it.
AC_DEFINE_DIR(__XCONFIGFILE__, XF86CONFIGFILE, [Name of configuration file])
AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration file])
AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
@ -1758,13 +1762,11 @@ AM_CONDITIONAL(BUILD_KBD_MODE, [test x$BUILD_KBD_MODE = xyes])
AM_CONDITIONAL(BSD_KBD_MODE, [test x$KBD_MODE_TYPE = xbsd])
AM_CONDITIONAL(SUN_KBD_MODE, [test x$KBD_MODE_TYPE = xsun])
CFLAGS="$XSERVER_CFLAGS $CFLAGS"
AC_SUBST([CFLAGS])
BUILD_DATE="$(date +'%Y%m%d')"
AC_SUBST([BUILD_DATE])
DIX_CFLAGS="-DHAVE_DIX_CONFIG_H"
DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
AC_SUBST([DIX_CFLAGS])
AC_SUBST([libdir exec_prefix prefix])

View File

@ -34,6 +34,7 @@ MANDEFS = \
-D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
-D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
-D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
-D__mandir__=$(mandir) \
-D__projectroot__=$(prefix) \
-D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
-D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)

View File

@ -173,13 +173,17 @@ ProcDamageCreate (ClientPtr client)
DamageExtPtr pDamageExt;
DamageReportLevel level;
RegionPtr pRegion;
int rc;
REQUEST(xDamageCreateReq);
REQUEST_SIZE_MATCH(xDamageCreateReq);
LEGAL_NEW_RESOURCE(stuff->damage, client);
SECURITY_VERIFY_DRAWABLE (pDrawable, stuff->drawable, client,
SecurityReadAccess);
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success)
return rc;
switch (stuff->level) {
case XDamageReportRawRectangles:
level = DamageReportRawRegion;
@ -237,7 +241,7 @@ ProcDamageDestroy (ClientPtr client)
DamageExtPtr pDamageExt;
REQUEST_SIZE_MATCH(xDamageDestroyReq);
VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, SecurityWriteAccess);
VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess);
FreeResource (stuff->damage, RT_NONE);
return (client->noClientException);
}
@ -251,9 +255,9 @@ ProcDamageSubtract (ClientPtr client)
RegionPtr pParts;
REQUEST_SIZE_MATCH(xDamageSubtractReq);
VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, SecurityWriteAccess);
VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, SecurityWriteAccess);
VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, SecurityWriteAccess);
VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess);
VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess);
VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess);
if (pDamageExt->level != DamageReportRawRegion)
{

View File

@ -405,11 +405,9 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
/* The window must be valid. */
if (!(pWin = SecurityLookupWindow(stuff->window, client,
SecurityWriteAccess)))
{
return(BadWindow);
}
status = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (status != Success)
return status;
/* The window must be InputOutput. */
if (pWin->drawable.class != InputOutput)
@ -633,9 +631,9 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
/* Buffer name must be valid */
if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client,
stuff->buffer, dbeWindowPrivResType, SecurityDestroyAccess)) ||
stuff->buffer, dbeWindowPrivResType, DixDestroyAccess)) ||
!(SecurityLookupIDByType(client, stuff->buffer, dbeDrawableResType,
SecurityDestroyAccess)))
DixDestroyAccess)))
{
client->errorValue = stuff->buffer;
return(dbeErrorBase + DbeBadBuffer);
@ -729,11 +727,11 @@ ProcDbeSwapBuffers(ClientPtr client)
/* Check all windows to swap. */
/* Each window must be a valid window - BadWindow. */
if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client,
SecurityWriteAccess)))
{
error = dixLookupWindow(&pWin, dbeSwapInfo[i].window, client,
DixWriteAccess);
if (error != Success) {
DEALLOCATE_LOCAL(swapInfo);
return(BadWindow);
return error;
}
/* Each window must be double-buffered - BadMatch. */
@ -867,7 +865,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
xDbeGetVisualInfoReply rep;
Drawable *drawables;
DrawablePtr *pDrawables = NULL;
register int i, j, n;
register int i, j, n, rc;
register int count; /* number of visual infos in reply */
register int length; /* length of reply */
ScreenPtr pScreen;
@ -889,11 +887,11 @@ ProcDbeGetVisualInfo(ClientPtr client)
for (i = 0; i < stuff->n; i++)
{
if (!(pDrawables[i] = (DrawablePtr)SecurityLookupDrawable(
drawables[i], client, SecurityReadAccess)))
{
rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0,
DixReadAccess);
if (rc != Success) {
DEALLOCATE_LOCAL(pDrawables);
return(BadDrawable);
return rc;
}
}
}
@ -1047,7 +1045,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client,
stuff->buffer, dbeWindowPrivResType, SecurityReadAccess)))
stuff->buffer, dbeWindowPrivResType, DixReadAccess)))
{
rep.attributes = None;
}

View File

@ -52,7 +52,7 @@ Xserver-dtrace.h: $(srcdir)/Xserver.d
dtrace-dix.o: $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS)
$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o
noinst_LIBRARIES = dix.O
noinst_PROGRAMS = dix.O
dix.O: dtrace-dix.o $(am_libdix_la_OBJECTS)
ld -r -o $@ .libs/*.o

View File

@ -903,7 +903,7 @@ AllocColor (ColormapPtr pmap,
{
ColormapPtr prootmap = (ColormapPtr)
SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap,
RT_COLORMAP, SecurityReadAccess);
RT_COLORMAP, DixReadAccess);
if (pmap->class == prootmap->class)
FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb,
@ -920,7 +920,7 @@ AllocColor (ColormapPtr pmap,
{
ColormapPtr prootmap = (ColormapPtr)
SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap,
RT_COLORMAP, SecurityReadAccess);
RT_COLORMAP, DixReadAccess);
if (pmap->class == prootmap->class)
{

View File

@ -262,9 +262,9 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
GlyphSharePtr pShare;
sourcefont = (FontPtr) SecurityLookupIDByType(client, source, RT_FONT,
SecurityReadAccess);
DixReadAccess);
maskfont = (FontPtr) SecurityLookupIDByType(client, mask, RT_FONT,
SecurityReadAccess);
DixReadAccess);
if (!sourcefont)
{

View File

@ -69,9 +69,7 @@ SOFTWARE.
#ifdef XKB
#include <X11/extensions/XKBsrv.h>
#endif
#ifdef XACE
#include "xace.h"
#endif
#include "dispatch.h"
#include "swaprep.h"
@ -1178,10 +1176,8 @@ DoSetModifierMapping(ClientPtr client, KeyCode *inputMap,
}
}
#ifdef XACE
if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE))
return BadAccess;
#endif
/* None of the modifiers (old or new) may be down while we change
* the map. */
@ -1302,14 +1298,12 @@ ProcChangeKeyboardMapping(ClientPtr client)
return BadValue;
}
#ifdef XACE
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE))
return BadAccess;
}
}
#endif
keysyms.minKeyCode = stuff->firstKeyCode;
keysyms.maxKeyCode = stuff->firstKeyCode + stuff->keyCodes - 1;
@ -1655,7 +1649,6 @@ ProcChangeKeyboardControl (ClientPtr client)
if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
return BadLength;
#ifdef XACE
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if ((pDev->coreEvents || pDev == inputInfo.keyboard) &&
pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
@ -1663,7 +1656,6 @@ ProcChangeKeyboardControl (ClientPtr client)
return BadAccess;
}
}
#endif
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if ((pDev->coreEvents || pDev == inputInfo.keyboard) &&
@ -1848,16 +1840,16 @@ ProcGetMotionEvents(ClientPtr client)
WindowPtr pWin;
xTimecoord * coords = (xTimecoord *) NULL;
xGetMotionEventsReply rep;
int i, count, xmin, xmax, ymin, ymax;
int i, count, xmin, xmax, ymin, ymax, rc;
unsigned long nEvents;
DeviceIntPtr mouse = inputInfo.pointer;
TimeStamp start, stop;
REQUEST(xGetMotionEventsReq);
REQUEST_SIZE_MATCH(xGetMotionEventsReq);
pWin = SecurityLookupWindow(stuff->window, client, TRUE);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client);
rep.type = X_Reply;
@ -1920,15 +1912,13 @@ ProcQueryKeymap(ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 2;
#ifdef XACE
if (!XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE))
{
bzero((char *)&rep.map[0], 32);
}
if (XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE))
for (i = 0; i<32; i++)
rep.map[i] = down[i];
else
#endif
for (i = 0; i<32; i++)
rep.map[i] = down[i];
bzero((char *)&rep.map[0], 32);
WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep);
return Success;
}

File diff suppressed because it is too large Load Diff

View File

@ -1178,7 +1178,7 @@ doPolyText(ClientPtr client, register PTclosurePtr c)
if (c->slept &&
c->pDraw &&
c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did,
RC_DRAWABLE, SecurityWriteAccess))
RC_DRAWABLE, DixWriteAccess))
{
/* Our drawable has disappeared. Treat like client died... ask
the FPE code to clean up after client and avoid further
@ -1208,7 +1208,7 @@ doPolyText(ClientPtr client, register PTclosurePtr c)
| ((Font)*(c->pElt+2)) << 16
| ((Font)*(c->pElt+1)) << 24;
pFont = (FontPtr)SecurityLookupIDByType(client, fid, RT_FONT,
SecurityReadAccess);
DixReadAccess);
if (!pFont)
{
client->errorValue = fid;
@ -1463,7 +1463,7 @@ doImageText(ClientPtr client, register ITclosurePtr c)
if (c->slept &&
c->pDraw &&
c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did,
RC_DRAWABLE, SecurityWriteAccess))
RC_DRAWABLE, DixWriteAccess))
{
/* Our drawable has disappeared. Treat like client died... ask
the FPE code to clean up after client. */
@ -2016,7 +2016,7 @@ FontPtr
find_old_font(XID id)
{
return (FontPtr) SecurityLookupIDByType(NullClient, id, RT_NONE,
SecurityUnknownAccess);
DixUnknownAccess);
}
Font

View File

@ -95,9 +95,7 @@ Author: Adobe Systems Incorporated
#include "scrnintstr.h"
#define XK_LATIN1
#include <X11/keysymdef.h>
#ifdef XACE
#include "xace.h"
#endif
/*
* CompareTimeStamps returns -1, 0, or +1 depending on if the first
@ -196,115 +194,144 @@ CompareISOLatin1Lowered(unsigned char *s1, int s1len,
return (int) c1 - (int) c2;
}
#ifdef XACE
/* SecurityLookupWindow and SecurityLookupDrawable:
* Look up the window/drawable taking into account the client doing
* the lookup and the type of access desired. Return the window/drawable
* if it exists and the client is allowed access, else return NULL.
* Most Proc* functions should be calling these instead of
* LookupWindow and LookupDrawable, which do no access checks.
* XACE note: need to see if client->lastDrawableID can still be used here.
/*
* dixLookupWindow and dixLookupDrawable:
* Look up the window/drawable taking into account the client doing the
* lookup, the type of drawable desired, and the type of access desired.
* Return Success with *pDraw set if the window/drawable exists and the client
* is allowed access, else return an error code with *pDraw set to NULL. The
* access mask values are defined in resource.h. The type mask values are
* defined in pixmap.h, with zero equivalent to M_DRAWABLE.
*/
_X_EXPORT WindowPtr
SecurityLookupWindow(XID rid, ClientPtr client, Mask access_mode)
_X_EXPORT int
dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
Mask type, Mask access)
{
client->errorValue = rid;
if(rid == INVALID)
return NULL;
return (WindowPtr)SecurityLookupIDByType(client, rid, RT_WINDOW, access_mode);
}
DrawablePtr pTmp;
RESTYPE rtype;
*pDraw = NULL;
client->errorValue = id;
if (id == INVALID)
return BadDrawable;
_X_EXPORT pointer
SecurityLookupDrawable(XID rid, ClientPtr client, Mask access_mode)
{
register DrawablePtr pDraw;
if (id == client->lastDrawableID) {
pTmp = client->lastDrawable;
if(rid == INVALID)
return (pointer) NULL;
pDraw = (DrawablePtr)SecurityLookupIDByClass(client, rid, RC_DRAWABLE,
access_mode);
if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW))
return (pointer)pDraw;
return (pointer)NULL;
}
/* an access check is required for cached drawables */
rtype = (pTmp->type | M_WINDOW) ? RT_WINDOW : RT_PIXMAP;
if (!XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, access, pTmp))
return BadDrawable;
} else
pTmp = (DrawablePtr)SecurityLookupIDByClass(client, id, RC_DRAWABLE,
access);
if (!pTmp)
return BadDrawable;
if (!((1 << pTmp->type) | (type ? type : M_DRAWABLE)))
return BadMatch;
/* We can't replace the LookupWindow and LookupDrawable functions with
* macros because of compatibility with loadable servers.
*/
_X_EXPORT WindowPtr
LookupWindow(XID rid, ClientPtr client)
{
return SecurityLookupWindow(rid, client, SecurityUnknownAccess);
}
_X_EXPORT pointer
LookupDrawable(XID rid, ClientPtr client)
{
return SecurityLookupDrawable(rid, client, SecurityUnknownAccess);
}
#else /* not XACE */
WindowPtr
LookupWindow(XID rid, ClientPtr client)
{
WindowPtr pWin;
client->errorValue = rid;
if(rid == INVALID)
return NULL;
if (client->lastDrawableID == rid)
{
if (client->lastDrawable->type == DRAWABLE_WINDOW)
return ((WindowPtr) client->lastDrawable);
return (WindowPtr) NULL;
}
pWin = (WindowPtr)LookupIDByType(rid, RT_WINDOW);
if (pWin && pWin->drawable.type == DRAWABLE_WINDOW) {
client->lastDrawable = (DrawablePtr) pWin;
client->lastDrawableID = rid;
if (pTmp->type | M_DRAWABLE) {
client->lastDrawable = pTmp;
client->lastDrawableID = id;
client->lastGCID = INVALID;
client->lastGC = (GCPtr)NULL;
}
return pWin;
*pDraw = pTmp;
return Success;
}
pointer
LookupDrawable(XID rid, ClientPtr client)
_X_EXPORT int
dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
{
register DrawablePtr pDraw;
if(rid == INVALID)
return (pointer) NULL;
if (client->lastDrawableID == rid)
return ((pointer) client->lastDrawable);
pDraw = (DrawablePtr)LookupIDByClass(rid, RC_DRAWABLE);
if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW))
return (pointer)pDraw;
return (pointer)NULL;
int rc;
rc = dixLookupDrawable((DrawablePtr*)pWin, id, client, M_WINDOW, access);
return (rc == BadDrawable) ? BadWindow : rc;
}
#endif /* XACE */
_X_EXPORT int
dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access)
{
GCPtr pTmp = (GCPtr)SecurityLookupIDByType(client, id, RT_GC, access);
if (pTmp) {
*pGC = pTmp;
return Success;
}
client->errorValue = id;
*pGC = NULL;
return BadGC;
}
_X_EXPORT ClientPtr
LookupClient(XID rid, ClientPtr client)
_X_EXPORT int
dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
{
pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY,
SecurityReadAccess);
DixReadAccess);
int clientIndex = CLIENT_ID(rid);
client->errorValue = rid;
if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT))
{
return clients[clientIndex];
if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) {
*pClient = clients[clientIndex];
return Success;
}
return (ClientPtr)NULL;
*pClient = NULL;
return BadValue;
}
/*
* These are deprecated compatibility functions and will be removed soon!
* Please use the new dixLookup*() functions above.
*/
_X_EXPORT _X_DEPRECATED WindowPtr
SecurityLookupWindow(XID id, ClientPtr client, Mask access_mode)
{
WindowPtr pWin;
int i = dixLookupWindow(&pWin, id, client, access_mode);
static int warn = 1;
if (warn-- > 0)
ErrorF("Warning: LookupWindow()/SecurityLookupWindow() "
"are deprecated. Please convert your driver/module "
"to use dixLookupWindow().\n");
return (i == Success) ? pWin : NULL;
}
_X_EXPORT _X_DEPRECATED WindowPtr
LookupWindow(XID id, ClientPtr client)
{
return SecurityLookupWindow(id, client, DixUnknownAccess);
}
_X_EXPORT _X_DEPRECATED pointer
SecurityLookupDrawable(XID id, ClientPtr client, Mask access_mode)
{
DrawablePtr pDraw;
int i = dixLookupDrawable(&pDraw, id, client, M_DRAWABLE, access_mode);
static int warn = 1;
if (warn-- > 0)
ErrorF("Warning: LookupDrawable()/SecurityLookupDrawable() "
"are deprecated. Please convert your driver/module "
"to use dixLookupDrawable().\n");
return (i == Success) ? pDraw : NULL;
}
_X_EXPORT _X_DEPRECATED pointer
LookupDrawable(XID id, ClientPtr client)
{
return SecurityLookupDrawable(id, client, DixUnknownAccess);
}
_X_EXPORT _X_DEPRECATED ClientPtr
LookupClient(XID id, ClientPtr client)
{
ClientPtr pClient;
int i = dixLookupClient(&pClient, id, client, DixUnknownAccess);
static int warn = 1;
if (warn-- > 0)
ErrorF("Warning: LookupClient() is deprecated. Please convert your "
"driver/module to use dixLookupClient().\n");
return (i == Success) ? pClient : NULL;
}
/* end deprecated functions */
int
AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,

View File

@ -137,9 +137,7 @@ of the copyright holder.
extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
#endif
#ifdef XACE
#include "xace.h"
#endif
#ifdef XSERVER_DTRACE
#include <sys/types.h>
@ -2230,16 +2228,15 @@ static int
XineramaWarpPointer(ClientPtr client)
{
WindowPtr dest = NULL;
int x, y;
int x, y, rc;
REQUEST(xWarpPointerReq);
if (stuff->dstWid != None)
{
dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess);
if (!dest)
return BadWindow;
if (stuff->dstWid != None) {
rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
if (rc != Success)
return rc;
}
x = sprite.hotPhys.x;
y = sprite.hotPhys.y;
@ -2250,8 +2247,9 @@ XineramaWarpPointer(ClientPtr client)
XID winID = stuff->srcWid;
WindowPtr source;
source = SecurityLookupWindow(winID, client, SecurityReadAccess);
if (!source) return BadWindow;
rc = dixLookupWindow(&source, winID, client, DixReadAccess);
if (rc != Success)
return rc;
winX = source->drawable.x;
winY = source->drawable.y;
@ -2303,7 +2301,7 @@ int
ProcWarpPointer(ClientPtr client)
{
WindowPtr dest = NULL;
int x, y;
int x, y, rc;
ScreenPtr newScreen;
REQUEST(xWarpPointerReq);
@ -2315,11 +2313,10 @@ ProcWarpPointer(ClientPtr client)
return XineramaWarpPointer(client);
#endif
if (stuff->dstWid != None)
{
dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess);
if (!dest)
return BadWindow;
if (stuff->dstWid != None) {
rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
if (rc != Success)
return rc;
}
x = sprite.hotPhys.x;
y = sprite.hotPhys.y;
@ -2330,8 +2327,9 @@ ProcWarpPointer(ClientPtr client)
XID winID = stuff->srcWid;
WindowPtr source;
source = SecurityLookupWindow(winID, client, SecurityReadAccess);
if (!source) return BadWindow;
rc = dixLookupWindow(&source, winID, client, DixReadAccess);
if (rc != Success)
return rc;
winX = source->drawable.x;
winY = source->drawable.y;
@ -2463,10 +2461,8 @@ CheckPassiveGrabsOnWindow(
(grab->confineTo->realized &&
BorderSizeNotEmpty(grab->confineTo))))
{
#ifdef XACE
if (!XaceHook(XACE_DEVICE_ACCESS, wClient(pWin), device, FALSE))
return FALSE;
#endif
#ifdef XKB
if (!noXkbExtension) {
XE_KBPTR.state &= 0x1f00;
@ -2827,9 +2823,7 @@ drawable.id:0;
if (deactivateGrab)
(*keybd->DeactivateGrab)(keybd);
#ifdef XACE
XaceHook(XACE_KEY_AVAIL, xE, keybd, count);
#endif
}
#ifdef XKB
@ -3253,17 +3247,13 @@ EnterLeaveEvent(
if ((type == EnterNotify) && (mask & KeymapStateMask))
{
xKeymapEvent ke;
#ifdef XACE
ClientPtr client = grab ? rClient(grab)
: clients[CLIENT_ID(pWin->drawable.id)];
if (!XaceHook(XACE_DEVICE_ACCESS, client, keybd, FALSE))
{
bzero((char *)&ke.map[0], 31);
}
if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, FALSE))
memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31);
else
#endif
memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31);
bzero((char *)&ke.map[0], 31);
ke.type = KeymapNotify;
if (grab)
(void)TryClientEvents(rClient(grab), (xEvent *)&ke, 1, mask,
@ -3349,15 +3339,12 @@ FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr
((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask))
{
xKeymapEvent ke;
#ifdef XACE
ClientPtr client = clients[CLIENT_ID(pWin->drawable.id)];
if (!XaceHook(XACE_DEVICE_ACCESS, client, dev, FALSE))
{
bzero((char *)&ke.map[0], 31);
}
if (XaceHook(XACE_DEVICE_ACCESS, client, dev, FALSE))
memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31);
else
#endif
memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31);
bzero((char *)&ke.map[0], 31);
ke.type = KeymapNotify;
(void)DeliverEventsToWindow(pWin, (xEvent *)&ke, 1,
KeymapStateMask, NullGrab, 0);
@ -3545,8 +3532,8 @@ SetInputFocus(
Bool followOK)
{
register FocusClassPtr focus;
register WindowPtr focusWin;
int mode;
WindowPtr focusWin;
int mode, rc;
TimeStamp time;
UpdateCurrentTime();
@ -3563,14 +3550,12 @@ SetInputFocus(
focusWin = (WindowPtr)(long)focusID;
else if ((focusID == FollowKeyboard) && followOK)
focusWin = inputInfo.keyboard->focus->win;
else if (!(focusWin = SecurityLookupWindow(focusID, client,
SecurityReadAccess)))
return BadWindow;
else
{
else {
rc = dixLookupWindow(&focusWin, focusID, client, DixReadAccess);
if (rc != Success)
return rc;
/* It is a match error to try to set the input focus to an
unviewable window. */
if(!focusWin->realized)
return(BadMatch);
}
@ -3620,10 +3605,10 @@ ProcSetInputFocus(client)
REQUEST(xSetInputFocusReq);
REQUEST_SIZE_MATCH(xSetInputFocusReq);
#ifdef XACE
if (!XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE))
return Success;
#endif
return SetInputFocus(client, inputInfo.keyboard, stuff->focus,
stuff->revertTo, stuff->time, FALSE);
}
@ -3659,6 +3644,7 @@ ProcGrabPointer(ClientPtr client)
CursorPtr cursor, oldCursor;
REQUEST(xGrabPointerReq);
TimeStamp time;
int rc;
REQUEST_SIZE_MATCH(xGrabPointerReq);
UpdateCurrentTime();
@ -3684,24 +3670,24 @@ ProcGrabPointer(ClientPtr client)
client->errorValue = stuff->eventMask;
return BadValue;
}
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (rc != Success)
return rc;
if (stuff->confineTo == None)
confineTo = NullWindow;
else
{
confineTo = SecurityLookupWindow(stuff->confineTo, client,
SecurityReadAccess);
if (!confineTo)
return BadWindow;
rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
DixReadAccess);
if (rc != Success)
return rc;
}
if (stuff->cursor == None)
cursor = NullCursor;
else
{
cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
RT_CURSOR, SecurityReadAccess);
RT_CURSOR, DixReadAccess);
if (!cursor)
{
client->errorValue = stuff->cursor;
@ -3775,7 +3761,7 @@ ProcChangeActivePointerGrab(ClientPtr client)
else
{
newCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
RT_CURSOR, SecurityReadAccess);
RT_CURSOR, DixReadAccess);
if (!newCursor)
{
client->errorValue = stuff->cursor;
@ -3825,9 +3811,10 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
unsigned this_mode, unsigned other_mode, Window grabWindow,
unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status)
{
register WindowPtr pWin;
WindowPtr pWin;
register GrabPtr grab;
TimeStamp time;
int rc;
UpdateCurrentTime();
if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync))
@ -3845,9 +3832,9 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
client->errorValue = ownerEvents;
return BadValue;
}
pWin = SecurityLookupWindow(grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, grabWindow, client, DixReadAccess);
if (rc != Success)
return rc;
time = ClientTimeToServerTime(ctime);
grab = dev->grab;
if (grab && !SameClient(grab, client))
@ -3885,18 +3872,17 @@ ProcGrabKeyboard(ClientPtr client)
int result;
REQUEST_SIZE_MATCH(xGrabKeyboardReq);
#ifdef XACE
if (!XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE))
{
if (XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE))
result = GrabDevice(client, inputInfo.keyboard, stuff->keyboardMode,
stuff->pointerMode, stuff->grabWindow,
stuff->ownerEvents, stuff->time,
KeyPressMask | KeyReleaseMask, &rep.status);
else {
result = Success;
rep.status = AlreadyGrabbed;
}
else
#endif
result = GrabDevice(client, inputInfo.keyboard, stuff->keyboardMode,
stuff->pointerMode, stuff->grabWindow,
stuff->ownerEvents, stuff->time,
KeyPressMask | KeyReleaseMask, &rep.status);
if (result != Success)
return result;
rep.type = X_Reply;
@ -3932,11 +3918,12 @@ ProcQueryPointer(ClientPtr client)
WindowPtr pWin, t;
REQUEST(xResourceReq);
DeviceIntPtr mouse = inputInfo.pointer;
int rc;
REQUEST_SIZE_MATCH(xResourceReq);
pWin = SecurityLookupWindow(stuff->id, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
if (rc != Success)
return rc;
if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client);
rep.type = X_Reply;
@ -4100,8 +4087,8 @@ ProcSendEvent(ClientPtr client)
effectiveFocus = pWin = inputFocus;
}
else
pWin = SecurityLookupWindow(stuff->destination, client,
SecurityReadAccess);
dixLookupWindow(&pWin, stuff->destination, client, DixReadAccess);
if (!pWin)
return BadWindow;
if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue))
@ -4137,11 +4124,12 @@ ProcUngrabKey(ClientPtr client)
WindowPtr pWin;
GrabRec tempGrab;
DeviceIntPtr keybd = inputInfo.keyboard;
int rc;
REQUEST_SIZE_MATCH(xUngrabKeyReq);
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (rc != Success)
return rc;
if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) ||
(stuff->key < keybd->key->curKeySyms.minKeyCode))
@ -4178,6 +4166,7 @@ ProcGrabKey(ClientPtr client)
REQUEST(xGrabKeyReq);
GrabPtr grab;
DeviceIntPtr keybd = inputInfo.keyboard;
int rc;
REQUEST_SIZE_MATCH(xGrabKeyReq);
if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse))
@ -4210,9 +4199,9 @@ ProcGrabKey(ClientPtr client)
client->errorValue = stuff->modifiers;
return BadValue;
}
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (rc != Success)
return rc;
grab = CreateGrab(client->index, keybd, pWin,
(Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents,
@ -4232,6 +4221,7 @@ ProcGrabButton(ClientPtr client)
REQUEST(xGrabButtonReq);
CursorPtr cursor;
GrabPtr grab;
int rc;
REQUEST_SIZE_MATCH(xGrabButtonReq);
if ((stuff->pointerMode != GrabModeSync) &&
@ -4262,23 +4252,23 @@ ProcGrabButton(ClientPtr client)
client->errorValue = stuff->eventMask;
return BadValue;
}
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (rc != Success)
return rc;
if (stuff->confineTo == None)
confineTo = NullWindow;
else {
confineTo = SecurityLookupWindow(stuff->confineTo, client,
SecurityReadAccess);
if (!confineTo)
return BadWindow;
rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
DixReadAccess);
if (rc != Success)
return rc;
}
if (stuff->cursor == None)
cursor = NullCursor;
else
{
cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
RT_CURSOR, SecurityReadAccess);
RT_CURSOR, DixReadAccess);
if (!cursor)
{
client->errorValue = stuff->cursor;
@ -4303,6 +4293,7 @@ ProcUngrabButton(ClientPtr client)
REQUEST(xUngrabButtonReq);
WindowPtr pWin;
GrabRec tempGrab;
int rc;
REQUEST_SIZE_MATCH(xUngrabButtonReq);
if ((stuff->modifiers != AnyModifier) &&
@ -4311,9 +4302,9 @@ ProcUngrabButton(ClientPtr client)
client->errorValue = stuff->modifiers;
return BadValue;
}
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (rc != Success)
return rc;
tempGrab.resource = client->clientAsMask;
tempGrab.device = inputInfo.pointer;
tempGrab.window = pWin;
@ -4465,7 +4456,7 @@ ProcRecolorCursor(ClientPtr client)
REQUEST_SIZE_MATCH(xRecolorCursorReq);
pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
RT_CURSOR, SecurityWriteAccess);
RT_CURSOR, DixWriteAccess);
if ( !pCursor)
{
client->errorValue = stuff->cursor;

View File

@ -59,9 +59,7 @@ SOFTWARE.
#include "gcstruct.h"
#include "scrnintstr.h"
#include "dispatch.h"
#ifdef XACE
#include "xace.h"
#endif
#define EXTENSION_BASE 128
#define EXTENSION_EVENT_BASE 64
@ -256,11 +254,9 @@ GetExtensionEntry(int major)
_X_EXPORT void
DeclareExtensionSecurity(char *extname, Bool secure)
{
#ifdef XACE
int i = FindExtension(extname, strlen(extname));
if (i >= 0)
XaceHook(XACE_DECLARE_EXT_SECURE, extensions[i], secure);
#endif
}
_X_EXPORT unsigned short
@ -336,12 +332,7 @@ ProcQueryExtension(ClientPtr client)
else
{
i = FindExtension((char *)&stuff[1], stuff->nbytes);
if (i < 0
#ifdef XACE
/* call callbacks to find out whether to show extension */
|| !XaceHook(XACE_EXT_ACCESS, client, extensions[i])
#endif
)
if (i < 0 || !XaceHook(XACE_EXT_ACCESS, client, extensions[i]))
reply.present = xFalse;
else
{
@ -376,11 +367,10 @@ ProcListExtensions(ClientPtr client)
for (i=0; i<NumExtensions; i++)
{
#ifdef XACE
/* call callbacks to find out whether to show extension */
if (!XaceHook(XACE_EXT_ACCESS, client, extensions[i]))
continue;
#endif
total_length += strlen(extensions[i]->name) + 1;
reply.nExtensions += 1 + extensions[i]->num_aliases;
for (j = extensions[i]->num_aliases; --j >= 0;)
@ -393,10 +383,9 @@ ProcListExtensions(ClientPtr client)
for (i=0; i<NumExtensions; i++)
{
int len;
#ifdef XACE
if (!XaceHook(XACE_EXT_ACCESS, client, extensions[i]))
continue;
#endif
*bufptr++ = len = strlen(extensions[i]->name);
memmove(bufptr, extensions[i]->name, len);
bufptr += len;

View File

@ -271,7 +271,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC
{
NEXTVAL(XID, newpix);
pPixmap = (PixmapPtr)SecurityLookupIDByType(client,
newpix, RT_PIXMAP, SecurityReadAccess);
newpix, RT_PIXMAP, DixReadAccess);
}
if (pPixmap)
{
@ -307,7 +307,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC
{
NEXTVAL(XID, newstipple)
pPixmap = (PixmapPtr)SecurityLookupIDByType(client,
newstipple, RT_PIXMAP, SecurityReadAccess);
newstipple, RT_PIXMAP, DixReadAccess);
}
if (pPixmap)
{
@ -349,7 +349,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC
{
NEXTVAL(XID, newfont)
pFont = (FontPtr)SecurityLookupIDByType(client, newfont,
RT_FONT, SecurityReadAccess);
RT_FONT, DixReadAccess);
}
if (pFont)
{
@ -416,7 +416,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC
}
else
pPixmap = (PixmapPtr)SecurityLookupIDByType(client,
pid, RT_PIXMAP, SecurityReadAccess);
pid, RT_PIXMAP, DixReadAccess);
}
if (pPixmap)

View File

@ -39,6 +39,7 @@
#include "cursorstr.h"
#include "dixstruct.h"
#include "globals.h"
#include "dixevents.h"
#include "mipointer.h"
#ifdef XKB
@ -47,10 +48,6 @@
extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
#endif
#ifdef XACE
#include "xace.h"
#endif
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
@ -487,6 +484,8 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
int num_events = 0, final_valuator = 0;
CARD32 ms = 0;
deviceKeyButtonPointer *kbp = NULL;
/* Thanks to a broken lib, we _always_ have to chase DeviceMotionNotifies
* with DeviceValuators. */
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
DeviceIntPtr pointer = NULL;
int x = 0, y = 0;
@ -503,15 +502,16 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
else
num_events = 1;
if (type == MotionNotify && num_valuators <= 0) {
return 0;
}
/* Do we need to send a DeviceValuator event? */
if ((num_valuators + first_valuator) > 2 && sendValuators) {
if (sendValuators) {
if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
num_valuators = MAX_VALUATOR_EVENTS * 6;
num_events += ((num_valuators - 1) / 6) + 1;
}
else if (type == MotionNotify && num_valuators <= 0) {
return 0;
}
final_valuator = num_valuators + first_valuator;
@ -604,7 +604,7 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
kbp->root_y = y;
events++;
if (final_valuator > 2 && sendValuators) {
if (sendValuators) {
kbp->deviceid |= MORE_EVENTS;
clipValuators(pDev, first_valuator, num_valuators, valuators);
events = getValuatorEvents(events, pDev, first_valuator,
@ -748,7 +748,7 @@ SwitchCorePointer(DeviceIntPtr pDev)
* to shift the pointer to get it inside the new bounds.
*/
void
PostSyntheticMotion(int x, int y, int screenNum, unsigned long time)
PostSyntheticMotion(int x, int y, ScreenPtr pScreen, unsigned long time)
{
xEvent xE;
@ -757,8 +757,8 @@ PostSyntheticMotion(int x, int y, int screenNum, unsigned long time)
will translate from sprite screen to screen 0 upon reentry
to the DIX layer. */
if (!noPanoramiXExtension) {
x += panoramiXdataPtr[0].x - panoramiXdataPtr[screenNum].x;
y += panoramiXdataPtr[0].y - panoramiXdataPtr[screenNum].y;
x += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x;
y += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y;
}
#endif
@ -766,6 +766,7 @@ PostSyntheticMotion(int x, int y, int screenNum, unsigned long time)
xE.u.u.type = MotionNotify;
xE.u.keyButtonPointer.rootX = x;
xE.u.keyButtonPointer.rootY = y;
xE.u.keyButtonPointer.time = time;
(*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1);
}

View File

@ -98,7 +98,7 @@ Equipment Corporation.
#include <X11/fonts/font.h>
#include "opaque.h"
#include "servermd.h"
#include "config.h"
#include "hotplug.h"
#include "site.h"
#include "dixfont.h"
#include "extnsionst.h"
@ -309,9 +309,9 @@ main(int argc, char *argv[], char *envp[])
DPMSPowerLevel = 0;
#endif
InitBlockAndWakeupHandlers();
configInitialise();
/* Perform any operating system dependent initializations you'd like */
OsInit();
OsInit();
configInitialise();
if(serverGeneration == 1)
{
CreateWellKnownSockets();
@ -414,21 +414,24 @@ main(int argc, char *argv[], char *envp[])
ErrorF("failed to set default font path '%s'",
defaultFontPath);
}
if (!SetDefaultFont(defaultTextFont))
if (!SetDefaultFont(defaultTextFont)) {
FatalError("could not open default font '%s'", defaultTextFont);
}
#ifdef NULL_ROOT_CURSOR
cm.width = 0;
cm.height = 0;
cm.xhot = 0;
cm.yhot = 0;
if (!(rootCursor = AllocCursor(NULL, NULL, &cm, 0, 0, 0, 0, 0, 0)))
if (!(rootCursor = AllocCursor(NULL, NULL, &cm, 0, 0, 0, 0, 0, 0))) {
FatalError("could not create empty root cursor");
}
AddResource(FakeClientID(0), RT_CURSOR, (pointer)rootCursor);
#else
if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0)))
if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0))) {
FatalError("could not open default cursor font '%s'",
defaultCursorFont);
}
#endif
#ifdef DPMSExtension
/* check all screens, looking for DPMS Capabilities */
@ -452,13 +455,15 @@ main(int argc, char *argv[], char *envp[])
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
if (!PanoramiXCreateConnectionBlock())
if (!PanoramiXCreateConnectionBlock()) {
FatalError("could not create connection block info");
}
} else
#endif
{
if (!CreateConnectionBlock())
if (!CreateConnectionBlock()) {
FatalError("could not create connection block info");
}
}
Dispatch();

View File

@ -58,9 +58,7 @@ SOFTWARE.
#include "dixstruct.h"
#include "dispatch.h"
#include "swaprep.h"
#ifdef XACE
#include "xace.h"
#endif
/*****************************************************************
* Property Stuff
@ -96,7 +94,7 @@ PrintPropertys(WindowPtr pWin)
int
ProcRotateProperties(ClientPtr client)
{
int i, j, delta;
int i, j, delta, rc;
REQUEST(xRotatePropertiesReq);
WindowPtr pWin;
register Atom * atoms;
@ -106,10 +104,9 @@ ProcRotateProperties(ClientPtr client)
REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
UpdateCurrentTime();
pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client,
SecurityWriteAccess);
if (!pWin)
return(BadWindow);
rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (rc != Success)
return rc;
if (!stuff->nAtoms)
return(Success);
atoms = (Atom *) & stuff[1];
@ -118,27 +115,19 @@ ProcRotateProperties(ClientPtr client)
return(BadAlloc);
for (i = 0; i < stuff->nAtoms; i++)
{
#ifdef XACE
char action = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, atoms[i],
SecurityReadAccess|SecurityWriteAccess);
#endif
if (!ValidAtom(atoms[i])
#ifdef XACE
|| (SecurityErrorOperation == action)
#endif
)
{
DixReadAccess|DixWriteAccess);
if (!ValidAtom(atoms[i]) || (XaceErrorOperation == action)) {
DEALLOCATE_LOCAL(props);
client->errorValue = atoms[i];
return BadAtom;
}
#ifdef XACE
if (SecurityIgnoreOperation == action)
{
if (XaceIgnoreOperation == action) {
DEALLOCATE_LOCAL(props);
return Success;
}
#endif
for (j = i + 1; j < stuff->nAtoms; j++)
if (atoms[j] == atoms[i])
{
@ -191,9 +180,7 @@ ProcChangeProperty(ClientPtr client)
WindowPtr pWin;
char format, mode;
unsigned long len;
int sizeInBytes;
int totalSize;
int err;
int sizeInBytes, totalSize, err;
REQUEST(xChangePropertyReq);
REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
@ -218,10 +205,9 @@ ProcChangeProperty(ClientPtr client)
totalSize = len * sizeInBytes;
REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
SecurityWriteAccess);
if (!pWin)
return(BadWindow);
err = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (err != Success)
return err;
if (!ValidAtom(stuff->property))
{
client->errorValue = stuff->property;
@ -233,17 +219,15 @@ ProcChangeProperty(ClientPtr client)
return(BadAtom);
}
#ifdef XACE
switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
SecurityWriteAccess))
DixWriteAccess))
{
case SecurityErrorOperation:
client->errorValue = stuff->property;
return BadAtom;
case SecurityIgnoreOperation:
return Success;
case XaceErrorOperation:
client->errorValue = stuff->property;
return BadAtom;
case XaceIgnoreOperation:
return Success;
}
#endif
err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format,
(int)mode, len, (pointer)&stuff[1], TRUE);
@ -457,18 +441,18 @@ int
ProcGetProperty(ClientPtr client)
{
PropertyPtr pProp, prevProp;
unsigned long n, len, ind;
unsigned long n, len, ind, rc;
WindowPtr pWin;
xGetPropertyReply reply;
Mask access_mode = DixReadAccess;
REQUEST(xGetPropertyReq);
REQUEST_SIZE_MATCH(xGetPropertyReq);
if (stuff->delete)
UpdateCurrentTime();
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
SecurityReadAccess);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
if (rc != Success)
return rc;
if (!ValidAtom(stuff->property))
{
@ -501,24 +485,18 @@ ProcGetProperty(ClientPtr client)
if (!pProp)
return NullPropertyReply(client, None, 0, &reply);
#ifdef XACE
if (stuff->delete)
access_mode |= DixDestroyAccess;
switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
access_mode))
{
Mask access_mode = SecurityReadAccess;
if (stuff->delete)
access_mode |= SecurityDestroyAccess;
switch(XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
access_mode))
{
case SecurityErrorOperation:
client->errorValue = stuff->property;
return BadAtom;;
case SecurityIgnoreOperation:
return NullPropertyReply(client, pProp->type, pProp->format,
&reply);
}
case XaceErrorOperation:
client->errorValue = stuff->property;
return BadAtom;;
case XaceIgnoreOperation:
return NullPropertyReply(client, pProp->type, pProp->format, &reply);
}
#endif
/* If the request type and actual type don't match. Return the
property information, but not the data. */
@ -602,16 +580,15 @@ ProcListProperties(ClientPtr client)
{
Atom *pAtoms = NULL, *temppAtoms;
xListPropertiesReply xlpr;
int numProps = 0;
int rc, numProps = 0;
WindowPtr pWin;
PropertyPtr pProp;
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
SecurityReadAccess);
if (!pWin)
return(BadWindow);
rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
if (rc != Success)
return rc;
pProp = wUserProps (pWin);
while (pProp)
@ -653,27 +630,24 @@ ProcDeleteProperty(register ClientPtr client)
REQUEST_SIZE_MATCH(xDeletePropertyReq);
UpdateCurrentTime();
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
SecurityWriteAccess);
if (!pWin)
return(BadWindow);
result = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (result != Success)
return result;
if (!ValidAtom(stuff->property))
{
client->errorValue = stuff->property;
return (BadAtom);
}
#ifdef XACE
switch(XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
SecurityDestroyAccess))
switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
DixDestroyAccess))
{
case SecurityErrorOperation:
client->errorValue = stuff->property;
return BadAtom;;
case SecurityIgnoreOperation:
return Success;
case XaceErrorOperation:
client->errorValue = stuff->property;
return BadAtom;;
case XaceIgnoreOperation:
return Success;
}
#endif
result = DeleteProperty(pWin, stuff->property);
if (client->noClientException != Success)

View File

@ -148,9 +148,7 @@ Equipment Corporation.
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
#ifdef XACE
#include "xace.h"
#endif
#include <assert.h>
#ifdef XSERVER_DTRACE
@ -904,11 +902,10 @@ SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype, Mask mode)
break;
}
}
#ifdef XACE
if (retval && client &&
!XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, mode, retval))
retval = NULL;
#endif
return retval;
}
@ -932,11 +929,10 @@ SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes, Mask mode)
break;
}
}
#ifdef XACE
if (retval && client &&
!XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, mode, retval))
retval = NULL;
#endif
return retval;
}
@ -948,12 +944,12 @@ _X_EXPORT pointer
LookupIDByType(XID id, RESTYPE rtype)
{
return SecurityLookupIDByType(NullClient, id, rtype,
SecurityUnknownAccess);
DixUnknownAccess);
}
_X_EXPORT pointer
LookupIDByClass(XID id, RESTYPE classes)
{
return SecurityLookupIDByClass(NullClient, id, classes,
SecurityUnknownAccess);
DixUnknownAccess);
}

View File

@ -126,9 +126,7 @@ Equipment Corporation.
#ifdef XAPPGROUP
#include "appgroup.h"
#endif
#ifdef XACE
#include "xace.h"
#endif
/******
* Window stuff for server
@ -531,9 +529,7 @@ InitRootWindow(WindowPtr pWin)
/* We SHOULD check for an error value here XXX */
(*pScreen->ChangeWindowAttributes)(pWin, backFlag);
#ifdef XACE
XaceHook(XACE_WINDOW_INIT, serverClient, pWin);
#endif
MapWindow(pWin, serverClient);
}
@ -738,18 +734,16 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w,
}
pWin->borderWidth = bw;
#ifdef XACE
/* can't let untrusted clients have background None windows;
* they make it too easy to steal window contents
*/
if (!XaceHook(XACE_BACKGRND_ACCESS, client, pWin))
{
if (XaceHook(XACE_BACKGRND_ACCESS, client, pWin))
pWin->backgroundState = None;
else {
pWin->backgroundState = BackgroundPixel;
pWin->background.pixel = 0;
}
else
#endif
pWin->backgroundState = None;
pWin->borderIsPixel = pParent->borderIsPixel;
pWin->border = pParent->border;
@ -769,9 +763,7 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w,
REGION_NULL(pScreen, &pWin->winSize);
REGION_NULL(pScreen, &pWin->borderSize);
#ifdef XACE
XaceHook(XACE_WINDOW_INIT, client, pWin);
#endif
pHead = RealChildHead(pParent);
if (pHead)
@ -1036,24 +1028,18 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
borderRelative = TRUE;
if (pixID == None)
{
#ifdef XACE
/* can't let untrusted clients have background None windows */
if (XaceHook(XACE_BACKGRND_ACCESS, client, pWin))
{
#endif
if (pWin->backgroundState == BackgroundPixmap)
(*pScreen->DestroyPixmap)(pWin->background.pixmap);
if (!pWin->parent)
MakeRootTile(pWin);
else
pWin->backgroundState = None;
#ifdef XACE
}
else
{ /* didn't change the background to None, so don't tell ddx */
if (XaceHook(XACE_BACKGRND_ACCESS, client, pWin)) {
if (pWin->backgroundState == BackgroundPixmap)
(*pScreen->DestroyPixmap)(pWin->background.pixmap);
if (!pWin->parent)
MakeRootTile(pWin);
else
pWin->backgroundState = None;
} else {
/* didn't change the backgrnd to None, so don't tell ddx */
index2 = 0;
}
#endif
}
else if (pixID == ParentRelative)
{
@ -1076,7 +1062,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
else
{
pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID,
RT_PIXMAP, SecurityReadAccess);
RT_PIXMAP, DixReadAccess);
if (pPixmap != (PixmapPtr) NULL)
{
if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
@ -1137,7 +1123,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
else
{
pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID,
RT_PIXMAP, SecurityReadAccess);
RT_PIXMAP, DixReadAccess);
if (pPixmap)
{
if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
@ -1347,7 +1333,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
goto PatchUp;
}
pCmap = (ColormapPtr)SecurityLookupIDByType(client, cmap,
RT_COLORMAP, SecurityReadAccess);
RT_COLORMAP, DixReadAccess);
if (!pCmap)
{
error = BadColor;
@ -1423,7 +1409,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
else
{
pCursor = (CursorPtr)SecurityLookupIDByType(client, cursorID,
RT_CURSOR, SecurityReadAccess);
RT_CURSOR, DixReadAccess);
if (!pCursor)
{
error = BadCursor;
@ -2313,7 +2299,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP
sibwid = (Window ) *pVlist;
pVlist++;
pSib = (WindowPtr )SecurityLookupIDByType(client, sibwid,
RT_WINDOW, SecurityReadAccess);
RT_WINDOW, DixReadAccess);
if (!pSib)
{
client->errorValue = sibwid;
@ -2739,11 +2725,9 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
if (pWin->mapped)
return(Success);
#ifdef XACE
/* general check for permission to map window */
if (!XaceHook(XACE_MAP_ACCESS, client, pWin))
return Success;
#endif
pScreen = pWin->drawable.pScreen;
if ( (pParent = pWin->parent) )

View File

@ -159,6 +159,14 @@ default state is platform and configuration specific.
disables DPMS (display power management services). The default state
is platform and configuration specific.
.TP 8
.BI \-extension extensionName
disables named extension. If an unknown extension name is specified,
a list of accepted extension names is printed.
.TP 8
.BI \+extension extensionName
enables named extension. If an unknown extension name is specified,
a list of accepted extension names is printed.
.TP 8
.B \-f \fIvolume\fP
sets feep (bell) volume (allowable range: 0-100).
.TP 8

View File

@ -1341,6 +1341,9 @@ fbCreateDefColormap(ScreenPtr pScreen);
void
fbClearVisualTypes(void);
Bool
fbHasVisualTypes (int depth);
Bool
fbSetVisualTypes (int depth, int visuals, int bitsPerRGB);

View File

@ -268,7 +268,7 @@ ProcAppleWMSelectInput (client)
REQUEST_SIZE_MATCH (xAppleWMSelectInputReq);
pHead = (WMEventPtr *)SecurityLookupIDByType(client,
eventResource, EventType, SecurityWriteAccess);
eventResource, EventType, DixWriteAccess);
if (stuff->mask != 0) {
if (pHead) {
/* check for existing entry. */
@ -490,11 +490,9 @@ ProcAppleWMSetWindowLevel(
REQUEST_SIZE_MATCH(xAppleWMSetWindowLevelReq);
if (!(pWin = SecurityLookupWindow((Drawable)stuff->window,
client, SecurityReadAccess)))
{
if (Success != dixLookupWindow(&pWin, stuff->window, client,
DixReadAccess))
return BadValue;
}
if (stuff->level < 0 || stuff->level >= AppleWMNumWindowLevels) {
return BadValue;
@ -602,11 +600,9 @@ ProcAppleWMFrameDraw(
REQUEST_AT_LEAST_SIZE(xAppleWMFrameDrawReq);
if (!(pWin = SecurityLookupWindow((Drawable)stuff->window,
client, SecurityReadAccess)))
{
if (Success != dixLookupWindow(&pWin, stuff->window, client,
DixReadAccess))
return BadValue;
}
ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih);
or = make_box (stuff->ox, stuff->oy, stuff->ow, stuff->oh);

View File

@ -170,12 +170,13 @@ static int ProcPseudoramiXGetState(ClientPtr client)
REQUEST(xPanoramiXGetStateReq);
WindowPtr pWin;
xPanoramiXGetStateReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -196,12 +197,13 @@ static int ProcPseudoramiXGetScreenCount(ClientPtr client)
REQUEST(xPanoramiXGetScreenCountReq);
WindowPtr pWin;
xPanoramiXGetScreenCountReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -222,12 +224,13 @@ static int ProcPseudoramiXGetScreenSize(ClientPtr client)
REQUEST(xPanoramiXGetScreenSizeReq);
WindowPtr pWin;
xPanoramiXGetScreenSizeReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;

View File

@ -213,6 +213,7 @@ ProcAppleDRICreateSurface(
DrawablePtr pDrawable;
xp_surface_id sid;
unsigned int key[2];
int rc;
REQUEST(xAppleDRICreateSurfaceReq);
REQUEST_SIZE_MATCH(xAppleDRICreateSurfaceReq);
@ -220,12 +221,10 @@ ProcAppleDRICreateSurface(
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable(
(Drawable)stuff->drawable,
client,
SecurityReadAccess))) {
return BadValue;
}
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success)
return rc;
rep.key_0 = rep.key_1 = rep.uid = 0;
@ -252,13 +251,12 @@ ProcAppleDRIDestroySurface(
REQUEST(xAppleDRIDestroySurfaceReq);
DrawablePtr pDrawable;
REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq);
int rc;
if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable(
(Drawable)stuff->drawable,
client,
SecurityReadAccess))) {
return BadValue;
}
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success)
return rc;
if (!DRIDestroySurface( screenInfo.screens[stuff->screen],
(Drawable)stuff->drawable,

View File

@ -27,7 +27,7 @@ endif
AM_YFLAGS = -d
AM_CFLAGS = \
\
$(DIX_CFLAGS) \
-I$(top_srcdir)/hw/dmx \
$(GLX_INCS) \
-DHAVE_DMX_CONFIG_H \

View File

@ -282,12 +282,12 @@ static int ProcDMXForceWindowCreation(ClientPtr client)
int i;
if (!(win = SecurityLookupIDByType(client, stuff->window, XRT_WINDOW,
SecurityReadAccess)))
DixReadAccess)))
return -1; /* BadWindow */
FOR_NSCREENS(i) {
if (!(pWin = SecurityLookupWindow(win->info[i].id, client,
SecurityReadAccess)))
if (Success != dixLookupWindow(&pWin, win->info[i].id, client,
DixReadAccess))
return -1; /* BadWindow */
dmxForceWindowCreation(pWin);
@ -296,8 +296,8 @@ static int ProcDMXForceWindowCreation(ClientPtr client)
}
#endif
if (!(pWin = SecurityLookupWindow(stuff->window, client,
SecurityReadAccess)))
if (Success != dixLookupWindow(&pWin, stuff->window, client,
DixReadAccess))
return -1; /* BadWindow */
dmxForceWindowCreation(pWin);
@ -556,12 +556,12 @@ static int dmxPopulatePanoramiX(ClientPtr client, Window window,
DMXWindowAttributesRec attr;
if (!(win = SecurityLookupIDByType(client, window, XRT_WINDOW,
SecurityReadAccess)))
DixReadAccess)))
return -1; /* BadWindow */
FOR_NSCREENS(i) {
if (!(pWin = SecurityLookupWindow(win->info[i].id, client,
SecurityReadAccess)))
if (Success != dixLookupWindow(&pWin, win->info[i].id, client,
DixReadAccess))
return -1; /* BadWindow */
if (dmxGetWindowAttributes(pWin, &attr)) {
screens[count] = attr.screen;
@ -587,7 +587,7 @@ static int dmxPopulate(ClientPtr client, Window window, CARD32 *screens,
pos, vis);
#endif
if (!(pWin = SecurityLookupWindow(window, client, SecurityReadAccess)))
if (Success != dixLookupWindow(&pWin, window, client, DixReadAccess))
return -1; /* BadWindow */
dmxGetWindowAttributes(pWin, &attr);

View File

@ -1056,6 +1056,116 @@ static Bool dmxCompareScreens(DMXScreenInfo *new, DMXScreenInfo *old)
return TRUE;
}
#ifdef RENDER
/** Restore Render's picture */
static void dmxBERestoreRenderPict(pointer value, XID id, pointer n)
{
PicturePtr pPicture = value; /* The picture */
DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */
int scrnNum = (int)n;
if (pDraw->pScreen->myNum != scrnNum) {
/* Picture not on the screen we are restoring*/
return;
}
if (pDraw->type == DRAWABLE_PIXMAP) {
PixmapPtr pPixmap = (PixmapPtr)pDraw;
/* Create and restore the pixmap drawable */
dmxBECreatePixmap(pPixmap);
dmxBERestorePixmap(pPixmap);
}
dmxBECreatePicture(pPicture);
}
/** Restore Render's glyphs */
static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
{
GlyphSetPtr glyphSet = value;
int scrnNum = (int)n;
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum];
GlyphRefPtr table;
char *images;
Glyph *gids;
XGlyphInfo *glyphs;
char *pos;
int beret;
int len_images = 0;
int i;
int ctr;
if (glyphPriv->glyphSets[scrnNum]) {
/* Only restore glyphs on the screen we are attaching */
return;
}
/* First we must create the glyph set on the backend. */
if ((beret = dmxBECreateGlyphSet(scrnNum, glyphSet)) != Success) {
dmxLog(dmxWarning,
"\tdmxBERestoreRenderGlyph failed to create glyphset!\n");
return;
}
/* Now for the complex part, restore the glyph data */
table = glyphSet->hash.table;
/* We need to know how much memory to allocate for this part */
for (i = 0; i < glyphSet->hash.hashSet->size; i++) {
GlyphRefPtr gr = &table[i];
GlyphPtr gl = gr->glyph;
if (!gl || gl == DeletedGlyph) continue;
len_images += gl->size - sizeof(gl->info);
}
/* Now allocate the memory we need */
images = ALLOCATE_LOCAL(len_images*sizeof(char));
gids = ALLOCATE_LOCAL(glyphSet->hash.tableEntries*sizeof(Glyph));
glyphs = ALLOCATE_LOCAL(glyphSet->hash.tableEntries*sizeof(XGlyphInfo));
memset(images, 0, len_images * sizeof(char));
pos = images;
ctr = 0;
/* Fill the allocated memory with the proper data */
for (i = 0; i < glyphSet->hash.hashSet->size; i++) {
GlyphRefPtr gr = &table[i];
GlyphPtr gl = gr->glyph;
if (!gl || gl == DeletedGlyph) continue;
/* First lets put the data into gids */
gids[ctr] = gr->signature;
/* Next do the glyphs data structures */
glyphs[ctr].width = gl->info.width;
glyphs[ctr].height = gl->info.height;
glyphs[ctr].x = gl->info.x;
glyphs[ctr].y = gl->info.y;
glyphs[ctr].xOff = gl->info.xOff;
glyphs[ctr].yOff = gl->info.yOff;
/* Copy the images from the DIX's data into the buffer */
memcpy(pos, gl+1, gl->size - sizeof(gl->info));
pos += gl->size - sizeof(gl->info);
ctr++;
}
/* Now restore the glyph data */
XRenderAddGlyphs(dmxScreen->beDisplay, glyphPriv->glyphSets[scrnNum],
gids,glyphs, glyphSet->hash.tableEntries, images,
len_images);
/* Clean up */
DEALLOCATE_LOCAL(len_images);
DEALLOCATE_LOCAL(gids);
DEALLOCATE_LOCAL(glyphs);
}
#endif
/** Reattach previously detached back-end screen. */
int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
{
@ -1174,6 +1284,20 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
/* Create window hierarchy (top down) */
dmxBECreateWindowTree(idx);
#ifdef RENDER
/* Restore the picture state for RENDER */
for (i = currentMaxClients; --i >= 0; )
if (clients[i])
FindClientResourcesByType(clients[i],PictureType,
dmxBERestoreRenderPict,(pointer)idx);
/* Restore the glyph state for RENDER */
for (i = currentMaxClients; --i >= 0; )
if (clients[i])
FindClientResourcesByType(clients[i],GlyphSetType,
dmxBERestoreRenderGlyph,(pointer)idx);
#endif
/* Refresh screen by generating exposure events for all windows */
dmxForceExposures(idx);
@ -1362,8 +1486,15 @@ static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type,
#ifdef RENDER
} else if ((type & TypeMask) == (PictureType & TypeMask)) {
PicturePtr pPict = value;
if (pPict->pDrawable->pScreen->myNum == scrnNum)
if (pPict->pDrawable->pScreen->myNum == scrnNum) {
/* Free the pixmaps on the backend if needed */
if (pPict->pDrawable->type == DRAWABLE_PIXMAP) {
PixmapPtr pPixmap = (PixmapPtr)(pPict->pDrawable);
dmxBESavePixmap(pPixmap);
dmxBEFreePixmap(pPixmap);
}
dmxBEFreePicture((PicturePtr)value);
}
} else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value);
#endif

View File

@ -624,7 +624,7 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
}
/* Make sure that the command-line arguments are sane. */
if (dmxAddRemoveScreens && (!noRenderExtension || dmxGLXProxy)) {
if (dmxAddRemoveScreens && dmxGLXProxy) {
/* Currently it is not possible to support GLX and Render
* extensions with dynamic screen addition/removal due to the
* state that each extension keeps, which cannot be restored. */

View File

@ -223,6 +223,36 @@ Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet)
return FALSE;
}
/** Create \a glyphSet on the backend screen number \a idx. */
int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet)
{
XRenderPictFormat *pFormat;
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
PictFormatPtr pFmt = glyphSet->format;
int (*oldErrorHandler)(Display *, XErrorEvent *);
pFormat = dmxFindFormat(dmxScreen, pFmt);
if (!pFormat) {
return BadMatch;
}
dmxGlyphLastError = 0;
oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler);
/* Catch when this fails */
glyphPriv->glyphSets[idx]
= XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat);
XSetErrorHandler(oldErrorHandler);
if (dmxGlyphLastError) {
return dmxGlyphLastError;
}
return Success;
}
/** Create a Glyph Set on each screen. Save the glyphset ID from each
* screen in the Glyph Set's private structure. Fail if the format
* requested is not available or if the Glyph Set cannot be created on
@ -235,40 +265,32 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client)
ret = dmxSaveRenderVector[stuff->renderReqType](client);
if (ret == Success) {
int (*oldErrorHandler)(Display *, XErrorEvent *);
GlyphSetPtr glyphSet;
dmxGlyphPrivPtr glyphPriv;
int i;
PictFormatPtr pFmt;
XRenderPictFormat *pFormat;
/* Look up glyphSet that was just created ???? */
/* Store glyphsets from backends in glyphSet->devPrivate ????? */
/* Make sure we handle all errors here!! */
glyphSet = SecurityLookupIDByType(client, stuff->gsid, GlyphSetType,
SecurityDestroyAccess);
DixDestroyAccess);
glyphPriv = xalloc(sizeof(dmxGlyphPrivRec));
if (!glyphPriv) return BadAlloc;
glyphPriv->glyphSets = NULL;
MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc);
DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv);
pFmt = SecurityLookupIDByType(client, stuff->format, PictFormatType,
SecurityReadAccess);
oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler);
for (i = 0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i];
int beret;
if (!dmxScreen->beDisplay) {
glyphPriv->glyphSets[i] = 0;
continue;
}
pFormat = dmxFindFormat(dmxScreen, pFmt);
if (!pFormat) {
if ((beret = dmxBECreateGlyphSet(i, glyphSet)) != Success) {
int j;
/* Free the glyph sets we've allocated thus far */
@ -278,30 +300,9 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client)
/* Free the resource created by render */
FreeResource(stuff->gsid, RT_NONE);
ret = BadMatch;
break;
}
/* Catch when this fails */
glyphPriv->glyphSets[i]
= XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat);
if (dmxGlyphLastError) {
int j;
/* Free the glyph sets we've allocated thus far */
for (j = 0; j < i; j++)
dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet);
/* Free the resource created by render */
FreeResource(stuff->gsid, RT_NONE);
ret = dmxGlyphLastError;
break;
return beret;
}
}
XSetErrorHandler(oldErrorHandler);
}
return ret;
@ -315,7 +316,7 @@ static int dmxProcRenderFreeGlyphSet(ClientPtr client)
REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType,
SecurityDestroyAccess);
DixDestroyAccess);
if (glyphSet && glyphSet->refcnt == 1) {
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
@ -358,7 +359,7 @@ static int dmxProcRenderAddGlyphs(ClientPtr client)
int nbytes;
glyphSet = SecurityLookupIDByType(client, stuff->glyphset,
GlyphSetType, SecurityReadAccess);
GlyphSetType, DixReadAccess);
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
nglyphs = stuff->nglyphs;
@ -401,7 +402,7 @@ static int dmxProcRenderFreeGlyphs(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType,
SecurityWriteAccess);
DixWriteAccess);
if (glyphSet) {
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
@ -473,13 +474,13 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
dmxGlyphPrivPtr glyphPriv;
pSrc = SecurityLookupIDByType(client, stuff->src, PictureType,
SecurityReadAccess);
DixReadAccess);
pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
if (!pSrcPriv->pict)
return ret;
pDst = SecurityLookupIDByType(client, stuff->dst, PictureType,
SecurityWriteAccess);
DixWriteAccess);
pDstPriv = DMX_GET_PICT_PRIV(pDst);
if (!pDstPriv->pict)
return ret;
@ -496,7 +497,7 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
if (stuff->maskFormat)
pFmt = SecurityLookupIDByType(client, stuff->maskFormat,
PictFormatType, SecurityReadAccess);
PictFormatType, DixReadAccess);
else
pFmt = NULL;
@ -547,7 +548,7 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
curElt = elts;
glyphSet = SecurityLookupIDByType(client, stuff->glyphset,
GlyphSetType, SecurityReadAccess);
GlyphSetType, DixReadAccess);
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
while (buffer + sizeof(xGlyphElt) < end) {
@ -558,7 +559,7 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
glyphSet = SecurityLookupIDByType(client,
*((CARD32 *)buffer),
GlyphSetType,
SecurityReadAccess);
DixReadAccess);
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
buffer += 4;
} else {
@ -622,7 +623,7 @@ static int dmxProcRenderSetPictureTransform(ClientPtr client)
REQUEST(xRenderSetPictureTransformReq);
REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
VERIFY_PICTURE(pPicture, stuff->picture, client, SecurityWriteAccess,
VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess,
RenderErrBase + BadPicture);
/* For the following to work with PanoramiX, it assumes that Render
@ -663,7 +664,7 @@ static int dmxProcRenderSetPictureFilter(ClientPtr client)
REQUEST(xRenderSetPictureFilterReq);
REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
VERIFY_PICTURE(pPicture, stuff->picture, client, SecurityWriteAccess,
VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess,
RenderErrBase + BadPicture);
/* For the following to work with PanoramiX, it assumes that Render
@ -753,6 +754,20 @@ void dmxCreatePictureList(WindowPtr pWindow)
}
}
/** Create \a pPicture on the backend. */
int dmxBECreatePicture(PicturePtr pPicture)
{
dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
/* Create picutre on BE */
pPictPriv->pict = dmxDoCreatePicture(pPicture);
/* Flush changes to the backend server */
dmxValidatePicture(pPicture, (1 << (CPLastBit+1)) - 1);
return Success;
}
/** Create a picture. This function handles the CreatePicture
* unwrapping/wrapping and calls dmxDoCreatePicture to actually create
* the picture on the appropriate screen. */
@ -853,7 +868,11 @@ int dmxChangePictureClip(PicturePtr pPicture, int clipType,
/* The clip has already been changed into a region by the mi
* routine called above.
*/
if (pPicture->clientClip) {
if (clipType == CT_NONE) {
/* Disable clipping, show all */
XFixesSetPictureClipRegion(dmxScreen->beDisplay,
pPictPriv->pict, 0, 0, None);
} else if (pPicture->clientClip) {
RegionPtr pClip = pPicture->clientClip;
BoxPtr pBox = REGION_RECTS(pClip);
int nBox = REGION_NUM_RECTS(pClip);

View File

@ -112,7 +112,9 @@ extern void dmxTriFan(CARD8 op,
INT16 xSrc, INT16 ySrc,
int npoint, xPointFixed *points);
extern int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet);
extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet);
extern int dmxBECreatePicture(PicturePtr pPicture);
extern Bool dmxBEFreePicture(PicturePtr pPicture);
extern int dmxPictPrivateIndex; /**< Index for picture private data */

View File

@ -32,7 +32,7 @@ libglxproxy_a_SOURCES = compsize.c \
unpack.h
AM_CFLAGS = \
\
$(DIX_CFLAGS) \
-I$(top_srcdir)/hw/dmx \
-I$(top_srcdir)/include \
-I$(top_srcdir)/GL/include \

View File

@ -430,9 +430,10 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
DrawablePtr pDraw;
__GLXpixmap *pGlxPixmap = NULL;
__glXWindow *pGlxWindow = NULL;
int rc;
pDraw = (DrawablePtr) LookupDrawable(req->drawable, client);
if (!pDraw) {
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess);
if (rc != Success) {
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
__glXPixmapRes);
if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
@ -459,9 +460,10 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
DrawablePtr pDraw, pMember = NULL;
__GLXpixmap *pGlxPixmap = NULL;
__glXWindow *pGlxWindow = NULL;
int rc;
pDraw = (DrawablePtr) LookupDrawable(req->drawable, client);
if (!pDraw) {
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess);
if (rc != Success) {
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
__glXPixmapRes);
if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
@ -479,8 +481,9 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
}
if (req->member != None) {
pMember = (DrawablePtr) LookupDrawable(req->member, client);
if (!pMember) {
rc = dixLookupDrawable(&pMember, req->member, client, 0,
DixUnknownAccess);
if (rc != Success) {
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member,
__glXPixmapRes);
if (pGlxPixmap) pMember = pGlxPixmap->pDraw;
@ -734,7 +737,7 @@ static int MakeCurrent(__GLXclientState *cl,
#endif
int from_screen = 0;
int to_screen = 0;
int s;
int s, rc;
/*
** If one is None and the other isn't, it's a bad match.
@ -778,8 +781,8 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (drawId != None) {
pDraw = (DrawablePtr) LookupDrawable(drawId, client);
if (pDraw) {
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) {
/*
** Drawable is an X Window.
@ -885,8 +888,8 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (readId != None && readId != drawId ) {
pReadDraw = (DrawablePtr) LookupDrawable(readId, client);
if (pReadDraw) {
rc = dixLookupDrawable(&pReadDraw, readId, client, 0,DixUnknownAccess);
if (rc == Success) {
if (pReadDraw->type == DRAWABLE_WINDOW) {
/*
** Drawable is an X Window.
@ -1105,13 +1108,13 @@ static int MakeCurrent(__GLXclientState *cl,
if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) {
pXinDraw = (PanoramiXRes *)
SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, SecurityReadAccess);
SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
}
if (pReadDraw && pReadDraw != pDraw &&
new_reply.readType != GLX_PBUFFER_TYPE) {
pXinReadDraw = (PanoramiXRes *)
SecurityLookupIDByClass(client, pReadDraw->id, XRC_DRAWABLE, SecurityReadAccess);
SecurityLookupIDByClass(client, pReadDraw->id, XRC_DRAWABLE, DixReadAccess);
}
else {
pXinReadDraw = pXinDraw;
@ -1137,9 +1140,7 @@ static int MakeCurrent(__GLXclientState *cl,
}
#ifdef PANORAMIX
else if (pXinDraw) {
pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[s].id,
client,
SecurityReadAccess);
dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
}
#endif
else if (pGlxWindow) {
@ -1195,9 +1196,8 @@ static int MakeCurrent(__GLXclientState *cl,
}
#ifdef PANORAMIX
else if (pXinReadDraw) {
pReadWin = (WindowPtr)SecurityLookupWindow(pXinReadDraw->info[s].id,
client,
SecurityReadAccess);
dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client,
DixReadAccess);
}
#endif
else if (pGlxReadWindow) {
@ -1639,18 +1639,16 @@ static int CreateGLXPixmap(__GLXclientState *cl,
__GLXscreenInfo *pGlxScreen;
__GLXvisualConfig *pGlxVisual;
__GLXFBConfig *pFBConfig;
int i;
int s;
int i, s, rc;
int from_screen, to_screen;
#ifdef PANORAMIX
PanoramiXRes *pXinDraw = NULL;
#endif
pDraw = (DrawablePtr) LookupDrawable(pixmapId, client);
if (!pDraw || pDraw->type != DRAWABLE_PIXMAP) {
client->errorValue = pixmapId;
return BadPixmap;
}
rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP,
DixUnknownAccess);
if (rc != Success)
return rc;
/*
** Check if screen of visual matches screen of pixmap.
@ -1768,7 +1766,7 @@ static int CreateGLXPixmap(__GLXclientState *cl,
to_screen = screenInfo.numScreens - 1;
pXinDraw = (PanoramiXRes *)
SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, SecurityReadAccess);
SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
}
#endif
@ -1781,7 +1779,8 @@ static int CreateGLXPixmap(__GLXclientState *cl,
#ifdef PANORAMIX
if (pXinDraw) {
pRealDraw = (DrawablePtr) LookupDrawable(pXinDraw->info[s].id,client);
dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
DixUnknownAccess);
}
#endif
@ -1947,14 +1946,13 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
__glXWindow *pGlxWindow = NULL;
int from_screen = 0;
int to_screen = 0;
int s;
int s, rc;
/*
** Check that the GLX drawable is valid.
*/
pDraw = (DrawablePtr) LookupDrawable(drawId, client);
if (pDraw) {
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (rc == Success) {
from_screen = to_screen = pDraw->pScreen->myNum;
if (pDraw->type == DRAWABLE_WINDOW) {
@ -2014,7 +2012,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
from_screen = 0;
to_screen = screenInfo.numScreens - 1;
pXinDraw = (PanoramiXRes *)
SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, SecurityReadAccess);
SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
}
#endif
@ -2058,9 +2056,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
}
#ifdef PANORAMIX
else if (pXinDraw) {
pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[s].id,
client,
SecurityReadAccess);
dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
}
#endif
else if (pGlxWindow) {
@ -2104,12 +2100,13 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
__GLXpixmap *pGlxPixmap = NULL;
__GLXcontext *glxc = NULL;
__glXWindow *pGlxWindow = NULL;
int rc;
/*
** Check that the GLX drawable is valid.
*/
pDraw = (DrawablePtr) LookupDrawable(drawId, client);
if (pDraw) {
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (rc == Success) {
if (pDraw->type != DRAWABLE_WINDOW) {
/*
** Drawable is an X pixmap, which is not allowed.
@ -2897,16 +2894,15 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
__GLXFBConfig *pGlxFBConfig = NULL;
VisualPtr pVisual;
VisualID visId;
int i;
int i, rc;
/*
** Check if windowId is valid
*/
pDraw = (DrawablePtr) LookupDrawable(windowId, client);
if (!pDraw || pDraw->type != DRAWABLE_WINDOW) {
client->errorValue = windowId;
return BadWindow;
}
rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW,
DixUnknownAccess);
if (rc != Success)
return rc;
/*
** Check if screen of window matches screen of fbconfig.
@ -3069,7 +3065,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
int nReplyBytes;
req = (xGLXQueryContextInfoEXTReq *)pc;
ctx = (__GLXcontext *) SecurityLookupIDByType(client, req->context, __glXContextRes, SecurityReadAccess);
ctx = (__GLXcontext *) SecurityLookupIDByType(client, req->context, __glXContextRes, DixReadAccess);
if (!ctx) {
client->errorValue = req->context;
return __glXBadContext;
@ -3279,7 +3275,7 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
GLXDrawable be_drawable = 0;
DrawablePtr pDraw = NULL;
Display *dpy;
int screen;
int screen, rc;
DMXScreenInfo *dmxScreen;
CARD32 *attribs = NULL;
int attribs_size;
@ -3288,8 +3284,8 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#endif
if (drawId != None) {
pDraw = (DrawablePtr) LookupDrawable(drawId, client);
if (pDraw) {
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) {
WindowPtr pWin = (WindowPtr)pDraw;
be_drawable = 0;
@ -3353,15 +3349,14 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
pXinDraw = (PanoramiXRes *)
SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, SecurityReadAccess);
SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
if (!pXinDraw) {
client->errorValue = drawId;
return __glXBadDrawable;
}
pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[screen].id,
client,
SecurityReadAccess);
dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
DixReadAccess);
}
#endif
@ -3441,7 +3436,7 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
GLXDrawable be_drawable = 0;
DrawablePtr pDraw = NULL;
Display *dpy;
int screen;
int screen, rc;
DMXScreenInfo *dmxScreen;
char *attrbuf;
#ifdef PANORAMIX
@ -3450,8 +3445,8 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#endif
if (drawId != None) {
pDraw = (DrawablePtr) LookupDrawable(drawId, client);
if (pDraw) {
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) {
WindowPtr pWin = (WindowPtr)pDraw;
be_drawable = 0;
@ -3515,15 +3510,14 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
pXinDraw = (PanoramiXRes *)
SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, SecurityReadAccess);
SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
if (!pXinDraw) {
client->errorValue = drawId;
return __glXBadDrawable;
}
pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[screen].id,
client,
SecurityReadAccess);
dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
DixReadAccess);
}
#endif

View File

@ -60,7 +60,7 @@ GLX_DEFS = @GL_CFLAGS@
GLX_INCS = -I@MESA_SOURCE@/include
endif
AM_CFLAGS = \
AM_CFLAGS = $(DIX_CFLAGS) \
-I$(top_srcdir)/hw/dmx \
-I$(top_srcdir)/hw/xfree86/common \
$(GLX_INCS) \

View File

@ -745,14 +745,11 @@ LinuxKeyboardEnable (KdKeyboardInfo *ki)
cfsetispeed(&nTty, 9600);
cfsetospeed(&nTty, 9600);
tcsetattr(fd, TCSANOW, &nTty);
/* Our kernel cleverly ignores O_NONBLOCK. Sigh. */
#if 0
/*
* Flush any pending keystrokes
*/
while ((n = read (fd, buf, sizeof (buf))) > 0)
;
#endif
KdRegisterFd (fd, LinuxKeyboardRead, ki);
return Success;
}

View File

@ -75,10 +75,7 @@ TsRead (int fd, void *closure)
while (ts_read(private->tsDev, &event, 1) == 1) {
if (event.pressure) {
if (event.pressure > pi->dixdev->absolute->button_threshold)
flags = KD_BUTTON_8;
else
flags = KD_BUTTON_1;
flags = KD_BUTTON_1;
/*
* Here we test for the touch screen driver actually being on the
@ -113,9 +110,8 @@ TsRead (int fd, void *closure)
static Status
TslibEnable (KdPointerInfo *pi)
{
struct TslibPrivate *private = pi->driverPrivate;
struct TslibPrivate *private = pi->driverPrivate;
private->holdThumbEvents = 1;
private->raw_event_hook = NULL;
private->raw_event_closure = NULL;
private->tsDev = ts_open(pi->path, 0);
@ -126,9 +122,6 @@ TslibEnable (KdPointerInfo *pi)
close(private->fd);
return BadAlloc;
}
if (pi->dixdev && pi->dixdev->absolute &&
pi->dixdev->absolute->button_threshold == 0)
pi->dixdev->absolute->button_threshold = 115;
KdRegisterFd(private->fd, TsRead, pi);
@ -141,12 +134,12 @@ TslibDisable (KdPointerInfo *pi)
{
struct TslibPrivate *private = pi->driverPrivate;
if (private->fd) {
KdUnregisterFd(pi, private->fd);
close(private->fd);
}
if (private->fd)
KdUnregisterFd(pi, private->fd, TRUE);
if (private->tsDev)
ts_close(private->tsDev);
private->fd = 0;
private->tsDev = NULL;
}
@ -156,7 +149,6 @@ static Status
TslibInit (KdPointerInfo *pi)
{
int fd = 0, i = 0;
char devpath[PATH_MAX], devname[TS_NAME_SIZE];
DIR *inputdir = NULL;
struct dirent *inputent = NULL;
struct tsdev *tsDev = NULL;

View File

@ -286,10 +286,8 @@ mgaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
if (pMaskPicture->componentAlpha)
MGA_FALLBACK(("Component alpha unsupported"));
switch (pDstPicture->format) {
case PICT_a8:
if (pDstPicture->format == PICT_a8)
MGA_FALLBACK(("render to A8 unsupported"));
}
return TRUE;
}

View File

@ -21,8 +21,9 @@ Xvfb_LDFLAGS =
AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
-DNO_HW_ONLY_EXTS \
-DNO_MODULE_EXTS \
\
$(XVFBMODULES_CFLAGS)
-DXFree86Server \
$(XVFBMODULES_CFLAGS) \
$(DIX_CFLAGS)
# Man page
include $(top_srcdir)/cpprules.in

View File

@ -22,7 +22,7 @@ DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
bin_PROGRAMS = Xorg
AM_CFLAGS = @XORG_CFLAGS@
AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
INCLUDES = @XORG_INCS@
Xorg_SOURCES = xorg.c
@ -93,7 +93,6 @@ CPP_FILES_FLAGS = \
-DMISCFONTPATH="\"$(BASE_FONT_PATH)/misc\"" \
-DT1FONTPATH="\"$(BASE_FONT_PATH)/Type1\"" \
-DTRUETYPEFONTPATH="\"$(BASE_FONT_PATH)/TTF\"" \
-DCIDFONTPATH="\"$(BASE_FONT_PATH)/CID\"" \
-DDPI75FONTPATH="\"$(BASE_FONT_PATH)/75dpi\"" \
-DDPI100FONTPATH="\"$(BASE_FONT_PATH)/100dpi\"" \
-DMODULEPATH=\"$(DEFAULT_MODULE_PATH)\"

View File

@ -94,4 +94,4 @@ if LNXACPI
XORG_CFLAGS += -DHAVE_ACPI
endif
AM_CFLAGS = $(XORG_CFLAGS)
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)

View File

@ -118,7 +118,7 @@ extern int ffs(unsigned long);
# if defined(NO_INLINE) || defined(DO_PROTOTYPES)
# if !defined(__arm__)
# if !defined(__sparc__) && !defined(__arm32__) \
# if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) \
&& !(defined(__alpha__) && defined(linux)) \
&& !(defined(__ia64__) && defined(linux)) \
@ -1697,7 +1697,7 @@ static __inline__ void ppc_flush_icache(char *addr)
: : "r"(addr) : "memory");
}
# elif defined(__sparc__) || defined(sparc)
# elif defined(__sparc__) || defined(sparc) || defined(__sparc)
/*
* Like powerpc, we provide byteswapping and no byteswapping functions
* here with byteswapping as default, drivers that don't need byteswapping

View File

@ -64,7 +64,7 @@ extern ScrnInfoPtr xf86CurrentScreen;
extern Bool pciSlotClaimed;
extern Bool isaSlotClaimed;
extern Bool fbSlotClaimed;
#ifdef __sparc__
#if defined(__sparc__) || defined(__sparc)
extern Bool sbusSlotClaimed;
#endif
extern confDRIRec xf86ConfigDRI;
@ -418,6 +418,15 @@ void xf86PruneDriverModes(ScrnInfoPtr scrp);
void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
void xf86PrintModes(ScrnInfoPtr scrp);
void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
double xf86ModeHSync(DisplayModePtr mode);
double xf86ModeVRefresh(DisplayModePtr mode);
void xf86SetModeDefaultName(DisplayModePtr mode);
void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode);
DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
/* xf86Option.c */

View File

@ -113,7 +113,7 @@ void
xf86BusProbe(void)
{
xf86PciProbe();
#if defined(__sparc__) && !defined(__OpenBSD__)
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
xf86SbusProbe();
#endif
}
@ -2373,7 +2373,7 @@ xf86PostProbe(void)
if (fbSlotClaimed) {
if (pciSlotClaimed || isaSlotClaimed
#if defined(__sparc__) && !defined(__OpenBSD__)
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
|| sbusSlotClaimed
#endif
) {
@ -3006,7 +3006,7 @@ xf86FindPrimaryDevice()
}
#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__)
#if !defined(__sparc) && !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__)
#include "vgaHW.h"
#include "compiler.h"
#endif
@ -3018,7 +3018,7 @@ static void
CheckGenericGA()
{
/* This needs to be changed for multiple domains */
#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__arm__) && !defined(__s390__)
#if !defined(__sparc__) && !defined(__sparc) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__arm__) && !defined(__s390__)
IOADDRESS GenericIOBase = VGAHW_GET_IOBASE();
CARD8 CurrentValue, TestValue;

View File

@ -40,7 +40,7 @@
#define _XF86_BUS_H
#include "xf86pciBus.h"
#ifdef __sparc__
#if defined(__sparc__) || defined(__sparc)
#include "xf86sbusBus.h"
#endif

View File

@ -48,7 +48,7 @@
#include "Configint.h"
#include "vbe.h"
#include "xf86DDC.h"
#if defined(__sparc__) && !defined(__OpenBSD__)
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
#include "xf86Bus.h"
#include "xf86Sbus.h"
#endif
@ -57,7 +57,7 @@
typedef struct _DevToConfig {
GDevRec GDev;
pciVideoPtr pVideo;
#if defined(__sparc__) && !defined(__OpenBSD__)
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
sbusDevicePtr sVideo;
#endif
int iDriver;
@ -134,7 +134,7 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
if (!DevToConfig[i].pVideo)
return NULL;
break;
#if defined(__sparc__) && !defined(__OpenBSD__)
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
case BUS_SBUS:
for (i = 0; i < nDevToConfig; i++)
if (DevToConfig[i].sVideo &&
@ -213,7 +213,7 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
NewDevice.GDev.identifier = "ISA Adapter";
NewDevice.GDev.busID = "ISA";
break;
#if defined(__sparc__) && !defined(__OpenBSD__)
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
case BUS_SBUS: {
char *promPath = NULL;
NewDevice.sVideo = (sbusDevicePtr) busData;

View File

@ -789,8 +789,6 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
xEvent ke;
int i = 0, j = 0, nevents = 0;
ErrorF("releasekeys: called on device %s (%d)\n", pDev->name, pDev->id);
if (!pDev || !pDev->key)
return;

View File

@ -100,6 +100,8 @@
static void xf86PrintBanner(void);
static void xf86PrintMarkers(void);
static void xf86PrintDefaultModulePath(void);
static void xf86PrintDefaultLibraryPath(void);
static void xf86RunVtInit(void);
#ifdef __UNIXOS2__
@ -1376,6 +1378,16 @@ ddxProcessArgument(int argc, char **argv, int i)
xf86PrintBanner();
exit(0);
}
if (!strcmp(argv[i],"-showDefaultModulePath"))
{
xf86PrintDefaultModulePath();
exit(0);
}
if (!strcmp(argv[i],"-showDefaultLibPath"))
{
xf86PrintDefaultLibraryPath();
exit(0);
}
/* Notice the -fp flag, but allow it to pass to the dix layer */
if (!strcmp(argv[i], "-fp"))
{
@ -1625,6 +1637,8 @@ ddxUseMsg()
ErrorF("-ignoreABI make module ABI mismatches non-fatal\n");
ErrorF("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n");
ErrorF("-version show the server version\n");
ErrorF("-showDefaultModulePath show the server default module path\n");
ErrorF("-showDefaultLibPath show the server default library path\n");
/* OS-specific usage */
xf86UseMsg();
ErrorF("\n");
@ -1747,6 +1761,18 @@ xf86PrintMarkers()
LogPrintMarkers();
}
static void
xf86PrintDefaultModulePath(void)
{
ErrorF("%s\n", DEFAULT_MODULE_PATH);
}
static void
xf86PrintDefaultLibraryPath(void)
{
ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
}
static void
xf86RunVtInit(void)
{

View File

@ -368,8 +368,9 @@ xf86HandleBuiltinMode(ScrnInfoPtr scrp,
return MODE_OK;
}
static double
ModeHSync(DisplayModePtr mode)
/** Calculates the horizontal sync rate of a mode */
_X_EXPORT double
xf86ModeHSync(DisplayModePtr mode)
{
double hsync = 0.0;
@ -381,8 +382,9 @@ ModeHSync(DisplayModePtr mode)
return hsync;
}
static double
ModeVRefresh(DisplayModePtr mode)
/** Calculates the vertical refresh rate of a mode */
_X_EXPORT double
xf86ModeVRefresh(DisplayModePtr mode)
{
double refresh = 0.0;
@ -400,6 +402,16 @@ ModeVRefresh(DisplayModePtr mode)
return refresh;
}
/** Sets a default mode name of <width>x<height> on a mode. */
_X_EXPORT void
xf86SetModeDefaultName(DisplayModePtr mode)
{
if (mode->name != NULL)
xfree(mode->name);
mode->name = XNFprintf("%dx%d", mode->HDisplay, mode->VDisplay);
}
/*
* xf86LookupMode
*
@ -529,7 +541,7 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
ModePrivFlags = cp->PrivFlags;
break;
}
refresh = ModeVRefresh(p);
refresh = xf86ModeVRefresh(p);
if (p->Flags & V_INTERLACE)
refresh /= INTERLACE_REFRESH_WEIGHT;
if (refresh > bestRefresh) {
@ -570,7 +582,7 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
found = TRUE;
if (strategy == LOOKUP_BEST_REFRESH) {
refresh = ModeVRefresh(p);
refresh = xf86ModeVRefresh(p);
if (p->Flags & V_INTERLACE)
refresh /= INTERLACE_REFRESH_WEIGHT;
if (refresh > bestRefresh) {
@ -674,7 +686,7 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
* Initialises the Crtc parameters for a mode. The initialisation includes
* adjustments for interlaced and double scan modes.
*/
static void
_X_EXPORT void
xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
{
if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN))
@ -756,6 +768,87 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
}
}
/**
* Allocates and returns a copy of pMode, including pointers within pMode.
*/
_X_EXPORT DisplayModePtr
xf86DuplicateMode(DisplayModePtr pMode)
{
DisplayModePtr pNew;
pNew = xnfalloc(sizeof(DisplayModeRec));
*pNew = *pMode;
pNew->next = NULL;
pNew->prev = NULL;
if (pNew->name == NULL) {
xf86SetModeDefaultName(pMode);
} else {
pNew->name = xnfstrdup(pMode->name);
}
return pNew;
}
/**
* Duplicates every mode in the given list and returns a pointer to the first
* mode.
*
* \param modeList doubly-linked mode list
*/
_X_EXPORT DisplayModePtr
xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
{
DisplayModePtr first = NULL, last = NULL;
DisplayModePtr mode;
for (mode = modeList; mode != NULL; mode = mode->next) {
DisplayModePtr new;
new = xf86DuplicateMode(mode);
/* Insert pNew into modeList */
if (last) {
last->next = new;
new->prev = last;
} else {
first = new;
new->prev = NULL;
}
new->next = NULL;
last = new;
}
return first;
}
/**
* Returns true if the given modes should program to the same timings.
*
* This doesn't use Crtc values, as it might be used on ModeRecs without the
* Crtc values set. So, it's assumed that the other numbers are enough.
*/
_X_EXPORT Bool
xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
{
if (pMode1->Clock == pMode2->Clock &&
pMode1->HDisplay == pMode2->HDisplay &&
pMode1->HSyncStart == pMode2->HSyncStart &&
pMode1->HSyncEnd == pMode2->HSyncEnd &&
pMode1->HTotal == pMode2->HTotal &&
pMode1->HSkew == pMode2->HSkew &&
pMode1->VDisplay == pMode2->VDisplay &&
pMode1->VSyncStart == pMode2->VSyncStart &&
pMode1->VSyncEnd == pMode2->VSyncEnd &&
pMode1->VTotal == pMode2->VTotal &&
pMode1->VScan == pMode2->VScan &&
pMode1->Flags == pMode2->Flags)
{
return TRUE;
} else {
return FALSE;
}
}
/*
* xf86CheckModeForMonitor
*
@ -789,7 +882,7 @@ xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor)
if (monitor->nHsync > 0) {
/* Check hsync against the allowed ranges */
float hsync = ModeHSync(mode);
float hsync = xf86ModeHSync(mode);
for (i = 0; i < monitor->nHsync; i++)
if ((hsync > monitor->hsync[i].lo * (1.0 - SYNC_TOLERANCE)) &&
(hsync < monitor->hsync[i].hi * (1.0 + SYNC_TOLERANCE)))
@ -802,7 +895,7 @@ xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor)
if (monitor->nVrefresh > 0) {
/* Check vrefresh against the allowed ranges */
float vrefrsh = ModeVRefresh(mode);
float vrefrsh = xf86ModeVRefresh(mode);
for (i = 0; i < monitor->nVrefresh; i++)
if ((vrefrsh > monitor->vrefresh[i].lo * (1.0 - SYNC_TOLERANCE)) &&
(vrefrsh < monitor->vrefresh[i].hi * (1.0 + SYNC_TOLERANCE)))
@ -1033,8 +1126,8 @@ xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
/ (mode->CrtcHTotal * mode->CrtcVTotal);
}
mode->HSync = ModeHSync(mode);
mode->VRefresh = ModeVRefresh(mode);
mode->HSync = xf86ModeHSync(mode);
mode->VRefresh = xf86ModeVRefresh(mode);
/* Assume it is OK */
return MODE_OK;
@ -1572,7 +1665,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
"TargetRefresh", 0.0);
if (targetRefresh > 0.0) {
for (p = scrp->modePool; p != NULL; p = p->next) {
if (ModeVRefresh(p) > targetRefresh * (1.0 - SYNC_TOLERANCE))
if (xf86ModeVRefresh(p) > targetRefresh * (1.0 - SYNC_TOLERANCE))
break;
}
if (!p)
@ -1661,7 +1754,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
* If there is a target refresh rate, skip modes that
* don't match up.
*/
if (ModeVRefresh(q) <
if (xf86ModeVRefresh(q) <
(1.0 - SYNC_TOLERANCE) * targetRefresh)
continue;
@ -1981,8 +2074,8 @@ add(char **p, char *new)
strcat(*p, new);
}
static void
PrintModeline(int scrnIndex,DisplayModePtr mode)
_X_EXPORT void
xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
{
char tmp[256];
char *flags = xnfcalloc(1, 1);
@ -2037,8 +2130,8 @@ xf86PrintModes(ScrnInfoPtr scrp)
do {
desc = desc2 = "";
hsync = ModeHSync(p);
refresh = ModeVRefresh(p);
hsync = xf86ModeHSync(p);
refresh = xf86ModeVRefresh(p);
if (p->Flags & V_INTERLACE) {
desc = " (I)";
}
@ -2081,7 +2174,31 @@ xf86PrintModes(ScrnInfoPtr scrp)
p->SynthClock / 1000.0, hsync, refresh, desc, desc2);
}
if (hsync != 0 && refresh != 0)
PrintModeline(scrp->scrnIndex,p);
xf86PrintModeline(scrp->scrnIndex,p);
p = p->next;
} while (p != NULL && p != scrp->modes);
}
/**
* Adds the new mode into the mode list, and returns the new list
*
* \param modes doubly-linked mode list.
*/
_X_EXPORT DisplayModePtr
xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
{
if (modes == NULL)
return new;
if (new) {
DisplayModePtr mode = modes;
while (mode->next)
mode = mode->next;
mode->next = new;
new->prev = mode;
}
return modes;
}

View File

@ -90,16 +90,6 @@
#include "mi.h"
/******************************************************************************
* debugging macro
*****************************************************************************/
#ifdef DEBUG
static int debug_level = 0;
#define DBG(lvl, f) {if ((lvl) <= debug_level) f;}
#else
#define DBG(lvl, f)
#endif
xEvent *xf86Events = NULL;
static Bool
@ -140,33 +130,6 @@ xf86ProcessCommonOptions(LocalDevicePtr local,
}
}
void
xf86AlwaysCoreControl(DeviceIntPtr pDev, IntegerCtrl *control)
{
}
/***********************************************************************
*
* xf86XinputFinalizeInit --
*
* Create and initialize an integer feedback to control the always
* core feature.
*
***********************************************************************
*/
void
xf86XinputFinalizeInit(DeviceIntPtr dev)
{
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
if (InitIntegerFeedbackClassDeviceStruct(dev, xf86AlwaysCoreControl) == FALSE) {
ErrorF("Unable to init integer feedback for always core feature\n");
} else {
local->always_core_feedback = dev->intfeed;
dev->intfeed->ctrl.integer_displayed = (local->flags & XI86_ALWAYS_CORE) ? 1 : 0;
}
}
/***********************************************************************
*
* xf86ActivateDevice --
@ -193,8 +156,6 @@ xf86ActivateDevice(LocalDevicePtr local)
dev->public.devicePrivate = (pointer) local;
local->dev = dev;
xf86XinputFinalizeInit(dev);
dev->coreEvents = local->flags & XI86_ALWAYS_CORE;
RegisterOtherDevice(dev);
@ -434,8 +395,10 @@ xf86PostMotionEvent(DeviceIntPtr device,
{
va_list var;
int i = 0, nevents = 0;
Bool drag = xf86SendDragEvents(device);
int *valuators = NULL;
int flags = 0;
xEvent *xE = NULL;
if (is_absolute)
flags = POINTER_ABSOLUTE;
@ -458,8 +421,14 @@ xf86PostMotionEvent(DeviceIntPtr device,
flags, first_valuator, num_valuators,
valuators);
for (i = 0; i < nevents; i++)
mieqEnqueue(device, xf86Events + i);
for (i = 0; i < nevents; i++) {
xE = xf86Events + i;
/* Don't post core motion events for devices not registered to send
* drag events. */
if (xE->u.u.type != MotionNotify || drag) {
mieqEnqueue(device, xf86Events + i);
}
}
xfree(valuators);
}

View File

@ -4,10 +4,11 @@ module_LTLIBRARIES = libddc.la
libddc_la_LDFLAGS = -avoid-version
libddc_la_SOURCES = xf86DDC.c edid.c interpret_edid.c print_edid.c \
interpret_vdif.c print_vdif.c ddcProperty.c
interpret_vdif.c print_vdif.c ddcProperty.c \
edid_modes.c
INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
AM_CFLAGS = $(XORG_CFLAGS)
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
EXTRA_DIST = ddcPriv.h DDC.HOWTO

View File

@ -32,392 +32,6 @@
#include "propertyst.h"
#include "xf86DDC.h"
/*
* xf86Mode.c should have a some more DisplayModePtr list handling.
*/
static DisplayModePtr
xf86ModesAdd(DisplayModePtr Modes, DisplayModePtr Additions)
{
if (!Modes) {
if (Additions)
return Additions;
else
return NULL;
}
if (Additions) {
DisplayModePtr Mode = Modes;
while (Mode->next)
Mode = Mode->next;
Mode->next = Additions;
Additions->prev = Mode;
}
return Modes;
}
static DisplayModePtr
xf86ModeCopy(DisplayModePtr Mode)
{
DisplayModePtr New;
if (!Mode)
return NULL;
New = xnfalloc(sizeof(DisplayModeRec));
memcpy(New, Mode, sizeof(DisplayModeRec));
New->name = xnfalloc(strlen(Mode->name) + 1);
memcpy(New->name, Mode->name, strlen(Mode->name) + 1);
/* We ignore privates as DDC code doesn't use it currently */
return New;
}
/*
* Temporary.
*/
static void
add(char **p, char *new)
{
*p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2);
strcat(*p, " ");
strcat(*p, new);
}
static void
PrintModeline(int scrnIndex,DisplayModePtr mode)
{
char tmp[256];
char *flags = xnfcalloc(1, 1);
if (mode->HSkew) {
snprintf(tmp, 256, "hskew %i", mode->HSkew);
add(&flags, tmp);
}
if (mode->VScan) {
snprintf(tmp, 256, "vscan %i", mode->VScan);
add(&flags, tmp);
}
if (mode->Flags & V_INTERLACE) add(&flags, "interlace");
if (mode->Flags & V_CSYNC) add(&flags, "composite");
if (mode->Flags & V_DBLSCAN) add(&flags, "doublescan");
if (mode->Flags & V_BCAST) add(&flags, "bcast");
if (mode->Flags & V_PHSYNC) add(&flags, "+hsync");
if (mode->Flags & V_NHSYNC) add(&flags, "-hsync");
if (mode->Flags & V_PVSYNC) add(&flags, "+vsync");
if (mode->Flags & V_NVSYNC) add(&flags, "-vsync");
if (mode->Flags & V_PCSYNC) add(&flags, "+csync");
if (mode->Flags & V_NCSYNC) add(&flags, "-csync");
#if 0
if (mode->Flags & V_CLKDIV2) add(&flags, "vclk/2");
#endif
xf86DrvMsgVerb(scrnIndex, X_INFO, 3,
"Modeline \"%s\" %6.2f %i %i %i %i %i %i %i %i%s\n",
mode->name, mode->Clock/1000., mode->HDisplay,
mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
mode->VDisplay, mode->VSyncStart, mode->VSyncEnd,
mode->VTotal, flags);
xfree(flags);
}
/*
* TODO:
* - for those with access to the VESA DMT standard; review please.
*/
#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DRIVER
#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
DisplayModeRec DDCEstablishedModes[17] = {
{ MODEPREFIX("800x600"), 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
{ MODEPREFIX("800x600"), 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
{ MODEPREFIX("640x480"), 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
{ MODEPREFIX("640x480"), 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
{ MODEPREFIX("640x480"), 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
{ MODEPREFIX("640x480"), 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
{ MODEPREFIX("720x400"), 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
{ MODEPREFIX("720x400"), 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
{ MODEPREFIX("1280x1024"), 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
{ MODEPREFIX("1024x768"), 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
{ MODEPREFIX("1024x768"), 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
{ MODEPREFIX("1024x768"), 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
{ MODEPREFIX("1024x768"), 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
{ MODEPREFIX("832x624"), 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
{ MODEPREFIX("800x600"), 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
{ MODEPREFIX("800x600"), 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
{ MODEPREFIX("1152x864"), 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
};
static DisplayModePtr
DDCModesFromEstablished(int scrnIndex, struct established_timings *timing)
{
DisplayModePtr Modes = NULL, Mode = NULL;
CARD32 bits = (timing->t1) | (timing->t2 << 8) |
((timing->t_manu & 0x80) << 9);
int i;
for (i = 0; i < 17; i++)
if (bits & (0x01 << i)) {
Mode = xf86ModeCopy(&(DDCEstablishedModes[i]));
Modes = xf86ModesAdd(Modes, Mode);
}
return Modes;
}
/*
*
*/
static DisplayModePtr
DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing)
{
DisplayModePtr Modes = NULL, Mode = NULL;
int i;
for (i = 0; i < STD_TIMINGS; i++)
if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
timing[i].refresh, FALSE, FALSE);
Mode->type = M_T_DRIVER;
Modes = xf86ModesAdd(Modes, Mode);
}
return Modes;
}
/*
*
*/
static DisplayModePtr
DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
int preferred)
{
DisplayModePtr Mode;
/* We don't do stereo */
if (timing->stereo) {
xf86DrvMsg(scrnIndex, X_INFO, "%s: Ignoring: We don't handle stereo.\n",
__func__);
return NULL;
}
/* We only do seperate sync currently */
if (timing->sync != 0x03) {
xf86DrvMsg(scrnIndex, X_INFO, "%s: %dx%d Warning: We only handle seperate"
" sync.\n", __func__, timing->h_active, timing->v_active);
}
Mode = xnfalloc(sizeof(DisplayModeRec));
memset(Mode, 0, sizeof(DisplayModeRec));
Mode->name = xnfalloc(10); /* "1234x1234" */
xf86snprintf(Mode->name, 20, "%dx%d", timing->h_active,
timing->v_active);
Mode->type = M_T_DRIVER;
if (preferred)
Mode->type |= M_T_PREFERRED;
Mode->Clock = timing->clock / 1000.0;
Mode->HDisplay = timing->h_active;
Mode->HSyncStart = timing->h_active + timing->h_sync_off;
Mode->HSyncEnd = Mode->HSyncStart + timing->h_sync_width;
Mode->HTotal = timing->h_active + timing->h_blanking;
Mode->VDisplay = timing->v_active;
Mode->VSyncStart = timing->v_active + timing->v_sync_off;
Mode->VSyncEnd = Mode->VSyncStart + timing->v_sync_width;
Mode->VTotal = timing->v_active + timing->v_blanking;
/* We ignore h/v_size and h/v_border for now. */
if (timing->interlaced)
Mode->Flags |= V_INTERLACE;
if (timing->misc & 0x02)
Mode->Flags |= V_PHSYNC;
else
Mode->Flags |= V_NHSYNC;
if (timing->misc & 0x01)
Mode->Flags |= V_PVSYNC;
else
Mode->Flags |= V_NVSYNC;
return Mode;
}
/*
*
*/
static void
DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
{
DisplayModePtr Mode = Modes;
if (!Monitor || !Modes)
return;
/* set up the ranges for scanning through the modes */
Monitor->nHsync = 1;
Monitor->hsync[0].lo = 1024.0;
Monitor->hsync[0].hi = 0.0;
Monitor->nVrefresh = 1;
Monitor->vrefresh[0].lo = 1024.0;
Monitor->vrefresh[0].hi = 0.0;
while (Mode) {
if (!Mode->HSync)
Mode->HSync = ((float) Mode->Clock ) / ((float) Mode->HTotal);
if (!Mode->VRefresh)
Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
((float) (Mode->HTotal * Mode->VTotal));
if (Mode->HSync < Monitor->hsync[0].lo)
Monitor->hsync[0].lo = Mode->HSync;
if (Mode->HSync > Monitor->hsync[0].hi)
Monitor->hsync[0].hi = Mode->HSync;
if (Mode->VRefresh < Monitor->vrefresh[0].lo)
Monitor->vrefresh[0].lo = Mode->VRefresh;
if (Mode->VRefresh > Monitor->vrefresh[0].hi)
Monitor->vrefresh[0].hi = Mode->VRefresh;
Mode = Mode->next;
}
}
/*
* Fill out MonPtr with xf86MonPtr information.
*/
void
xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
{
DisplayModePtr Modes = NULL, Mode;
int i, clock;
Bool have_hsync = FALSE, have_vrefresh = FALSE;
int preferred;
if (!Monitor || !DDC)
return;
Monitor->DDC = DDC;
preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
Monitor->widthmm = 10 * DDC->features.hsize;
Monitor->heightmm = 10 * DDC->features.vsize;
/* If this is a digital display, then we can use reduced blanking */
if (DDC->features.input_type)
Monitor->reducedblanking = TRUE;
/* Allow the user to also enable this through config */
/* Add established timings */
Mode = DDCModesFromEstablished(scrnIndex, &DDC->timings1);
Modes = xf86ModesAdd(Modes, Mode);
/* Add standard timings */
Mode = DDCModesFromStandardTiming(scrnIndex, DDC->timings2);
Modes = xf86ModesAdd(Modes, Mode);
/* Skip EDID ranges if they were specified in the config file */
have_hsync = (Monitor->nHsync != 0);
have_vrefresh = (Monitor->nVrefresh != 0);
/* Go through the detailed monitor sections */
for (i = 0; i < DET_TIMINGS; i++)
switch (DDC->det_mon[i].type) {
case DS_RANGES:
if (!have_hsync) {
if (!Monitor->nHsync)
xf86DrvMsg(scrnIndex, X_INFO,
"Using EDID range info for horizontal sync\n");
Monitor->hsync[Monitor->nHsync].lo =
DDC->det_mon[i].section.ranges.min_h;
Monitor->hsync[Monitor->nHsync].hi =
DDC->det_mon[i].section.ranges.max_h;
Monitor->nHsync++;
} else {
xf86DrvMsg(scrnIndex, X_INFO,
"Using hsync ranges from config file\n");
}
if (!have_vrefresh) {
if (!Monitor->nVrefresh)
xf86DrvMsg(scrnIndex, X_INFO,
"Using EDID range info for vertical refresh\n");
Monitor->vrefresh[Monitor->nVrefresh].lo =
DDC->det_mon[i].section.ranges.min_v;
Monitor->vrefresh[Monitor->nVrefresh].hi =
DDC->det_mon[i].section.ranges.max_v;
Monitor->nVrefresh++;
} else {
xf86DrvMsg(scrnIndex, X_INFO,
"Using vrefresh ranges from config file\n");
}
clock = DDC->det_mon[i].section.ranges.max_clock * 1000;
if (clock > Monitor->maxPixClock)
Monitor->maxPixClock = clock;
break;
case DT:
Mode = DDCModeFromDetailedTiming(scrnIndex,
&DDC->det_mon[i].section.d_timings,
preferred);
preferred = 0;
Modes = xf86ModesAdd(Modes, Mode);
break;
case DS_STD_TIMINGS:
Mode = DDCModesFromStandardTiming(scrnIndex,
DDC->det_mon[i].section.std_t);
Modes = xf86ModesAdd(Modes, Mode);
break;
default:
break;
}
if (Modes) {
/* Print Modes */
xf86DrvMsg(scrnIndex, X_INFO, "Printing DDC gathered Modelines:\n");
Mode = Modes;
while (Mode) {
PrintModeline(scrnIndex, Mode);
Mode = Mode->next;
}
/* Do we still need ranges to be filled in? */
if (!Monitor->nHsync || !Monitor->nVrefresh)
DDCGuessRangesFromModes(scrnIndex, Monitor, Modes);
/* look for last Mode */
Mode = Modes;
while (Mode->next)
Mode = Mode->next;
/* add to MonPtr */
if (Monitor->Modes) {
Monitor->Last->next = Modes;
Modes->prev = Monitor->Last;
Monitor->Last = Mode;
} else {
Monitor->Modes = Modes;
Monitor->Last = Mode;
}
}
}
#define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA"
#define EDID2_ATOM_NAME "XFree86_DDC_EDID2_RAWDATA"
#define VDIF_ATOM_NAME "XFree86_DDC_VDIF_RAWDATA"

348
hw/xfree86/ddc/edid_modes.c Normal file
View File

@ -0,0 +1,348 @@
/*
* Copyright 2006 Luc Verhaegen.
*
* 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, sub license,
* 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 (including the
* next paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86.h"
#include "xf86DDC.h"
#include <X11/Xatom.h>
#include "property.h"
#include "propertyst.h"
#include "xf86DDC.h"
/*
* TODO:
* - for those with access to the VESA DMT standard; review please.
*/
#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DRIVER
#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
DisplayModeRec DDCEstablishedModes[17] = {
{ MODEPREFIX("800x600"), 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
{ MODEPREFIX("800x600"), 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
{ MODEPREFIX("640x480"), 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
{ MODEPREFIX("640x480"), 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
{ MODEPREFIX("640x480"), 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
{ MODEPREFIX("640x480"), 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
{ MODEPREFIX("720x400"), 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
{ MODEPREFIX("720x400"), 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
{ MODEPREFIX("1280x1024"), 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
{ MODEPREFIX("1024x768"), 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
{ MODEPREFIX("1024x768"), 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
{ MODEPREFIX("1024x768"), 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
{ MODEPREFIX("1024x768"), 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
{ MODEPREFIX("832x624"), 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
{ MODEPREFIX("800x600"), 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
{ MODEPREFIX("800x600"), 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
{ MODEPREFIX("1152x864"), 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
};
static DisplayModePtr
DDCModesFromEstablished(int scrnIndex, struct established_timings *timing)
{
DisplayModePtr Modes = NULL, Mode = NULL;
CARD32 bits = (timing->t1) | (timing->t2 << 8) |
((timing->t_manu & 0x80) << 9);
int i;
for (i = 0; i < 17; i++) {
if (bits & (0x01 << i)) {
Mode = xf86DuplicateMode(&DDCEstablishedModes[i]);
Modes = xf86ModesAdd(Modes, Mode);
}
}
return Modes;
}
/*
*
*/
static DisplayModePtr
DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing)
{
DisplayModePtr Modes = NULL, Mode = NULL;
int i;
for (i = 0; i < STD_TIMINGS; i++) {
if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
timing[i].refresh, FALSE, FALSE);
Mode->type = M_T_DRIVER;
Modes = xf86ModesAdd(Modes, Mode);
}
}
return Modes;
}
/*
*
*/
static DisplayModePtr
DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
int preferred)
{
DisplayModePtr Mode;
/* We don't do stereo */
if (timing->stereo) {
xf86DrvMsg(scrnIndex, X_INFO,
"%s: Ignoring: We don't handle stereo.\n", __func__);
return NULL;
}
/* We only do seperate sync currently */
if (timing->sync != 0x03) {
xf86DrvMsg(scrnIndex, X_INFO,
"%s: %dx%d Warning: We only handle seperate"
" sync.\n", __func__, timing->h_active, timing->v_active);
}
Mode = xnfalloc(sizeof(DisplayModeRec));
memset(Mode, 0, sizeof(DisplayModeRec));
Mode->type = M_T_DRIVER;
if (preferred)
Mode->type |= M_T_PREFERRED;
Mode->Clock = timing->clock / 1000.0;
Mode->HDisplay = timing->h_active;
Mode->HSyncStart = timing->h_active + timing->h_sync_off;
Mode->HSyncEnd = Mode->HSyncStart + timing->h_sync_width;
Mode->HTotal = timing->h_active + timing->h_blanking;
Mode->VDisplay = timing->v_active;
Mode->VSyncStart = timing->v_active + timing->v_sync_off;
Mode->VSyncEnd = Mode->VSyncStart + timing->v_sync_width;
Mode->VTotal = timing->v_active + timing->v_blanking;
xf86SetModeDefaultName(Mode);
/* We ignore h/v_size and h/v_border for now. */
if (timing->interlaced)
Mode->Flags |= V_INTERLACE;
if (timing->misc & 0x02)
Mode->Flags |= V_PHSYNC;
else
Mode->Flags |= V_NHSYNC;
if (timing->misc & 0x01)
Mode->Flags |= V_PVSYNC;
else
Mode->Flags |= V_NVSYNC;
return Mode;
}
/*
*
*/
static void
DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
{
DisplayModePtr Mode = Modes;
if (!Monitor || !Modes)
return;
/* set up the ranges for scanning through the modes */
Monitor->nHsync = 1;
Monitor->hsync[0].lo = 1024.0;
Monitor->hsync[0].hi = 0.0;
Monitor->nVrefresh = 1;
Monitor->vrefresh[0].lo = 1024.0;
Monitor->vrefresh[0].hi = 0.0;
while (Mode) {
if (!Mode->HSync)
Mode->HSync = ((float) Mode->Clock ) / ((float) Mode->HTotal);
if (!Mode->VRefresh)
Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
((float) (Mode->HTotal * Mode->VTotal));
if (Mode->HSync < Monitor->hsync[0].lo)
Monitor->hsync[0].lo = Mode->HSync;
if (Mode->HSync > Monitor->hsync[0].hi)
Monitor->hsync[0].hi = Mode->HSync;
if (Mode->VRefresh < Monitor->vrefresh[0].lo)
Monitor->vrefresh[0].lo = Mode->VRefresh;
if (Mode->VRefresh > Monitor->vrefresh[0].hi)
Monitor->vrefresh[0].hi = Mode->VRefresh;
Mode = Mode->next;
}
}
DisplayModePtr
xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
{
int preferred, i;
DisplayModePtr Modes = NULL, Mode;
preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
/* Add established timings */
Mode = DDCModesFromEstablished(scrnIndex, &DDC->timings1);
Modes = xf86ModesAdd(Modes, Mode);
/* Add standard timings */
Mode = DDCModesFromStandardTiming(scrnIndex, DDC->timings2);
Modes = xf86ModesAdd(Modes, Mode);
for (i = 0; i < DET_TIMINGS; i++) {
struct detailed_monitor_section *det_mon = &DDC->det_mon[i];
switch (det_mon->type) {
case DT:
Mode = DDCModeFromDetailedTiming(scrnIndex,
&det_mon->section.d_timings,
preferred);
preferred = 0;
Modes = xf86ModesAdd(Modes, Mode);
break;
case DS_STD_TIMINGS:
Mode = DDCModesFromStandardTiming(scrnIndex,
det_mon->section.std_t);
Modes = xf86ModesAdd(Modes, Mode);
break;
default:
break;
}
}
return Modes;
}
/*
* Fill out MonPtr with xf86MonPtr information.
*/
void
xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
{
DisplayModePtr Modes = NULL, Mode;
int i, clock;
Bool have_hsync = FALSE, have_vrefresh = FALSE;
if (!Monitor || !DDC)
return;
Monitor->DDC = DDC;
Monitor->widthmm = 10 * DDC->features.hsize;
Monitor->heightmm = 10 * DDC->features.vsize;
/* If this is a digital display, then we can use reduced blanking */
if (DDC->features.input_type)
Monitor->reducedblanking = TRUE;
/* Allow the user to also enable this through config */
Modes = xf86DDCGetModes(scrnIndex, DDC);
/* Skip EDID ranges if they were specified in the config file */
have_hsync = (Monitor->nHsync != 0);
have_vrefresh = (Monitor->nVrefresh != 0);
/* Go through the detailed monitor sections */
for (i = 0; i < DET_TIMINGS; i++) {
switch (DDC->det_mon[i].type) {
case DS_RANGES:
if (!have_hsync) {
if (!Monitor->nHsync)
xf86DrvMsg(scrnIndex, X_INFO,
"Using EDID range info for horizontal sync\n");
Monitor->hsync[Monitor->nHsync].lo =
DDC->det_mon[i].section.ranges.min_h;
Monitor->hsync[Monitor->nHsync].hi =
DDC->det_mon[i].section.ranges.max_h;
Monitor->nHsync++;
} else {
xf86DrvMsg(scrnIndex, X_INFO,
"Using hsync ranges from config file\n");
}
if (!have_vrefresh) {
if (!Monitor->nVrefresh)
xf86DrvMsg(scrnIndex, X_INFO,
"Using EDID range info for vertical refresh\n");
Monitor->vrefresh[Monitor->nVrefresh].lo =
DDC->det_mon[i].section.ranges.min_v;
Monitor->vrefresh[Monitor->nVrefresh].hi =
DDC->det_mon[i].section.ranges.max_v;
Monitor->nVrefresh++;
} else {
xf86DrvMsg(scrnIndex, X_INFO,
"Using vrefresh ranges from config file\n");
}
clock = DDC->det_mon[i].section.ranges.max_clock * 1000;
if (clock > Monitor->maxPixClock)
Monitor->maxPixClock = clock;
break;
default:
break;
}
}
if (Modes) {
/* Print Modes */
xf86DrvMsg(scrnIndex, X_INFO, "Printing DDC gathered Modelines:\n");
Mode = Modes;
while (Mode) {
xf86PrintModeline(scrnIndex, Mode);
Mode = Mode->next;
}
/* Do we still need ranges to be filled in? */
if (!Monitor->nHsync || !Monitor->nVrefresh)
DDCGuessRangesFromModes(scrnIndex, Monitor, Modes);
/* look for last Mode */
Mode = Modes;
while (Mode->next)
Mode = Mode->next;
/* add to MonPtr */
if (Monitor->Modes) {
Monitor->Last->next = Modes;
Modes->prev = Monitor->Last;
Monitor->Last = Mode;
} else {
Monitor->Modes = Modes;
Monitor->Last = Mode;
}
}
}

View File

@ -304,16 +304,18 @@ get_detailed_timing_section(Uchar *c, struct detailed_timings *r)
r->misc = MISC;
}
#define MAX_EDID_MINOR 3
static Bool
validate_version(int scrnIndex, struct edid_version *r)
{
if (r->version != 1)
return FALSE;
if (r->revision > 3) {
xf86DrvMsg(scrnIndex, X_ERROR,"EDID Version 1.%i not yet supported\n",
r->revision);
return FALSE;
}
if (r->revision > MAX_EDID_MINOR)
xf86DrvMsg(scrnIndex, X_WARNING,
"Assuming version 1.%d is compatible with 1.%d\n",
r->revision, MAX_EDID_MINOR);
return TRUE;
}

View File

@ -59,6 +59,8 @@ extern void xf86print_vdif(
xf86vdifPtr v
);
DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
#endif

View File

@ -11,7 +11,7 @@ if XV
XV_SRCS = xvmod.c xvmodproc.h
endif
AM_CFLAGS = @XORG_CFLAGS@
AM_CFLAGS = @DIX_CFLAGS@ @XORG_CFLAGS@
INCLUDES = @XORG_INCS@ \
-I$(top_srcdir)/afb \
-I$(top_srcdir)/mfb \

View File

@ -57,9 +57,6 @@ static XF86ModuleVersionInfo VersRec =
_X_EXPORT XF86ModuleData type1ModuleData = { &VersRec, type1Setup, NULL };
extern void Type1RegisterFontFileFunctions(void);
#ifdef BUILDCID
extern void CIDRegisterFontFileFunctions(void);
#endif
FontModule type1Module = {
Type1RegisterFontFileFunctions,
@ -67,23 +64,11 @@ FontModule type1Module = {
NULL
};
#ifdef BUILDCID
FontModule CIDModule = {
CIDRegisterFontFileFunctions,
"CID",
NULL
};
#endif
static pointer
type1Setup(pointer module, pointer opts, int *errmaj, int *errmin)
{
type1Module.module = module;
LoadFont(&type1Module);
#ifdef BUILDCID
CIDModule.module = module;
LoadFont(&CIDModule);
#endif
/* Need a non-NULL return */
return (pointer)1;

View File

@ -1,7 +1,7 @@
.\" $XdotOrg: xserver/xorg/hw/xfree86/doc/man/Xorg.man.pre,v 1.3 2005/07/04 18:41:01 ajax Exp $
.TH __xservername__ __appmansuffix__ __vendorversion__
.SH NAME
__xservername__ - X11R6 X server
__xservername__ - X11R7 X server
.SH SYNOPSIS
.B __xservername__
.RI [\fB:\fP display ]
@ -13,30 +13,26 @@ is a full featured X server that was originally designed for UNIX and
UNIX-like operating systems running on Intel x86 hardware. It now runs
on a wider range of hardware and OS platforms.
.PP
This work was derived from
This work was derived by the X.Org Foundation from the XFree86 Project's
.I "XFree86\ 4.4rc2"
by the X.Org Foundation.
The XFree86 4.4rc2 release was originally derived from
release.
The XFree86 release was originally derived from
.I "X386\ 1.2"
by Thomas Roell which was contributed to X11R5 by Snitily Graphics
Consulting Service. The
.B __xservername__
server architecture includes
among many other things a loadable module system derived from code
donated by Metro Link, Inc. The current __xservername__ release is compatible
with X11R6.6.
Consulting Service.
.SH PLATFORMS
.PP
.B __xservername__
operates under a wide range of operating systems and hardware platforms.
The Intel x86 (IA32) architecture is the most widely supported hardware
platform. Other hardware platforms include Compaq Alpha, Intel IA64,
platform. Other hardware platforms include Compaq Alpha, Intel IA64, AMD64,
SPARC and PowerPC. The most widely supported operating systems are the
free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD and
OpenBSD. Commercial UNIX operating systems such as Solaris (x86) and
free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD,
OpenBSD, and Solaris. Commercial UNIX operating systems such as
UnixWare are also supported. Other supported operating systems include
LynxOS, and GNU Hurd. Darwin and Mac OS X are supported with the
XDarwin(1) X server. Win32/Cygwin is supported with the XWin X server.
XDarwin(__appmansuffix__) X server. Win32/Cygwin is supported with the
XWin(__appmansuffix__) X server.
.PP
.SH "NETWORK CONNECTIONS"
.B __xservername__
@ -119,13 +115,14 @@ one way, the highest precedence mechanism is used. The list of mechanisms
is ordered from highest precedence to lowest. Note that not all parameters
can be supplied via all methods. The available command line options
and environment variables (and some defaults) are described here and in
the Xserver(1) manual page. Most configuration file parameters, with
their defaults, are described in the __xconfigfile__(__filemansuffix__) manual
page. Driver and module specific configuration parameters are described
in the relevant driver or module manual page.
the Xserver(__appmansuffix__) manual page. Most configuration file
parameters, with their defaults, are described in the
__xconfigfile__(__filemansuffix__) manual page. Driver and module specific
configuration parameters are described in the relevant driver or module
manual page.
.PP
In addition to the normal server options described in the Xserver(1)
manual page,
In addition to the normal server options described in the
Xserver(__appmansuffix__) manual page,
.B __xservername__
accepts the following command line switches:
.TP 8
@ -385,7 +382,8 @@ options.
When this option is specified, the
.B __xservername__
server scans the PCI bus, and prints out some information about each
device that was detected. See also scanpci(1) and pcitweak(1).
device that was detected. See also scanpci(__appmansuffix__)
and pcitweak(__appmansuffix__).
.TP 8
.BI \-screen " screen-name"
Use the __xconfigfile__(__filemansuffix__) file
@ -426,6 +424,12 @@ Print out the server version, patchlevel, release date, the operating
system/platform it was built on, and whether it includes module loader
support.
.TP 8
.B \-showDefaultModulePath
Print out the default module path the server was compiled with.
.TP 8
.B \-showDefaultLibPath
Print out the path libraries should be installed to.
.TP 8
.BI \-config " file"
Read the server configuration from
.IR file .
@ -502,13 +506,12 @@ for its initial setup.
Refer to the __xconfigfile__(__filemansuffix__) manual page for information
about the format of this file.
.PP
Starting with version 4.4,
.B __xservername__
has a mechanism for automatically generating a built-in configuration
at run-time when no
.B __xconfigfile__
file is present. The current version of this automatic configuration
mechanism works in three ways.
mechanism works in two ways.
.PP
The first is via enhancements that have made many components of the
.B __xconfigfile__
@ -517,14 +520,7 @@ reasonably deduced doesn't need to be specified explicitly, greatly
reducing the amount of built-in configuration information that needs to
be generated at run-time.
.PP
The second is to use an external utility called getconfig(1), when
available, to use meta-configuration information to generate a suitable
configuration for the primary video device. The meta-configuration
information can be updated to allow an existing installation to get the
best out of new hardware or to work around bugs that are found
post-release.
.PP
The third is to have "safe" fallbacks for most configuration information.
The second is to have "safe" fallbacks for most configuration information.
This maximises the likelihood that the
.B __xservername__
server will start up in some usable configuration even when information
@ -580,7 +576,7 @@ Client error message database.
.B __projectroot__/lib/X11/app-defaults/\(**
Client resource specifications.
.TP 30
.B __projectroot__/man/man?/\(**
.B __mandir__/man?/\(**
Manual pages.
.TP 30
.BI /etc/X n .hosts
@ -638,7 +634,7 @@ __xservername__ was originally based on XFree86 4.4rc2.
That was originally based on \fIX386 1.2\fP by Thomas Roell, which
was contributed to the then X Consortium's X11R5 distribution by SGCS.
.PP
__xservername__ is released by the X.org Foundation.
__xservername__ is released by the X.Org Foundation.
.PP
The project that became XFree86 was originally founded in 1992 by
David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat.
@ -679,9 +675,9 @@ Orest Zborowski \fIorestz@eskimo.com\fP
.RE
.PP
__xservername__ source is available from the FTP server
\fI<ftp://ftp.x.org/>\fP, and from the X.org
server \fI<http://www.freedesktop.org/cvs/>\fP. Documentation and other
information can be found from the X.org web site
\fI<ftp://ftp.x.org/>\fP, and from the X.Org
server \fI<http://gitweb.freedesktop.org/>\fP. Documentation and other
information can be found from the X.Org web site
\fI<http://www.x.org/>\fP.
.SH LEGAL

View File

@ -311,7 +311,6 @@ font path elements:
.I __projectroot__/lib/X11/fonts/misc/
.I __projectroot__/lib/X11/fonts/TTF/
.I __projectroot__/lib/X11/fonts/Type1/
.I __projectroot__/lib/X11/fonts/CID/
.I __projectroot__/lib/X11/fonts/75dpi/
.I __projectroot__/lib/X11/fonts/100dpi/
.fi
@ -326,7 +325,6 @@ The recommended font path contains the following font path elements:
.I __projectroot__/lib/X11/fonts/75dpi/:unscaled
.I __projectroot__/lib/X11/fonts/100dpi/:unscaled
.I __projectroot__/lib/X11/fonts/Type1/
.I __projectroot__/lib/X11/fonts/CID/
.I __projectroot__/lib/X11/fonts/Speedo/
.I __projectroot__/lib/X11/fonts/75dpi/
.I __projectroot__/lib/X11/fonts/100dpi/

View File

@ -7,7 +7,7 @@ libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
-I$(top_builddir)/GL/include \
-I@MESA_SOURCE@/include \
-DHAVE_XORG_CONFIG_H \
@DRIPROTO_CFLAGS@ \
@DIX_CFLAGS@ @DRIPROTO_CFLAGS@ \
@LIBDRM_CFLAGS@ \
@GL_CFLAGS@
libdri_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@

View File

@ -84,7 +84,7 @@ static RESTYPE DRIDrawablePrivResType;
static RESTYPE DRIContextPrivResType;
static void DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv);
static drmServerInfo DRIDRMServerInfo;
drmServerInfo DRIDRMServerInfo;
/* Wrapper just like xf86DrvMsg, but
without the verbosity level checking.
@ -176,8 +176,6 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
else
openbusid = NULL;
drmSetServerInfo(&DRIDRMServerInfo);
/* Note that drmOpen will try to load the kernel module, if needed. */
fd = drmOpen(pDRIInfo->drmDriverName, openbusid);
if (fd < 0) {
@ -593,7 +591,7 @@ static void dri_drm_get_perms(gid_t *group, mode_t *mode)
*mode = xf86ConfigDRI.mode;
}
static drmServerInfo DRIDRMServerInfo = {
drmServerInfo DRIDRMServerInfo = {
dri_drm_debug_print,
xf86LoadKernelModule,
dri_drm_get_perms,

View File

@ -39,8 +39,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xf86Module.h"
#include "globals.h"
#include "xf86drm.h"
static MODULESETUPPROTO(driSetup);
drmServerInfo DRIDRMServerInfo;
static XF86ModuleVersionInfo VersRec =
{
"dri",
@ -81,6 +84,9 @@ driSetup(pointer module, pointer opts, int *errmaj, int *errmin)
} else {
if (errmaj) *errmaj = LDR_ONCEONLY;
}
drmSetServerInfo(&DRIDRMServerInfo);
/* Need a non-NULL return value to indicate success */
return 1;
}

View File

@ -386,6 +386,7 @@ ProcXF86DRICreateDrawable(
{
xXF86DRICreateDrawableReply rep;
DrawablePtr pDrawable;
int rc;
REQUEST(xXF86DRICreateDrawableReq);
REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq);
@ -398,12 +399,10 @@ ProcXF86DRICreateDrawable(
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable(
(Drawable)stuff->drawable,
client,
SecurityReadAccess))) {
return BadValue;
}
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success)
return rc;
if (!DRICreateDrawable( screenInfo.screens[stuff->screen],
(Drawable)stuff->drawable,
@ -424,17 +423,17 @@ ProcXF86DRIDestroyDrawable(
REQUEST(xXF86DRIDestroyDrawableReq);
DrawablePtr pDrawable;
REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq);
int rc;
if (stuff->screen >= screenInfo.numScreens) {
client->errorValue = stuff->screen;
return BadValue;
}
if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable(
(Drawable)stuff->drawable,
client,
SecurityReadAccess))) {
return BadValue;
}
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success)
return rc;
if (!DRIDestroyDrawable( screenInfo.screens[stuff->screen],
(Drawable)stuff->drawable,
@ -455,7 +454,7 @@ ProcXF86DRIGetDrawableInfo(
int X, Y, W, H;
drm_clip_rect_t * pClipRects;
drm_clip_rect_t * pBackClipRects;
int backX, backY;
int backX, backY, rc;
REQUEST(xXF86DRIGetDrawableInfoReq);
REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
@ -468,12 +467,10 @@ ProcXF86DRIGetDrawableInfo(
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable(
(Drawable)stuff->drawable,
client,
SecurityReadAccess))) {
return BadValue;
}
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success)
return rc;
if (!DRIGetDrawableInfo( screenInfo.screens[stuff->screen],
pDrawable,

View File

@ -6,7 +6,7 @@ noinst_LIBRARIES = libdummy-nonserver.a
INCLUDES = $(XORG_INCS)
AM_CFLAGS = $(XORG_CFLAGS)
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
if NEED_STRLCAT
STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c

View File

@ -7,7 +7,7 @@ INCLUDES = \
-I$(srcdir)/../../../exa \
-I$(srcdir)/../../../miext/cw
AM_CFLAGS = $(XORG_CFLAGS)
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
libexa_la_SOURCES = \
examodule.c

Some files were not shown because too many files have changed in this diff Show More