Merge branch 'origin' into pci-rework

Conflicts:

	hw/xfree86/int10/generic.c
This commit is contained in:
Ian Romanick 2007-01-09 15:27:34 -08:00
commit da09964a93
117 changed files with 3042 additions and 2268 deletions

56
GL/glx/glxbyteorder.h Normal file
View File

@ -0,0 +1,56 @@
/*
* (C) Copyright IBM Corporation 2006, 2007
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, 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 COPYRIGHT HOLDERS, THE AUTHORS, AND/OR THEIR SUPPLIERS 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.
*/
/**
* \file glxbyteorder.h
* Platform glue for handling byte-ordering issues in GLX protocol.
*
* \author Ian Romanick <idr@us.ibm.com>
*/
#if !defined(__GLXBYTEORDER_H__)
#define __GLXBYTEORDER_H__
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#if HAVE_BYTESWAP_H
#include <byteswap.h>
#elif defined(USE_SYS_ENDIAN_H)
#include <sys/endian.h>
#else
#define bswap_16(value) \
((((value) & 0xff) << 8) | ((value) >> 8))
#define bswap_32(value) \
(((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \
(uint32_t)bswap_16((uint16_t)((value) >> 16)))
#define bswap_64(value) \
(((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \
<< 32) | \
(uint64_t)bswap_32((uint32_t)((value) >> 32)))
#endif
#endif /* !defined(__GLXBYTEORDER_H__) */

View File

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

View File

@ -33,6 +33,7 @@
#include "indirect_size_get.h" #include "indirect_size_get.h"
#include "indirect_dispatch.h" #include "indirect_dispatch.h"
#include "glxserver.h" #include "glxserver.h"
#include "glxbyteorder.h"
#include "indirect_util.h" #include "indirect_util.h"
#include "singlesize.h" #include "singlesize.h"
#include "glapitable.h" #include "glapitable.h"

View File

@ -28,24 +28,12 @@
#include <X11/Xmd.h> #include <X11/Xmd.h>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glxproto.h> #include <GL/glxproto.h>
#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>
#define bswap_16 __swap16
#define bswap_32 __swap32
#define bswap_64 __swap64
#else
#include <sys/endian.h>
#define bswap_16 bswap16
#define bswap_32 bswap32
#define bswap_64 bswap64
#endif
#include <inttypes.h> #include <inttypes.h>
#include "indirect_size.h" #include "indirect_size.h"
#include "indirect_size_get.h" #include "indirect_size_get.h"
#include "indirect_dispatch.h" #include "indirect_dispatch.h"
#include "glxserver.h" #include "glxserver.h"
#include "glxbyteorder.h"
#include "indirect_util.h" #include "indirect_util.h"
#include "singlesize.h" #include "singlesize.h"
#include "glapitable.h" #include "glapitable.h"

View File

@ -35,6 +35,7 @@
#endif #endif
#include "glxserver.h" #include "glxserver.h"
#include "glxbyteorder.h"
#include "glxext.h" #include "glxext.h"
#include "singlesize.h" #include "singlesize.h"
#include "unpack.h" #include "unpack.h"
@ -46,20 +47,6 @@
#include "dispatch.h" #include "dispatch.h"
#include "glapioffsets.h" #include "glapioffsets.h"
#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>
#define bswap_16 __swap16
#define bswap_32 __swap32
#define bswap_64 __swap64
#else
#include <sys/endian.h>
#define bswap_16 bswap16
#define bswap_32 bswap32
#define bswap_64 bswap64
#endif
static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc, static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc,
unsigned get_programiv_offset, unsigned get_program_string_offset, unsigned get_programiv_offset, unsigned get_program_string_offset,
Bool do_swap); Bool do_swap);

File diff suppressed because it is too large Load Diff

View File

@ -83,14 +83,15 @@ extern PURE HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte *pc, Bool
extern PURE HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexImage3DReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXTexImage3DReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXLoadProgramNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXLoadProgramNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap);
@ -109,11 +110,10 @@ extern PURE HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte *pc, Bool swa
extern PURE HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXPointParameterivNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXPointParameterivNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte *pc, Bool swap);
extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap);
# undef HIDDEN # undef HIDDEN
# undef PURE # undef PURE

View File

@ -29,6 +29,7 @@
#endif #endif
#include "glxserver.h" #include "glxserver.h"
#include "glxbyteorder.h"
#include "glxext.h" #include "glxext.h"
#include "singlesize.h" #include "singlesize.h"
#include "unpack.h" #include "unpack.h"
@ -39,20 +40,6 @@
#include "glthread.h" #include "glthread.h"
#include "dispatch.h" #include "dispatch.h"
#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>
#define bswap_16 __swap16
#define bswap_32 __swap32
#define bswap_64 __swap64
#else
#include <sys/endian.h>
#define bswap_16 bswap16
#define bswap_32 bswap32
#define bswap_64 bswap64
#endif
int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte *pc) int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;

View File

@ -23,29 +23,21 @@
* SOFTWARE. * SOFTWARE.
*/ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h> #include <string.h>
#include <X11/Xmd.h> #include <X11/Xmd.h>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glxproto.h> #include <GL/glxproto.h>
#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>
#define bswap_16 __swap16
#define bswap_32 __swap32
#define bswap_64 __swap64
#else
#include <sys/endian.h>
#define bswap_16 bswap16
#define bswap_32 bswap32
#define bswap_64 bswap64
#endif
#include <inttypes.h> #include <inttypes.h>
#include "indirect_size.h" #include "indirect_size.h"
#include "indirect_size_get.h" #include "indirect_size_get.h"
#include "indirect_dispatch.h" #include "indirect_dispatch.h"
#include "glxserver.h" #include "glxserver.h"
#include "glxbyteorder.h"
#include "singlesize.h" #include "singlesize.h"
#include "glapitable.h" #include "glapitable.h"
#include "glapi.h" #include "glapi.h"

View File

@ -39,20 +39,7 @@
#include "glthread.h" #include "glthread.h"
#include "dispatch.h" #include "dispatch.h"
#include "glapioffsets.h" #include "glapioffsets.h"
#include "glxbyteorder.h"
#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>
#define bswap_16 __swap16
#define bswap_32 __swap32
#define bswap_64 __swap64
#else
#include <sys/endian.h>
#define bswap_16 bswap16
#define bswap_32 bswap32
#define bswap_64 bswap64
#endif
static int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap); static int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap);

View File

@ -78,6 +78,7 @@ typedef struct __GLXMESAdrawable __GLXMESAdrawable;
struct __GLXMESAscreen { struct __GLXMESAscreen {
__GLXscreen base; __GLXscreen base;
int index; int index;
int num_vis;
XMesaVisual *xm_vis; XMesaVisual *xm_vis;
}; };
@ -280,7 +281,7 @@ __glXMesaScreenDestroy(__GLXscreen *screen)
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen; __GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
int i; int i;
for (i = 0; i < screen->numVisuals; i++) { for (i = 0; i < mesaScreen->num_vis; i++) {
if (mesaScreen->xm_vis[i]) if (mesaScreen->xm_vis[i])
XMesaDestroyVisual(mesaScreen->xm_vis[i]); XMesaDestroyVisual(mesaScreen->xm_vis[i]);
} }
@ -389,6 +390,7 @@ static void init_screen_visuals(__GLXMESAscreen *screen)
xfree(used); xfree(used);
screen->num_vis = pScreen->numVisuals;
screen->xm_vis = pXMesaVisual; screen->xm_vis = pXMesaVisual;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -600,7 +600,7 @@ ProcSecurityRevokeAuthorization(
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq); REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client, pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client,
stuff->authId, SecurityAuthorizationResType, SecurityDestroyAccess); stuff->authId, SecurityAuthorizationResType, DixDestroyAccess);
if (!pAuth) if (!pAuth)
return SecurityErrorBase + XSecurityBadAuthorization; return SecurityErrorBase + XSecurityBadAuthorization;
@ -966,7 +966,7 @@ CALLBACK(SecurityCheckResourceIDAccess)
int cid, reqtype; int cid, reqtype;
if (TRUSTLEVEL(client) == XSecurityClientTrusted || if (TRUSTLEVEL(client) == XSecurityClientTrusted ||
SecurityUnknownAccess == access_mode) DixUnknownAccess == access_mode)
return; /* for compatibility, we have to allow access */ return; /* for compatibility, we have to allow access */
cid = CLIENT_ID(id); cid = CLIENT_ID(id);
@ -1217,7 +1217,7 @@ CALLBACK(SecurityCheckHostlistAccess)
if (TRUSTLEVEL(rec->client) != XSecurityClientTrusted) if (TRUSTLEVEL(rec->client) != XSecurityClientTrusted)
{ {
rec->rval = FALSE; rec->rval = FALSE;
if (rec->access_mode == SecurityWriteAccess) if (rec->access_mode == DixWriteAccess)
SecurityAudit("client %d attempted to change host access\n", SecurityAudit("client %d attempted to change host access\n",
rec->client->index); rec->client->index);
else else
@ -1798,11 +1798,11 @@ CALLBACK(SecurityCheckPropertyAccess)
* executed a continue, which will skip the follwing code. * executed a continue, which will skip the follwing code.
*/ */
action = XaceAllowOperation; action = XaceAllowOperation;
if (access_mode & SecurityReadAccess) if (access_mode & DixReadAccess)
action = max(action, pacl->readAction); action = max(action, pacl->readAction);
if (access_mode & SecurityWriteAccess) if (access_mode & DixWriteAccess)
action = max(action, pacl->writeAction); action = max(action, pacl->writeAction);
if (access_mode & SecurityDestroyAccess) if (access_mode & DixDestroyAccess)
action = max(action, pacl->destroyAction); action = max(action, pacl->destroyAction);
break; break;
} /* end for each pacl */ } /* end for each pacl */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -98,8 +98,7 @@ SProcXGetSelectedExtensionEvents(register ClientPtr client)
int int
ProcXGetSelectedExtensionEvents(register ClientPtr client) ProcXGetSelectedExtensionEvents(register ClientPtr client)
{ {
int i; int i, rc, total_length = 0;
int total_length = 0;
xGetSelectedExtensionEventsReply rep; xGetSelectedExtensionEventsReply rep;
WindowPtr pWin; WindowPtr pWin;
XEventClass *buf = NULL; XEventClass *buf = NULL;
@ -118,9 +117,10 @@ ProcXGetSelectedExtensionEvents(register ClientPtr client)
rep.this_client_count = 0; rep.this_client_count = 0;
rep.all_clients_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, SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0,
BadWindow); rc);
return Success; return Success;
} }

View File

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

View File

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

View File

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

View File

@ -93,10 +93,10 @@ typedef struct _compPixmapVisit {
static Bool static Bool
compRepaintBorder (ClientPtr pClient, pointer closure) 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; RegionRec exposed;
REGION_NULL(pScreen, &exposed); REGION_NULL(pScreen, &exposed);

View File

@ -29,6 +29,7 @@
#define DBUS_API_SUBJECT_TO_CHANGE #define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/dbus.h> #include <dbus/dbus.h>
#include <string.h> #include <string.h>
#include <sys/select.h>
#include <X11/X.h> #include <X11/X.h>

View File

@ -99,6 +99,64 @@ fi
AC_TYPE_PID_T AC_TYPE_PID_T
# Checks for headers/macros for byte swapping
# Known variants:
# <byteswap.h> bswap_16, bswap_32, bswap_64 (glibc)
# <sys/endian.h> __swap16, __swap32, __swap64 (OpenBSD)
# <sys/endian.h> bswap16, bswap32, bswap64 (other BSD's)
# and a fallback to local macros if none of the above are found
# if <byteswap.h> is found, assume it's the correct version
AC_CHECK_HEADERS([byteswap.h])
# if <sys/endian.h> is found, have to check which version
AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"])
if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then
AC_MSG_CHECKING([for __swap16 variant of <sys/endian.h> byteswapping macros])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <sys/endian.h>
], [
int a = 1, b;
b = __swap16(a);
])
], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no'])
AC_MSG_RESULT([$SYS_ENDIAN__SWAP])
AC_MSG_CHECKING([for bswap_16 variant of <sys/endian.h> byteswapping macros])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <sys/endian.h>
], [
int a = 1, b;
b = bswap_16(a);
])
], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no'])
AC_MSG_RESULT([$SYS_ENDIAN_BSWAP])
if test "$SYS_ENDIAN_BSWAP" = "yes" ; then
USE_SYS_ENDIAN_H=yes
BSWAP=bswap_
else
if test "$SYS_ENDIAN__SWAP" = "yes" ; then
USE_SYS_ENDIAN_H=yes
BSWAP=__swap
else
USE_SYS_ENDIAN_H=no
fi
fi
if test "$USE_SYS_ENDIAN_H" = "yes" ; then
AC_DEFINE([USE_SYS_ENDIAN_H], 1,
[Define to use byteswap macros from <sys/endian.h>])
AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16,
[Define to 16-bit byteswap macro])
AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32,
[Define to 32-bit byteswap macro])
AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64,
[Define to 64-bit byteswap macro])
fi
fi
dnl Checks for library functions. dnl Checks for library functions.
AC_FUNC_VPRINTF AC_FUNC_VPRINTF
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \ AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
@ -295,6 +353,9 @@ case $host_os in
DRI=yes DRI=yes
KDRIVE_HW=yes KDRIVE_HW=yes
;; ;;
*solaris*)
PKG_CHECK_EXISTS(libdrm, DRI=yes, DRI=no)
;;
esac esac
AM_CONDITIONAL(KDRIVE_HW, test "x$KDRIVE_HW" = xyes) AM_CONDITIONAL(KDRIVE_HW, test "x$KDRIVE_HW" = xyes)
@ -305,6 +366,8 @@ if test "x$use_x86_asm" = xyes && test "x$GCC" = xyes ; then
#error Not supported #error Not supported
#endif #endif
], mmx_capable=yes, mmx_capable=no) ], mmx_capable=yes, mmx_capable=no)
else
mmx_capable=no
fi fi
AC_MSG_RESULT([$mmx_capable]) AC_MSG_RESULT([$mmx_capable])
AM_CONDITIONAL(MMX_CAPABLE, [test "x$mmx_capable" = xyes]) AM_CONDITIONAL(MMX_CAPABLE, [test "x$mmx_capable" = xyes])
@ -545,7 +608,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la' XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
dnl Core modules for most extensions, et al. dnl Core modules for most extensions, et al.
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_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto xproto xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4] [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc" REQUIRED_LIBS="xfont xau fontenc"
if test "x$DBUS" = xauto; then if test "x$DBUS" = xauto; then
@ -616,7 +679,7 @@ fi
if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then
PKG_CHECK_MODULES([XLIB], [x11]) PKG_CHECK_MODULES([XLIB], [x11])
PKG_CHECK_MODULES([GL], [glproto >= 1.4.7]) PKG_CHECK_MODULES([GL], [glproto >= 1.4.8])
AC_SUBST(XLIB_CFLAGS) AC_SUBST(XLIB_CFLAGS)
AC_DEFINE(GLXEXT, 1, [Build GLX extension]) AC_DEFINE(GLXEXT, 1, [Build GLX extension])
GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la' GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la'
@ -1007,7 +1070,7 @@ dnl ---------------------------------------------------------------------------
dnl DMX DDX dnl DMX DDX
AC_MSG_CHECKING([whether to build Xdmx 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 if test "x$DMX" = xauto; then
DMX="$have_dmx" DMX="$have_dmx"
fi fi

View File

@ -173,13 +173,17 @@ ProcDamageCreate (ClientPtr client)
DamageExtPtr pDamageExt; DamageExtPtr pDamageExt;
DamageReportLevel level; DamageReportLevel level;
RegionPtr pRegion; RegionPtr pRegion;
int rc;
REQUEST(xDamageCreateReq); REQUEST(xDamageCreateReq);
REQUEST_SIZE_MATCH(xDamageCreateReq); REQUEST_SIZE_MATCH(xDamageCreateReq);
LEGAL_NEW_RESOURCE(stuff->damage, client); LEGAL_NEW_RESOURCE(stuff->damage, client);
SECURITY_VERIFY_DRAWABLE (pDrawable, stuff->drawable, client, rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
SecurityReadAccess); DixReadAccess);
if (rc != Success)
return rc;
switch (stuff->level) { switch (stuff->level) {
case XDamageReportRawRectangles: case XDamageReportRawRectangles:
level = DamageReportRawRegion; level = DamageReportRawRegion;
@ -237,7 +241,7 @@ ProcDamageDestroy (ClientPtr client)
DamageExtPtr pDamageExt; DamageExtPtr pDamageExt;
REQUEST_SIZE_MATCH(xDamageDestroyReq); REQUEST_SIZE_MATCH(xDamageDestroyReq);
VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, SecurityWriteAccess); VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess);
FreeResource (stuff->damage, RT_NONE); FreeResource (stuff->damage, RT_NONE);
return (client->noClientException); return (client->noClientException);
} }
@ -251,9 +255,9 @@ ProcDamageSubtract (ClientPtr client)
RegionPtr pParts; RegionPtr pParts;
REQUEST_SIZE_MATCH(xDamageSubtractReq); REQUEST_SIZE_MATCH(xDamageSubtractReq);
VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, SecurityWriteAccess); VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess);
VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, SecurityWriteAccess); VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess);
VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, SecurityWriteAccess); VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess);
if (pDamageExt->level != DamageReportRawRegion) if (pDamageExt->level != DamageReportRawRegion)
{ {
@ -275,10 +279,35 @@ ProcDamageSubtract (ClientPtr client)
return (client->noClientException); return (client->noClientException);
} }
static int
ProcDamagePost (ClientPtr client)
{
REQUEST(xDamagePostReq);
DrawablePtr pDrawable;
RegionPtr pRegion;
int rc;
REQUEST_SIZE_MATCH(xDamagePostReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success)
return rc;
/* The region is relative to the drawable origin, so translate it out to
* screen coordinates like damage expects.
*/
REGION_TRANSLATE(pScreen, pRegion, pDrawable->x, pDrawable->y);
DamageDamageRegion(pDrawable, pRegion);
REGION_TRANSLATE(pScreen, pRegion, -pDrawable->x, -pDrawable->y);
return (client->noClientException);
}
/* Major version controls available requests */ /* Major version controls available requests */
static const int version_requests[] = { static const int version_requests[] = {
X_DamageQueryVersion, /* before client sends QueryVersion */ X_DamageQueryVersion, /* before client sends QueryVersion */
X_DamageSubtract, /* Version 1 */ X_DamagePost, /* Version 1 */
}; };
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
@ -289,6 +318,8 @@ int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = {
ProcDamageCreate, ProcDamageCreate,
ProcDamageDestroy, ProcDamageDestroy,
ProcDamageSubtract, ProcDamageSubtract,
/*************** Version 1.1 ****************/
ProcDamagePost,
}; };
@ -357,12 +388,27 @@ SProcDamageSubtract (ClientPtr client)
return (*ProcDamageVector[stuff->damageReqType]) (client); return (*ProcDamageVector[stuff->damageReqType]) (client);
} }
static int
SProcDamagePost (ClientPtr client)
{
register int n;
REQUEST(xDamagePostReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xDamageSubtractReq);
swapl (&stuff->drawable, n);
swapl (&stuff->region, n);
return (*ProcDamageVector[stuff->damageReqType]) (client);
}
int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = { int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = {
/*************** Version 1 ******************/ /*************** Version 1 ******************/
SProcDamageQueryVersion, SProcDamageQueryVersion,
SProcDamageCreate, SProcDamageCreate,
SProcDamageDestroy, SProcDamageDestroy,
SProcDamageSubtract, SProcDamageSubtract,
/*************** Version 1.1 ****************/
SProcDamagePost,
}; };
static int static int

View File

@ -39,6 +39,11 @@
#endif #endif
#include <string.h> #include <string.h>
#if HAVE_STDINT_H
#include <stdint.h>
#elif !defined(UINT32_MAX)
#define UINT32_MAX 0xffffffffU
#endif
#include <X11/X.h> #include <X11/X.h>
#include <X11/Xproto.h> #include <X11/Xproto.h>
@ -405,11 +410,9 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq); REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
/* The window must be valid. */ /* The window must be valid. */
if (!(pWin = SecurityLookupWindow(stuff->window, client, status = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
SecurityWriteAccess))) if (status != Success)
{ return status;
return(BadWindow);
}
/* The window must be InputOutput. */ /* The window must be InputOutput. */
if (pWin->drawable.class != InputOutput) if (pWin->drawable.class != InputOutput)
@ -633,9 +636,9 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
/* Buffer name must be valid */ /* Buffer name must be valid */
if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client, if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client,
stuff->buffer, dbeWindowPrivResType, SecurityDestroyAccess)) || stuff->buffer, dbeWindowPrivResType, DixDestroyAccess)) ||
!(SecurityLookupIDByType(client, stuff->buffer, dbeDrawableResType, !(SecurityLookupIDByType(client, stuff->buffer, dbeDrawableResType,
SecurityDestroyAccess))) DixDestroyAccess)))
{ {
client->errorValue = stuff->buffer; client->errorValue = stuff->buffer;
return(dbeErrorBase + DbeBadBuffer); return(dbeErrorBase + DbeBadBuffer);
@ -713,11 +716,14 @@ ProcDbeSwapBuffers(ClientPtr client)
return(Success); return(Success);
} }
if (nStuff > UINT32_MAX / sizeof(DbeSwapInfoRec))
return BadAlloc;
/* Get to the swap info appended to the end of the request. */ /* Get to the swap info appended to the end of the request. */
dbeSwapInfo = (xDbeSwapInfo *)&stuff[1]; dbeSwapInfo = (xDbeSwapInfo *)&stuff[1];
/* Allocate array to record swap information. */ /* Allocate array to record swap information. */
swapInfo = (DbeSwapInfoPtr)ALLOCATE_LOCAL(nStuff * sizeof(DbeSwapInfoRec)); swapInfo = (DbeSwapInfoPtr)Xalloc(nStuff * sizeof(DbeSwapInfoRec));
if (swapInfo == NULL) if (swapInfo == NULL)
{ {
return(BadAlloc); return(BadAlloc);
@ -729,17 +735,17 @@ ProcDbeSwapBuffers(ClientPtr client)
/* Check all windows to swap. */ /* Check all windows to swap. */
/* Each window must be a valid window - BadWindow. */ /* Each window must be a valid window - BadWindow. */
if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client, error = dixLookupWindow(&pWin, dbeSwapInfo[i].window, client,
SecurityWriteAccess))) DixWriteAccess);
{ if (error != Success) {
DEALLOCATE_LOCAL(swapInfo); Xfree(swapInfo);
return(BadWindow); return error;
} }
/* Each window must be double-buffered - BadMatch. */ /* Each window must be double-buffered - BadMatch. */
if (DBE_WINDOW_PRIV(pWin) == NULL) if (DBE_WINDOW_PRIV(pWin) == NULL)
{ {
DEALLOCATE_LOCAL(swapInfo); Xfree(swapInfo);
return(BadMatch); return(BadMatch);
} }
@ -748,7 +754,7 @@ ProcDbeSwapBuffers(ClientPtr client)
{ {
if (dbeSwapInfo[i].window == dbeSwapInfo[j].window) if (dbeSwapInfo[i].window == dbeSwapInfo[j].window)
{ {
DEALLOCATE_LOCAL(swapInfo); Xfree(swapInfo);
return(BadMatch); return(BadMatch);
} }
} }
@ -759,7 +765,7 @@ ProcDbeSwapBuffers(ClientPtr client)
(dbeSwapInfo[i].swapAction != XdbeUntouched ) && (dbeSwapInfo[i].swapAction != XdbeUntouched ) &&
(dbeSwapInfo[i].swapAction != XdbeCopied )) (dbeSwapInfo[i].swapAction != XdbeCopied ))
{ {
DEALLOCATE_LOCAL(swapInfo); Xfree(swapInfo);
return(BadValue); return(BadValue);
} }
@ -789,12 +795,12 @@ ProcDbeSwapBuffers(ClientPtr client)
error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo); error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo);
if (error != Success) if (error != Success)
{ {
DEALLOCATE_LOCAL(swapInfo); Xfree(swapInfo);
return(error); return(error);
} }
} }
DEALLOCATE_LOCAL(swapInfo); Xfree(swapInfo);
return(Success); return(Success);
} /* ProcDbeSwapBuffers() */ } /* ProcDbeSwapBuffers() */
@ -867,7 +873,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
xDbeGetVisualInfoReply rep; xDbeGetVisualInfoReply rep;
Drawable *drawables; Drawable *drawables;
DrawablePtr *pDrawables = NULL; 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 count; /* number of visual infos in reply */
register int length; /* length of reply */ register int length; /* length of reply */
ScreenPtr pScreen; ScreenPtr pScreen;
@ -876,10 +882,12 @@ ProcDbeGetVisualInfo(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq); REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq);
if (stuff->n > UINT32_MAX / sizeof(DrawablePtr))
return BadAlloc;
/* Make sure any specified drawables are valid. */ /* Make sure any specified drawables are valid. */
if (stuff->n != 0) if (stuff->n != 0)
{ {
if (!(pDrawables = (DrawablePtr *)ALLOCATE_LOCAL(stuff->n * if (!(pDrawables = (DrawablePtr *)Xalloc(stuff->n *
sizeof(DrawablePtr)))) sizeof(DrawablePtr))))
{ {
return(BadAlloc); return(BadAlloc);
@ -889,11 +897,11 @@ ProcDbeGetVisualInfo(ClientPtr client)
for (i = 0; i < stuff->n; i++) for (i = 0; i < stuff->n; i++)
{ {
if (!(pDrawables[i] = (DrawablePtr)SecurityLookupDrawable( rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0,
drawables[i], client, SecurityReadAccess))) DixReadAccess);
{ if (rc != Success) {
DEALLOCATE_LOCAL(pDrawables); Xfree(pDrawables);
return(BadDrawable); return rc;
} }
} }
} }
@ -904,7 +912,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
{ {
if (pDrawables) if (pDrawables)
{ {
DEALLOCATE_LOCAL(pDrawables); Xfree(pDrawables);
} }
return(BadAlloc); return(BadAlloc);
@ -931,7 +939,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
/* Free pDrawables if we needed to allocate it above. */ /* Free pDrawables if we needed to allocate it above. */
if (pDrawables) if (pDrawables)
{ {
DEALLOCATE_LOCAL(pDrawables); Xfree(pDrawables);
} }
return(BadAlloc); return(BadAlloc);
@ -1012,7 +1020,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
if (pDrawables) if (pDrawables)
{ {
DEALLOCATE_LOCAL(pDrawables); Xfree(pDrawables);
} }
return(client->noClientException); return(client->noClientException);
@ -1047,7 +1055,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq); REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client, if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client,
stuff->buffer, dbeWindowPrivResType, SecurityReadAccess))) stuff->buffer, dbeWindowPrivResType, DixReadAccess)))
{ {
rep.attributes = None; rep.attributes = None;
} }

View File

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

View File

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

View File

@ -1840,16 +1840,16 @@ ProcGetMotionEvents(ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
xTimecoord * coords = (xTimecoord *) NULL; xTimecoord * coords = (xTimecoord *) NULL;
xGetMotionEventsReply rep; xGetMotionEventsReply rep;
int i, count, xmin, xmax, ymin, ymax; int i, count, xmin, xmax, ymin, ymax, rc;
unsigned long nEvents; unsigned long nEvents;
DeviceIntPtr mouse = inputInfo.pointer; DeviceIntPtr mouse = inputInfo.pointer;
TimeStamp start, stop; TimeStamp start, stop;
REQUEST(xGetMotionEventsReq); REQUEST(xGetMotionEventsReq);
REQUEST_SIZE_MATCH(xGetMotionEventsReq); REQUEST_SIZE_MATCH(xGetMotionEventsReq);
pWin = SecurityLookupWindow(stuff->window, client, TRUE); rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
if (mouse->valuator->motionHintWindow) if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client); MaybeStopHint(mouse, client);
rep.type = X_Reply; rep.type = X_Reply;

View File

@ -554,17 +554,16 @@ ProcBadRequest(ClientPtr client)
int int
ProcCreateWindow(ClientPtr client) ProcCreateWindow(ClientPtr client)
{ {
register WindowPtr pParent, pWin; WindowPtr pParent, pWin;
REQUEST(xCreateWindowReq); REQUEST(xCreateWindowReq);
int result; int result, len, rc;
int len;
REQUEST_AT_LEAST_SIZE(xCreateWindowReq); REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
LEGAL_NEW_RESOURCE(stuff->wid, client); LEGAL_NEW_RESOURCE(stuff->wid, client);
if (!(pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, rc = dixLookupWindow(&pParent, stuff->parent, client, DixWriteAccess);
SecurityWriteAccess))) if (rc != Success)
return BadWindow; return rc;
len = client->req_len - (sizeof(xCreateWindowReq) >> 2); len = client->req_len - (sizeof(xCreateWindowReq) >> 2);
if (Ones(stuff->mask) != len) if (Ones(stuff->mask) != len)
return BadLength; return BadLength;
@ -597,16 +596,15 @@ ProcCreateWindow(ClientPtr client)
int int
ProcChangeWindowAttributes(register ClientPtr client) ProcChangeWindowAttributes(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xChangeWindowAttributesReq); REQUEST(xChangeWindowAttributesReq);
register int result; register int result;
int len; int len, rc;
REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
SecurityWriteAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2); len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2);
if (len != Ones(stuff->valueMask)) if (len != Ones(stuff->valueMask))
return BadLength; return BadLength;
@ -623,15 +621,15 @@ ProcChangeWindowAttributes(register ClientPtr client)
int int
ProcGetWindowAttributes(register ClientPtr client) ProcGetWindowAttributes(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
xGetWindowAttributesReply wa; xGetWindowAttributesReply wa;
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
GetWindowAttributes(pWin, client, &wa); GetWindowAttributes(pWin, client, &wa);
WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa); WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
return(client->noClientException); return(client->noClientException);
@ -640,14 +638,14 @@ ProcGetWindowAttributes(register ClientPtr client)
int int
ProcDestroyWindow(register ClientPtr client) ProcDestroyWindow(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess);
SecurityDestroyAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
if (pWin->parent) if (pWin->parent)
FreeResource(stuff->id, RT_NONE); FreeResource(stuff->id, RT_NONE);
return(client->noClientException); return(client->noClientException);
@ -656,14 +654,14 @@ ProcDestroyWindow(register ClientPtr client)
int int
ProcDestroySubwindows(register ClientPtr client) ProcDestroySubwindows(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess);
SecurityDestroyAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
DestroySubwindows(pWin, client); DestroySubwindows(pWin, client);
return(client->noClientException); return(client->noClientException);
} }
@ -671,15 +669,14 @@ ProcDestroySubwindows(register ClientPtr client)
int int
ProcChangeSaveSet(register ClientPtr client) ProcChangeSaveSet(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xChangeSaveSetReq); REQUEST(xChangeSaveSetReq);
register int result; register int result, rc;
REQUEST_SIZE_MATCH(xChangeSaveSetReq); REQUEST_SIZE_MATCH(xChangeSaveSetReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
return BadMatch; return BadMatch;
if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete)) if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete))
@ -700,19 +697,17 @@ ProcChangeSaveSet(register ClientPtr client)
int int
ProcReparentWindow(register ClientPtr client) ProcReparentWindow(register ClientPtr client)
{ {
register WindowPtr pWin, pParent; WindowPtr pWin, pParent;
REQUEST(xReparentWindowReq); REQUEST(xReparentWindowReq);
register int result; register int result, rc;
REQUEST_SIZE_MATCH(xReparentWindowReq); REQUEST_SIZE_MATCH(xReparentWindowReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
SecurityWriteAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow); rc = dixLookupWindow(&pParent, stuff->parent, client, DixWriteAccess);
pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, if (rc != Success)
SecurityWriteAccess); return rc;
if (!pParent)
return(BadWindow);
if (SAME_SCREENS(pWin->drawable, pParent->drawable)) if (SAME_SCREENS(pWin->drawable, pParent->drawable))
{ {
if ((pWin->backgroundState == ParentRelative) && if ((pWin->backgroundState == ParentRelative) &&
@ -735,14 +730,14 @@ ProcReparentWindow(register ClientPtr client)
int int
ProcMapWindow(register ClientPtr client) ProcMapWindow(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
MapWindow(pWin, client); MapWindow(pWin, client);
/* update cache to say it is mapped */ /* update cache to say it is mapped */
return(client->noClientException); return(client->noClientException);
@ -751,14 +746,14 @@ ProcMapWindow(register ClientPtr client)
int int
ProcMapSubwindows(register ClientPtr client) ProcMapSubwindows(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
MapSubwindows(pWin, client); MapSubwindows(pWin, client);
/* update cache to say it is mapped */ /* update cache to say it is mapped */
return(client->noClientException); return(client->noClientException);
@ -767,14 +762,14 @@ ProcMapSubwindows(register ClientPtr client)
int int
ProcUnmapWindow(register ClientPtr client) ProcUnmapWindow(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
UnmapWindow(pWin, FALSE); UnmapWindow(pWin, FALSE);
/* update cache to say it is mapped */ /* update cache to say it is mapped */
return(client->noClientException); return(client->noClientException);
@ -783,14 +778,14 @@ ProcUnmapWindow(register ClientPtr client)
int int
ProcUnmapSubwindows(register ClientPtr client) ProcUnmapSubwindows(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
UnmapSubwindows(pWin); UnmapSubwindows(pWin);
return(client->noClientException); return(client->noClientException);
} }
@ -798,16 +793,15 @@ ProcUnmapSubwindows(register ClientPtr client)
int int
ProcConfigureWindow(register ClientPtr client) ProcConfigureWindow(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xConfigureWindowReq); REQUEST(xConfigureWindowReq);
register int result; register int result;
int len; int len, rc;
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
pWin = (WindowPtr)SecurityLookupWindow( stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
SecurityWriteAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
len = client->req_len - (sizeof(xConfigureWindowReq) >> 2); len = client->req_len - (sizeof(xConfigureWindowReq) >> 2);
if (Ones((Mask)stuff->mask) != len) if (Ones((Mask)stuff->mask) != len)
return BadLength; return BadLength;
@ -822,8 +816,9 @@ ProcConfigureWindow(register ClientPtr client)
int int
ProcCirculateWindow(register ClientPtr client) ProcCirculateWindow(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xCirculateWindowReq); REQUEST(xCirculateWindowReq);
int rc;
REQUEST_SIZE_MATCH(xCirculateWindowReq); REQUEST_SIZE_MATCH(xCirculateWindowReq);
if ((stuff->direction != RaiseLowest) && if ((stuff->direction != RaiseLowest) &&
@ -832,10 +827,9 @@ ProcCirculateWindow(register ClientPtr client)
client->errorValue = stuff->direction; client->errorValue = stuff->direction;
return BadValue; return BadValue;
} }
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
SecurityWriteAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
CirculateWindow(pWin, (int)stuff->direction, client); CirculateWindow(pWin, (int)stuff->direction, client);
return(client->noClientException); return(client->noClientException);
} }
@ -843,11 +837,15 @@ ProcCirculateWindow(register ClientPtr client)
int int
GetGeometry(register ClientPtr client, xGetGeometryReply *rep) GetGeometry(register ClientPtr client, xGetGeometryReply *rep)
{ {
register DrawablePtr pDraw; DrawablePtr pDraw;
int rc;
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->id, client, SecurityReadAccess);
rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixReadAccess);
if (rc != Success)
return rc;
rep->type = X_Reply; rep->type = X_Reply;
rep->length = 0; rep->length = 0;
rep->sequenceNumber = client->sequence; rep->sequenceNumber = client->sequence;
@ -899,16 +897,15 @@ int
ProcQueryTree(register ClientPtr client) ProcQueryTree(register ClientPtr client)
{ {
xQueryTreeReply reply; xQueryTreeReply reply;
int numChildren = 0; int rc, numChildren = 0;
register WindowPtr pChild, pWin, pHead; WindowPtr pChild, pWin, pHead;
Window *childIDs = (Window *)NULL; Window *childIDs = (Window *)NULL;
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
reply.type = X_Reply; reply.type = X_Reply;
reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
@ -1021,10 +1018,9 @@ ProcSetSelectionOwner(register ClientPtr client)
return Success; return Success;
if (stuff->window != None) if (stuff->window != None)
{ {
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, int rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
} }
else else
pWin = (WindowPtr)None; pWin = (WindowPtr)None;
@ -1138,12 +1134,12 @@ ProcConvertSelection(register ClientPtr client)
xEvent event; xEvent event;
WindowPtr pWin; WindowPtr pWin;
REQUEST(xConvertSelectionReq); REQUEST(xConvertSelectionReq);
int rc;
REQUEST_SIZE_MATCH(xConvertSelectionReq); REQUEST_SIZE_MATCH(xConvertSelectionReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->requestor, client, rc = dixLookupWindow(&pWin, stuff->requestor, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target)); paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target));
if (stuff->property != None) if (stuff->property != None)
@ -1159,7 +1155,7 @@ ProcConvertSelection(register ClientPtr client)
(CurrentSelections[i].window != None) && (CurrentSelections[i].window != None) &&
XaceHook(XACE_RESOURCE_ACCESS, client, XaceHook(XACE_RESOURCE_ACCESS, client,
CurrentSelections[i].window, RT_WINDOW, CurrentSelections[i].window, RT_WINDOW,
SecurityReadAccess, CurrentSelections[i].pWin)) DixReadAccess, CurrentSelections[i].pWin))
{ {
event.u.u.type = SelectionRequest; event.u.u.type = SelectionRequest;
event.u.selectionRequest.time = stuff->time; event.u.selectionRequest.time = stuff->time;
@ -1258,18 +1254,17 @@ ProcTranslateCoords(register ClientPtr client)
{ {
REQUEST(xTranslateCoordsReq); REQUEST(xTranslateCoordsReq);
register WindowPtr pWin, pDst; WindowPtr pWin, pDst;
xTranslateCoordsReply rep; xTranslateCoordsReply rep;
int rc;
REQUEST_SIZE_MATCH(xTranslateCoordsReq); REQUEST_SIZE_MATCH(xTranslateCoordsReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow); rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, if (rc != Success)
SecurityReadAccess); return rc;
if (!pDst)
return(BadWindow);
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
@ -1358,7 +1353,7 @@ ProcCloseFont(register ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT,
SecurityDestroyAccess); DixDestroyAccess);
if ( pFont != (FontPtr)NULL) /* id was valid */ if ( pFont != (FontPtr)NULL) /* id was valid */
{ {
FreeResource(stuff->id, RT_NONE); FreeResource(stuff->id, RT_NONE);
@ -1382,12 +1377,11 @@ ProcQueryFont(register ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
client->errorValue = stuff->id; /* EITHER font or gc */ client->errorValue = stuff->id; /* EITHER font or gc */
pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT,
SecurityReadAccess); DixReadAccess);
if (!pFont) if (!pFont)
{ {
/* can't use VERIFY_GC because it might return BadGC */
pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC,
SecurityReadAccess); DixReadAccess);
if (!pGC) if (!pGC)
{ {
client->errorValue = stuff->id; client->errorValue = stuff->id;
@ -1443,11 +1437,11 @@ ProcQueryTextExtents(register ClientPtr client)
REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq); REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq);
pFont = (FontPtr)SecurityLookupIDByType(client, stuff->fid, RT_FONT, pFont = (FontPtr)SecurityLookupIDByType(client, stuff->fid, RT_FONT,
SecurityReadAccess); DixReadAccess);
if (!pFont) if (!pFont)
{ {
pGC = (GC *)SecurityLookupIDByType(client, stuff->fid, RT_GC, pGC = (GC *)SecurityLookupIDByType(client, stuff->fid, RT_GC,
SecurityReadAccess); DixReadAccess);
if (!pGC) if (!pGC)
{ {
client->errorValue = stuff->fid; client->errorValue = stuff->fid;
@ -1517,16 +1511,20 @@ int
ProcCreatePixmap(register ClientPtr client) ProcCreatePixmap(register ClientPtr client)
{ {
PixmapPtr pMap; PixmapPtr pMap;
register DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xCreatePixmapReq); REQUEST(xCreatePixmapReq);
DepthPtr pDepth; DepthPtr pDepth;
register int i; register int i, rc;
REQUEST_SIZE_MATCH(xCreatePixmapReq); REQUEST_SIZE_MATCH(xCreatePixmapReq);
client->errorValue = stuff->pid; client->errorValue = stuff->pid;
LEGAL_NEW_RESOURCE(stuff->pid, client); LEGAL_NEW_RESOURCE(stuff->pid, client);
SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client,
SecurityReadAccess); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
DixReadAccess);
if (rc != Success)
return rc;
if (!stuff->width || !stuff->height) if (!stuff->width || !stuff->height)
{ {
client->errorValue = 0; client->errorValue = 0;
@ -1581,7 +1579,7 @@ ProcFreePixmap(register ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pMap = (PixmapPtr)SecurityLookupIDByType(client, stuff->id, RT_PIXMAP, pMap = (PixmapPtr)SecurityLookupIDByType(client, stuff->id, RT_PIXMAP,
SecurityDestroyAccess); DixDestroyAccess);
if (pMap) if (pMap)
{ {
FreeResource(stuff->id, RT_NONE); FreeResource(stuff->id, RT_NONE);
@ -1597,17 +1595,19 @@ ProcFreePixmap(register ClientPtr client)
int int
ProcCreateGC(register ClientPtr client) ProcCreateGC(register ClientPtr client)
{ {
int error; int error, rc;
GC *pGC; GC *pGC;
register DrawablePtr pDraw; DrawablePtr pDraw;
unsigned len; unsigned len;
REQUEST(xCreateGCReq); REQUEST(xCreateGCReq);
REQUEST_AT_LEAST_SIZE(xCreateGCReq); REQUEST_AT_LEAST_SIZE(xCreateGCReq);
client->errorValue = stuff->gc; client->errorValue = stuff->gc;
LEGAL_NEW_RESOURCE(stuff->gc, client); LEGAL_NEW_RESOURCE(stuff->gc, client);
SECURITY_VERIFY_DRAWABLE (pDraw, stuff->drawable, client, rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess);
SecurityReadAccess); if (rc != Success)
return rc;
len = client->req_len - (sizeof(xCreateGCReq) >> 2); len = client->req_len - (sizeof(xCreateGCReq) >> 2);
if (len != Ones(stuff->mask)) if (len != Ones(stuff->mask))
return BadLength; return BadLength;
@ -1624,12 +1624,15 @@ int
ProcChangeGC(register ClientPtr client) ProcChangeGC(register ClientPtr client)
{ {
GC *pGC; GC *pGC;
REQUEST(xChangeGCReq);
int result; int result;
unsigned len; unsigned len;
REQUEST(xChangeGCReq);
REQUEST_AT_LEAST_SIZE(xChangeGCReq); REQUEST_AT_LEAST_SIZE(xChangeGCReq);
SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityWriteAccess);
result = dixLookupGC(&pGC, stuff->gc, client, DixWriteAccess);
if (result != Success)
return result;
len = client->req_len - (sizeof(xChangeGCReq) >> 2); len = client->req_len - (sizeof(xChangeGCReq) >> 2);
if (len != Ones(stuff->mask)) if (len != Ones(stuff->mask))
return BadLength; return BadLength;
@ -1647,14 +1650,18 @@ ProcChangeGC(register ClientPtr client)
int int
ProcCopyGC(register ClientPtr client) ProcCopyGC(register ClientPtr client)
{ {
register GC *dstGC; GC *dstGC;
register GC *pGC; GC *pGC;
int result; int result;
REQUEST(xCopyGCReq); REQUEST(xCopyGCReq);
REQUEST_SIZE_MATCH(xCopyGCReq); REQUEST_SIZE_MATCH(xCopyGCReq);
SECURITY_VERIFY_GC( pGC, stuff->srcGC, client, SecurityReadAccess);
SECURITY_VERIFY_GC( dstGC, stuff->dstGC, client, SecurityWriteAccess); result = dixLookupGC(&pGC, stuff->srcGC, client, DixReadAccess);
if (result != Success)
return result;
result = dixLookupGC(&dstGC, stuff->dstGC, client, DixWriteAccess);
if (result != Success)
return result;
if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth)) if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth))
return (BadMatch); return (BadMatch);
result = CopyGC(pGC, dstGC, stuff->mask); result = CopyGC(pGC, dstGC, stuff->mask);
@ -1670,7 +1677,7 @@ ProcCopyGC(register ClientPtr client)
int int
ProcSetDashes(register ClientPtr client) ProcSetDashes(register ClientPtr client)
{ {
register GC *pGC; GC *pGC;
int result; int result;
REQUEST(xSetDashesReq); REQUEST(xSetDashesReq);
@ -1681,7 +1688,9 @@ ProcSetDashes(register ClientPtr client)
return BadValue; return BadValue;
} }
SECURITY_VERIFY_GC(pGC,stuff->gc, client, SecurityWriteAccess); result = dixLookupGC(&pGC,stuff->gc, client, DixWriteAccess);
if (result != Success)
return result;
result = SetDashes(pGC, stuff->dashOffset, stuff->nDashes, result = SetDashes(pGC, stuff->dashOffset, stuff->nDashes,
(unsigned char *)&stuff[1]); (unsigned char *)&stuff[1]);
@ -1697,9 +1706,8 @@ ProcSetDashes(register ClientPtr client)
int int
ProcSetClipRectangles(register ClientPtr client) ProcSetClipRectangles(register ClientPtr client)
{ {
int nr; int nr, result;
int result; GC *pGC;
register GC *pGC;
REQUEST(xSetClipRectanglesReq); REQUEST(xSetClipRectanglesReq);
REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
@ -1709,7 +1717,9 @@ ProcSetClipRectangles(register ClientPtr client)
client->errorValue = stuff->ordering; client->errorValue = stuff->ordering;
return BadValue; return BadValue;
} }
SECURITY_VERIFY_GC(pGC,stuff->gc, client, SecurityWriteAccess); result = dixLookupGC(&pGC,stuff->gc, client, DixWriteAccess);
if (result != Success)
return result;
nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq); nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq);
if (nr & 4) if (nr & 4)
@ -1726,11 +1736,15 @@ ProcSetClipRectangles(register ClientPtr client)
int int
ProcFreeGC(register ClientPtr client) ProcFreeGC(register ClientPtr client)
{ {
register GC *pGC; GC *pGC;
int rc;
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
SECURITY_VERIFY_GC(pGC, stuff->id, client, SecurityDestroyAccess);
rc = dixLookupGC(&pGC, stuff->id, client, DixDestroyAccess);
if (rc != Success)
return rc;
FreeResource(stuff->id, RT_NONE); FreeResource(stuff->id, RT_NONE);
return(client->noClientException); return(client->noClientException);
} }
@ -1739,13 +1753,13 @@ int
ProcClearToBackground(register ClientPtr client) ProcClearToBackground(register ClientPtr client)
{ {
REQUEST(xClearAreaReq); REQUEST(xClearAreaReq);
register WindowPtr pWin; WindowPtr pWin;
int rc;
REQUEST_SIZE_MATCH(xClearAreaReq); REQUEST_SIZE_MATCH(xClearAreaReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
SecurityWriteAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
if (pWin->drawable.class == InputOnly) if (pWin->drawable.class == InputOnly)
{ {
client->errorValue = stuff->window; client->errorValue = stuff->window;
@ -1765,19 +1779,22 @@ ProcClearToBackground(register ClientPtr client)
int int
ProcCopyArea(register ClientPtr client) ProcCopyArea(register ClientPtr client)
{ {
register DrawablePtr pDst; DrawablePtr pDst;
register DrawablePtr pSrc; DrawablePtr pSrc;
register GC *pGC; GC *pGC;
REQUEST(xCopyAreaReq); REQUEST(xCopyAreaReq);
RegionPtr pRgn; RegionPtr pRgn;
int rc;
REQUEST_SIZE_MATCH(xCopyAreaReq); REQUEST_SIZE_MATCH(xCopyAreaReq);
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);
if (stuff->dstDrawable != stuff->srcDrawable) if (stuff->dstDrawable != stuff->srcDrawable)
{ {
SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client, rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
SecurityReadAccess); DixReadAccess);
if (rc != Success)
return rc;
if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth))
{ {
client->errorValue = stuff->dstDrawable; client->errorValue = stuff->dstDrawable;
@ -1806,18 +1823,22 @@ ProcCopyArea(register ClientPtr client)
int int
ProcCopyPlane(register ClientPtr client) ProcCopyPlane(register ClientPtr client)
{ {
register DrawablePtr psrcDraw, pdstDraw; DrawablePtr psrcDraw, pdstDraw;
register GC *pGC; GC *pGC;
REQUEST(xCopyPlaneReq); REQUEST(xCopyPlaneReq);
RegionPtr pRgn; RegionPtr pRgn;
int rc;
REQUEST_SIZE_MATCH(xCopyPlaneReq); REQUEST_SIZE_MATCH(xCopyPlaneReq);
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client); VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client);
if (stuff->dstDrawable != stuff->srcDrawable) if (stuff->dstDrawable != stuff->srcDrawable)
{ {
SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client, rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
SecurityReadAccess); DixReadAccess);
if (rc != Success)
return rc;
if (pdstDraw->pScreen != psrcDraw->pScreen) if (pdstDraw->pScreen != psrcDraw->pScreen)
{ {
client->errorValue = stuff->dstDrawable; client->errorValue = stuff->dstDrawable;
@ -1854,8 +1875,8 @@ int
ProcPolyPoint(register ClientPtr client) ProcPolyPoint(register ClientPtr client)
{ {
int npoint; int npoint;
register GC *pGC; GC *pGC;
register DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolyPointReq); REQUEST(xPolyPointReq);
REQUEST_AT_LEAST_SIZE(xPolyPointReq); REQUEST_AT_LEAST_SIZE(xPolyPointReq);
@ -1877,8 +1898,8 @@ int
ProcPolyLine(register ClientPtr client) ProcPolyLine(register ClientPtr client)
{ {
int npoint; int npoint;
register GC *pGC; GC *pGC;
register DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolyLineReq); REQUEST(xPolyLineReq);
REQUEST_AT_LEAST_SIZE(xPolyLineReq); REQUEST_AT_LEAST_SIZE(xPolyLineReq);
@ -1900,8 +1921,8 @@ int
ProcPolySegment(register ClientPtr client) ProcPolySegment(register ClientPtr client)
{ {
int nsegs; int nsegs;
register GC *pGC; GC *pGC;
register DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolySegmentReq); REQUEST(xPolySegmentReq);
REQUEST_AT_LEAST_SIZE(xPolySegmentReq); REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
@ -1919,8 +1940,8 @@ int
ProcPolyRectangle (register ClientPtr client) ProcPolyRectangle (register ClientPtr client)
{ {
int nrects; int nrects;
register GC *pGC; GC *pGC;
register DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolyRectangleReq); REQUEST(xPolyRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
@ -1939,8 +1960,8 @@ int
ProcPolyArc(register ClientPtr client) ProcPolyArc(register ClientPtr client)
{ {
int narcs; int narcs;
register GC *pGC; GC *pGC;
register DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolyArcReq); REQUEST(xPolyArcReq);
REQUEST_AT_LEAST_SIZE(xPolyArcReq); REQUEST_AT_LEAST_SIZE(xPolyArcReq);
@ -1958,8 +1979,8 @@ int
ProcFillPoly(register ClientPtr client) ProcFillPoly(register ClientPtr client)
{ {
int things; int things;
register GC *pGC; GC *pGC;
register DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xFillPolyReq); REQUEST(xFillPolyReq);
REQUEST_AT_LEAST_SIZE(xFillPolyReq); REQUEST_AT_LEAST_SIZE(xFillPolyReq);
@ -1989,8 +2010,8 @@ int
ProcPolyFillRectangle(register ClientPtr client) ProcPolyFillRectangle(register ClientPtr client)
{ {
int things; int things;
register GC *pGC; GC *pGC;
register DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolyFillRectangleReq); REQUEST(xPolyFillRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
@ -2010,8 +2031,8 @@ int
ProcPolyFillArc(register ClientPtr client) ProcPolyFillArc(register ClientPtr client)
{ {
int narcs; int narcs;
register GC *pGC; GC *pGC;
register DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolyFillArcReq); REQUEST(xPolyFillArcReq);
REQUEST_AT_LEAST_SIZE(xPolyFillArcReq); REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
@ -2082,8 +2103,8 @@ ReformatImage (char *base, int nbytes, int bpp, int order)
int int
ProcPutImage(register ClientPtr client) ProcPutImage(register ClientPtr client)
{ {
register GC *pGC; GC *pGC;
register DrawablePtr pDraw; DrawablePtr pDraw;
long length; /* length of scanline server padded */ long length; /* length of scanline server padded */
long lengthProto; /* length of scanline protocol padded */ long lengthProto; /* length of scanline protocol padded */
char *tmpImage; char *tmpImage;
@ -2142,8 +2163,8 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
int x, int y, int width, int height, int x, int y, int width, int height,
Mask planemask, xGetImageReply **im_return) Mask planemask, xGetImageReply **im_return)
{ {
register DrawablePtr pDraw; DrawablePtr pDraw;
int nlines, linesPerBuf; int nlines, linesPerBuf, rc;
register int linesDone; register int linesDone;
long widthBytesLine, length; long widthBytesLine, length;
Mask plane = 0; Mask plane = 0;
@ -2156,7 +2177,10 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
client->errorValue = format; client->errorValue = format;
return(BadValue); return(BadValue);
} }
SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, SecurityReadAccess); rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixReadAccess);
if (rc != Success)
return rc;
if(pDraw->type == DRAWABLE_WINDOW) if(pDraw->type == DRAWABLE_WINDOW)
{ {
if( /* check for being viewable */ if( /* check for being viewable */
@ -2400,8 +2424,8 @@ int
ProcImageText8(register ClientPtr client) ProcImageText8(register ClientPtr client)
{ {
int err; int err;
register DrawablePtr pDraw; DrawablePtr pDraw;
register GC *pGC; GC *pGC;
REQUEST(xImageTextReq); REQUEST(xImageTextReq);
@ -2430,8 +2454,8 @@ int
ProcImageText16(register ClientPtr client) ProcImageText16(register ClientPtr client)
{ {
int err; int err;
register DrawablePtr pDraw; DrawablePtr pDraw;
register GC *pGC; GC *pGC;
REQUEST(xImageTextReq); REQUEST(xImageTextReq);
@ -2463,7 +2487,7 @@ ProcCreateColormap(register ClientPtr client)
VisualPtr pVisual; VisualPtr pVisual;
ColormapPtr pmap; ColormapPtr pmap;
Colormap mid; Colormap mid;
register WindowPtr pWin; WindowPtr pWin;
ScreenPtr pScreen; ScreenPtr pScreen;
REQUEST(xCreateColormapReq); REQUEST(xCreateColormapReq);
int i, result; int i, result;
@ -2477,10 +2501,9 @@ ProcCreateColormap(register ClientPtr client)
} }
mid = stuff->mid; mid = stuff->mid;
LEGAL_NEW_RESOURCE(mid, client); LEGAL_NEW_RESOURCE(mid, client);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, result = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
SecurityReadAccess); if (result != Success)
if (!pWin) return result;
return(BadWindow);
pScreen = pWin->drawable.pScreen; pScreen = pWin->drawable.pScreen;
for (i = 0, pVisual = pScreen->visuals; for (i = 0, pVisual = pScreen->visuals;
@ -2508,7 +2531,7 @@ ProcFreeColormap(register ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pmap = (ColormapPtr )SecurityLookupIDByType(client, stuff->id, RT_COLORMAP, pmap = (ColormapPtr )SecurityLookupIDByType(client, stuff->id, RT_COLORMAP,
SecurityDestroyAccess); DixDestroyAccess);
if (pmap) if (pmap)
{ {
/* Freeing a default colormap is a no-op */ /* Freeing a default colormap is a no-op */
@ -2536,7 +2559,7 @@ ProcCopyColormapAndFree(register ClientPtr client)
mid = stuff->mid; mid = stuff->mid;
LEGAL_NEW_RESOURCE(mid, client); LEGAL_NEW_RESOURCE(mid, client);
if( (pSrcMap = (ColormapPtr )SecurityLookupIDByType(client, stuff->srcCmap, if( (pSrcMap = (ColormapPtr )SecurityLookupIDByType(client, stuff->srcCmap,
RT_COLORMAP, SecurityReadAccess|SecurityWriteAccess)) ) RT_COLORMAP, DixReadAccess|DixWriteAccess)) )
{ {
result = CopyColormapAndFree(mid, pSrcMap, client->index); result = CopyColormapAndFree(mid, pSrcMap, client->index);
if (client->noClientException != Success) if (client->noClientException != Success)
@ -2559,7 +2582,7 @@ ProcInstallColormap(register ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id, pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id,
RT_COLORMAP, SecurityReadAccess); RT_COLORMAP, DixReadAccess);
if (pcmp) if (pcmp)
{ {
(*(pcmp->pScreen->InstallColormap)) (pcmp); (*(pcmp->pScreen->InstallColormap)) (pcmp);
@ -2580,7 +2603,7 @@ ProcUninstallColormap(register ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id, pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id,
RT_COLORMAP, SecurityReadAccess); RT_COLORMAP, DixReadAccess);
if (pcmp) if (pcmp)
{ {
if(pcmp->mid != pcmp->pScreen->defColormap) if(pcmp->mid != pcmp->pScreen->defColormap)
@ -2598,16 +2621,14 @@ int
ProcListInstalledColormaps(register ClientPtr client) ProcListInstalledColormaps(register ClientPtr client)
{ {
xListInstalledColormapsReply *preply; xListInstalledColormapsReply *preply;
int nummaps; int nummaps, rc;
WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
return rc;
if (!pWin)
return(BadWindow);
preply = (xListInstalledColormapsReply *) preply = (xListInstalledColormapsReply *)
ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) + ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) +
@ -2639,7 +2660,7 @@ ProcAllocColor (register ClientPtr client)
REQUEST_SIZE_MATCH(xAllocColorReq); REQUEST_SIZE_MATCH(xAllocColorReq);
pmap = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, pmap = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
RT_COLORMAP, SecurityWriteAccess); RT_COLORMAP, DixWriteAccess);
if (pmap) if (pmap)
{ {
acr.type = X_Reply; acr.type = X_Reply;
@ -2679,7 +2700,7 @@ ProcAllocNamedColor (register ClientPtr client)
REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes); REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
RT_COLORMAP, SecurityWriteAccess); RT_COLORMAP, DixWriteAccess);
if (pcmp) if (pcmp)
{ {
int retval; int retval;
@ -2731,7 +2752,7 @@ ProcAllocColorCells (register ClientPtr client)
REQUEST_SIZE_MATCH(xAllocColorCellsReq); REQUEST_SIZE_MATCH(xAllocColorCellsReq);
pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
RT_COLORMAP, SecurityWriteAccess); RT_COLORMAP, DixWriteAccess);
if (pcmp) if (pcmp)
{ {
xAllocColorCellsReply accr; xAllocColorCellsReply accr;
@ -2797,7 +2818,7 @@ ProcAllocColorPlanes(register ClientPtr client)
REQUEST_SIZE_MATCH(xAllocColorPlanesReq); REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
RT_COLORMAP, SecurityWriteAccess); RT_COLORMAP, DixWriteAccess);
if (pcmp) if (pcmp)
{ {
xAllocColorPlanesReply acpr; xAllocColorPlanesReply acpr;
@ -2861,7 +2882,7 @@ ProcFreeColors(register ClientPtr client)
REQUEST_AT_LEAST_SIZE(xFreeColorsReq); REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
RT_COLORMAP, SecurityWriteAccess); RT_COLORMAP, DixWriteAccess);
if (pcmp) if (pcmp)
{ {
int count; int count;
@ -2896,7 +2917,7 @@ ProcStoreColors (ClientPtr client)
REQUEST_AT_LEAST_SIZE(xStoreColorsReq); REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
RT_COLORMAP, SecurityWriteAccess); RT_COLORMAP, DixWriteAccess);
if (pcmp) if (pcmp)
{ {
int count; int count;
@ -2930,7 +2951,7 @@ ProcStoreNamedColor (register ClientPtr client)
REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes); REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
RT_COLORMAP, SecurityWriteAccess); RT_COLORMAP, DixWriteAccess);
if (pcmp) if (pcmp)
{ {
xColorItem def; xColorItem def;
@ -2964,7 +2985,7 @@ ProcQueryColors(register ClientPtr client)
REQUEST_AT_LEAST_SIZE(xQueryColorsReq); REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
RT_COLORMAP, SecurityReadAccess); RT_COLORMAP, DixReadAccess);
if (pcmp) if (pcmp)
{ {
int count, retval; int count, retval;
@ -3015,7 +3036,7 @@ ProcLookupColor(register ClientPtr client)
REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes); REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes);
pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
RT_COLORMAP, SecurityReadAccess); RT_COLORMAP, DixReadAccess);
if (pcmp) if (pcmp)
{ {
xLookupColorReply lcr; xLookupColorReply lcr;
@ -3065,9 +3086,9 @@ ProcCreateCursor (register ClientPtr client)
LEGAL_NEW_RESOURCE(stuff->cid, client); LEGAL_NEW_RESOURCE(stuff->cid, client);
src = (PixmapPtr)SecurityLookupIDByType(client, stuff->source, src = (PixmapPtr)SecurityLookupIDByType(client, stuff->source,
RT_PIXMAP, SecurityReadAccess); RT_PIXMAP, DixReadAccess);
msk = (PixmapPtr)SecurityLookupIDByType(client, stuff->mask, msk = (PixmapPtr)SecurityLookupIDByType(client, stuff->mask,
RT_PIXMAP, SecurityReadAccess); RT_PIXMAP, DixReadAccess);
if ( src == (PixmapPtr)NULL) if ( src == (PixmapPtr)NULL)
{ {
client->errorValue = stuff->source; client->errorValue = stuff->source;
@ -3167,7 +3188,7 @@ ProcFreeCursor (register ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->id, pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->id,
RT_CURSOR, SecurityDestroyAccess); RT_CURSOR, DixDestroyAccess);
if (pCursor) if (pCursor)
{ {
FreeResource(stuff->id, RT_NONE); FreeResource(stuff->id, RT_NONE);
@ -3184,11 +3205,12 @@ int
ProcQueryBestSize (register ClientPtr client) ProcQueryBestSize (register ClientPtr client)
{ {
xQueryBestSizeReply reply; xQueryBestSizeReply reply;
register DrawablePtr pDraw; DrawablePtr pDraw;
ScreenPtr pScreen; ScreenPtr pScreen;
int rc;
REQUEST(xQueryBestSizeReq); REQUEST(xQueryBestSizeReq);
REQUEST_SIZE_MATCH(xQueryBestSizeReq); REQUEST_SIZE_MATCH(xQueryBestSizeReq);
if ((stuff->class != CursorShape) && if ((stuff->class != CursorShape) &&
(stuff->class != TileShape) && (stuff->class != TileShape) &&
(stuff->class != StippleShape)) (stuff->class != StippleShape))
@ -3196,8 +3218,11 @@ ProcQueryBestSize (register ClientPtr client)
client->errorValue = stuff->class; client->errorValue = stuff->class;
return(BadValue); return(BadValue);
} }
SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client,
SecurityReadAccess); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
DixReadAccess);
if (rc != Success)
return rc;
if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW) if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW)
return (BadMatch); return (BadMatch);
pScreen = pDraw->pScreen; pScreen = pDraw->pScreen;
@ -3321,7 +3346,7 @@ ProcListHosts(register ClientPtr client)
REQUEST_SIZE_MATCH(xListHostsReq); REQUEST_SIZE_MATCH(xListHostsReq);
/* untrusted clients can't list hosts */ /* untrusted clients can't list hosts */
if (!XaceHook(XACE_HOSTLIST_ACCESS, client, SecurityReadAccess)) if (!XaceHook(XACE_HOSTLIST_ACCESS, client, DixReadAccess))
return BadAccess; return BadAccess;
result = GetHosts(&pdata, &nHosts, &len, &reply.enabled); result = GetHosts(&pdata, &nHosts, &len, &reply.enabled);
@ -3363,7 +3388,8 @@ int
ProcKillClient(register ClientPtr client) ProcKillClient(register ClientPtr client)
{ {
REQUEST(xResourceReq); REQUEST(xResourceReq);
ClientPtr killclient; ClientPtr killclient;
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
if (stuff->id == AllTemporary) if (stuff->id == AllTemporary)
@ -3372,8 +3398,8 @@ ProcKillClient(register ClientPtr client)
return (client->noClientException); return (client->noClientException);
} }
if ((killclient = LookupClient(stuff->id, client))) rc = dixLookupClient(&killclient, stuff->id, client, DixDestroyAccess);
{ if (rc == Success) {
CloseDownClient(killclient); CloseDownClient(killclient);
/* if an LBX proxy gets killed, isItTimeToYield will be set */ /* if an LBX proxy gets killed, isItTimeToYield will be set */
if (isItTimeToYield || (client == killclient)) if (isItTimeToYield || (client == killclient))
@ -3387,10 +3413,7 @@ ProcKillClient(register ClientPtr client)
return (client->noClientException); return (client->noClientException);
} }
else else
{ return rc;
client->errorValue = stuff->id;
return (BadValue);
}
} }
int int
@ -3729,6 +3752,8 @@ InitClientPrivates(ClientPtr client)
client->devPrivates = ppriv; client->devPrivates = ppriv;
sizes = clientPrivateSizes; sizes = clientPrivateSizes;
ptr = (char *)(ppriv + clientPrivateLen); ptr = (char *)(ppriv + clientPrivateLen);
if (ppriv)
bzero(ppriv, totalClientSize - sizeof(ClientRec));
for (i = clientPrivateLen; --i >= 0; ppriv++, sizes++) for (i = clientPrivateLen; --i >= 0; ppriv++, sizes++)
{ {
if ( (size = *sizes) ) if ( (size = *sizes) )

View File

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

View File

@ -194,115 +194,144 @@ CompareISOLatin1Lowered(unsigned char *s1, int s1len,
return (int) c1 - (int) c2; return (int) c1 - (int) c2;
} }
#ifdef XACE /*
* dixLookupWindow and dixLookupDrawable:
/* SecurityLookupWindow and SecurityLookupDrawable: * Look up the window/drawable taking into account the client doing the
* Look up the window/drawable taking into account the client doing * lookup, the type of drawable desired, and the type of access desired.
* the lookup and the type of access desired. Return the window/drawable * Return Success with *pDraw set if the window/drawable exists and the client
* if it exists and the client is allowed access, else return NULL. * is allowed access, else return an error code with *pDraw set to NULL. The
* Most Proc* functions should be calling these instead of * access mask values are defined in resource.h. The type mask values are
* LookupWindow and LookupDrawable, which do no access checks. * defined in pixmap.h, with zero equivalent to M_DRAWABLE.
* XACE note: need to see if client->lastDrawableID can still be used here.
*/ */
_X_EXPORT int
_X_EXPORT WindowPtr dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
SecurityLookupWindow(XID rid, ClientPtr client, Mask access_mode) Mask type, Mask access)
{ {
client->errorValue = rid; DrawablePtr pTmp;
if(rid == INVALID) RESTYPE rtype;
return NULL; *pDraw = NULL;
return (WindowPtr)SecurityLookupIDByType(client, rid, RT_WINDOW, access_mode); client->errorValue = id;
}
if (id == INVALID)
return BadDrawable;
_X_EXPORT pointer if (id == client->lastDrawableID) {
SecurityLookupDrawable(XID rid, ClientPtr client, Mask access_mode) pTmp = client->lastDrawable;
{
register DrawablePtr pDraw;
if(rid == INVALID) /* an access check is required for cached drawables */
return (pointer) NULL; rtype = (type & M_WINDOW) ? RT_WINDOW : RT_PIXMAP;
pDraw = (DrawablePtr)SecurityLookupIDByClass(client, rid, RC_DRAWABLE, if (!XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, access, pTmp))
access_mode); return BadDrawable;
if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW)) } else
return (pointer)pDraw; pTmp = (DrawablePtr)SecurityLookupIDByClass(client, id, RC_DRAWABLE,
return (pointer)NULL; 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 if (type & M_DRAWABLE) {
* macros because of compatibility with loadable servers. client->lastDrawable = pTmp;
*/ client->lastDrawableID = id;
_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;
client->lastGCID = INVALID; client->lastGCID = INVALID;
client->lastGC = (GCPtr)NULL; client->lastGC = (GCPtr)NULL;
} }
return pWin; *pDraw = pTmp;
return Success;
} }
_X_EXPORT int
pointer dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
LookupDrawable(XID rid, ClientPtr client)
{ {
register DrawablePtr pDraw; int rc;
rc = dixLookupDrawable((DrawablePtr*)pWin, id, client, M_WINDOW, access);
if(rid == INVALID) return (rc == BadDrawable) ? BadWindow : rc;
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;
} }
#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 _X_EXPORT int
LookupClient(XID rid, ClientPtr client) dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
{ {
pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY, pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY,
SecurityReadAccess); DixReadAccess);
int clientIndex = CLIENT_ID(rid); int clientIndex = CLIENT_ID(rid);
client->errorValue = rid;
if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) {
{ *pClient = clients[clientIndex];
return 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 int
AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode, AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,

View File

@ -2228,16 +2228,15 @@ static int
XineramaWarpPointer(ClientPtr client) XineramaWarpPointer(ClientPtr client)
{ {
WindowPtr dest = NULL; WindowPtr dest = NULL;
int x, y; int x, y, rc;
REQUEST(xWarpPointerReq); REQUEST(xWarpPointerReq);
if (stuff->dstWid != None) if (stuff->dstWid != None) {
{ rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess); if (rc != Success)
if (!dest) return rc;
return BadWindow;
} }
x = sprite.hotPhys.x; x = sprite.hotPhys.x;
y = sprite.hotPhys.y; y = sprite.hotPhys.y;
@ -2248,8 +2247,9 @@ XineramaWarpPointer(ClientPtr client)
XID winID = stuff->srcWid; XID winID = stuff->srcWid;
WindowPtr source; WindowPtr source;
source = SecurityLookupWindow(winID, client, SecurityReadAccess); rc = dixLookupWindow(&source, winID, client, DixReadAccess);
if (!source) return BadWindow; if (rc != Success)
return rc;
winX = source->drawable.x; winX = source->drawable.x;
winY = source->drawable.y; winY = source->drawable.y;
@ -2301,7 +2301,7 @@ int
ProcWarpPointer(ClientPtr client) ProcWarpPointer(ClientPtr client)
{ {
WindowPtr dest = NULL; WindowPtr dest = NULL;
int x, y; int x, y, rc;
ScreenPtr newScreen; ScreenPtr newScreen;
REQUEST(xWarpPointerReq); REQUEST(xWarpPointerReq);
@ -2313,11 +2313,10 @@ ProcWarpPointer(ClientPtr client)
return XineramaWarpPointer(client); return XineramaWarpPointer(client);
#endif #endif
if (stuff->dstWid != None) if (stuff->dstWid != None) {
{ rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess); if (rc != Success)
if (!dest) return rc;
return BadWindow;
} }
x = sprite.hotPhys.x; x = sprite.hotPhys.x;
y = sprite.hotPhys.y; y = sprite.hotPhys.y;
@ -2328,8 +2327,9 @@ ProcWarpPointer(ClientPtr client)
XID winID = stuff->srcWid; XID winID = stuff->srcWid;
WindowPtr source; WindowPtr source;
source = SecurityLookupWindow(winID, client, SecurityReadAccess); rc = dixLookupWindow(&source, winID, client, DixReadAccess);
if (!source) return BadWindow; if (rc != Success)
return rc;
winX = source->drawable.x; winX = source->drawable.x;
winY = source->drawable.y; winY = source->drawable.y;
@ -3532,8 +3532,8 @@ SetInputFocus(
Bool followOK) Bool followOK)
{ {
register FocusClassPtr focus; register FocusClassPtr focus;
register WindowPtr focusWin; WindowPtr focusWin;
int mode; int mode, rc;
TimeStamp time; TimeStamp time;
UpdateCurrentTime(); UpdateCurrentTime();
@ -3550,14 +3550,12 @@ SetInputFocus(
focusWin = (WindowPtr)(long)focusID; focusWin = (WindowPtr)(long)focusID;
else if ((focusID == FollowKeyboard) && followOK) else if ((focusID == FollowKeyboard) && followOK)
focusWin = inputInfo.keyboard->focus->win; focusWin = inputInfo.keyboard->focus->win;
else if (!(focusWin = SecurityLookupWindow(focusID, client, else {
SecurityReadAccess))) rc = dixLookupWindow(&focusWin, focusID, client, DixReadAccess);
return BadWindow; if (rc != Success)
else return rc;
{
/* It is a match error to try to set the input focus to an /* It is a match error to try to set the input focus to an
unviewable window. */ unviewable window. */
if(!focusWin->realized) if(!focusWin->realized)
return(BadMatch); return(BadMatch);
} }
@ -3646,6 +3644,7 @@ ProcGrabPointer(ClientPtr client)
CursorPtr cursor, oldCursor; CursorPtr cursor, oldCursor;
REQUEST(xGrabPointerReq); REQUEST(xGrabPointerReq);
TimeStamp time; TimeStamp time;
int rc;
REQUEST_SIZE_MATCH(xGrabPointerReq); REQUEST_SIZE_MATCH(xGrabPointerReq);
UpdateCurrentTime(); UpdateCurrentTime();
@ -3671,24 +3670,24 @@ ProcGrabPointer(ClientPtr client)
client->errorValue = stuff->eventMask; client->errorValue = stuff->eventMask;
return BadValue; return BadValue;
} }
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
if (stuff->confineTo == None) if (stuff->confineTo == None)
confineTo = NullWindow; confineTo = NullWindow;
else else
{ {
confineTo = SecurityLookupWindow(stuff->confineTo, client, rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
SecurityReadAccess); DixReadAccess);
if (!confineTo) if (rc != Success)
return BadWindow; return rc;
} }
if (stuff->cursor == None) if (stuff->cursor == None)
cursor = NullCursor; cursor = NullCursor;
else else
{ {
cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
RT_CURSOR, SecurityReadAccess); RT_CURSOR, DixReadAccess);
if (!cursor) if (!cursor)
{ {
client->errorValue = stuff->cursor; client->errorValue = stuff->cursor;
@ -3762,7 +3761,7 @@ ProcChangeActivePointerGrab(ClientPtr client)
else else
{ {
newCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, newCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
RT_CURSOR, SecurityReadAccess); RT_CURSOR, DixReadAccess);
if (!newCursor) if (!newCursor)
{ {
client->errorValue = stuff->cursor; client->errorValue = stuff->cursor;
@ -3812,9 +3811,10 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
unsigned this_mode, unsigned other_mode, Window grabWindow, unsigned this_mode, unsigned other_mode, Window grabWindow,
unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status) unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status)
{ {
register WindowPtr pWin; WindowPtr pWin;
register GrabPtr grab; register GrabPtr grab;
TimeStamp time; TimeStamp time;
int rc;
UpdateCurrentTime(); UpdateCurrentTime();
if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync)) if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync))
@ -3832,9 +3832,9 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
client->errorValue = ownerEvents; client->errorValue = ownerEvents;
return BadValue; return BadValue;
} }
pWin = SecurityLookupWindow(grabWindow, client, SecurityReadAccess); rc = dixLookupWindow(&pWin, grabWindow, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
time = ClientTimeToServerTime(ctime); time = ClientTimeToServerTime(ctime);
grab = dev->grab; grab = dev->grab;
if (grab && !SameClient(grab, client)) if (grab && !SameClient(grab, client))
@ -3918,11 +3918,12 @@ ProcQueryPointer(ClientPtr client)
WindowPtr pWin, t; WindowPtr pWin, t;
REQUEST(xResourceReq); REQUEST(xResourceReq);
DeviceIntPtr mouse = inputInfo.pointer; DeviceIntPtr mouse = inputInfo.pointer;
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = SecurityLookupWindow(stuff->id, client, SecurityReadAccess); rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
if (mouse->valuator->motionHintWindow) if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client); MaybeStopHint(mouse, client);
rep.type = X_Reply; rep.type = X_Reply;
@ -4086,8 +4087,8 @@ ProcSendEvent(ClientPtr client)
effectiveFocus = pWin = inputFocus; effectiveFocus = pWin = inputFocus;
} }
else else
pWin = SecurityLookupWindow(stuff->destination, client, dixLookupWindow(&pWin, stuff->destination, client, DixReadAccess);
SecurityReadAccess);
if (!pWin) if (!pWin)
return BadWindow; return BadWindow;
if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue))
@ -4123,11 +4124,12 @@ ProcUngrabKey(ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
GrabRec tempGrab; GrabRec tempGrab;
DeviceIntPtr keybd = inputInfo.keyboard; DeviceIntPtr keybd = inputInfo.keyboard;
int rc;
REQUEST_SIZE_MATCH(xUngrabKeyReq); REQUEST_SIZE_MATCH(xUngrabKeyReq);
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) || if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) ||
(stuff->key < keybd->key->curKeySyms.minKeyCode)) (stuff->key < keybd->key->curKeySyms.minKeyCode))
@ -4164,6 +4166,7 @@ ProcGrabKey(ClientPtr client)
REQUEST(xGrabKeyReq); REQUEST(xGrabKeyReq);
GrabPtr grab; GrabPtr grab;
DeviceIntPtr keybd = inputInfo.keyboard; DeviceIntPtr keybd = inputInfo.keyboard;
int rc;
REQUEST_SIZE_MATCH(xGrabKeyReq); REQUEST_SIZE_MATCH(xGrabKeyReq);
if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse)) if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse))
@ -4196,9 +4199,9 @@ ProcGrabKey(ClientPtr client)
client->errorValue = stuff->modifiers; client->errorValue = stuff->modifiers;
return BadValue; return BadValue;
} }
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
grab = CreateGrab(client->index, keybd, pWin, grab = CreateGrab(client->index, keybd, pWin,
(Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents, (Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents,
@ -4218,6 +4221,7 @@ ProcGrabButton(ClientPtr client)
REQUEST(xGrabButtonReq); REQUEST(xGrabButtonReq);
CursorPtr cursor; CursorPtr cursor;
GrabPtr grab; GrabPtr grab;
int rc;
REQUEST_SIZE_MATCH(xGrabButtonReq); REQUEST_SIZE_MATCH(xGrabButtonReq);
if ((stuff->pointerMode != GrabModeSync) && if ((stuff->pointerMode != GrabModeSync) &&
@ -4248,23 +4252,23 @@ ProcGrabButton(ClientPtr client)
client->errorValue = stuff->eventMask; client->errorValue = stuff->eventMask;
return BadValue; return BadValue;
} }
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
if (stuff->confineTo == None) if (stuff->confineTo == None)
confineTo = NullWindow; confineTo = NullWindow;
else { else {
confineTo = SecurityLookupWindow(stuff->confineTo, client, rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
SecurityReadAccess); DixReadAccess);
if (!confineTo) if (rc != Success)
return BadWindow; return rc;
} }
if (stuff->cursor == None) if (stuff->cursor == None)
cursor = NullCursor; cursor = NullCursor;
else else
{ {
cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
RT_CURSOR, SecurityReadAccess); RT_CURSOR, DixReadAccess);
if (!cursor) if (!cursor)
{ {
client->errorValue = stuff->cursor; client->errorValue = stuff->cursor;
@ -4289,6 +4293,7 @@ ProcUngrabButton(ClientPtr client)
REQUEST(xUngrabButtonReq); REQUEST(xUngrabButtonReq);
WindowPtr pWin; WindowPtr pWin;
GrabRec tempGrab; GrabRec tempGrab;
int rc;
REQUEST_SIZE_MATCH(xUngrabButtonReq); REQUEST_SIZE_MATCH(xUngrabButtonReq);
if ((stuff->modifiers != AnyModifier) && if ((stuff->modifiers != AnyModifier) &&
@ -4297,9 +4302,9 @@ ProcUngrabButton(ClientPtr client)
client->errorValue = stuff->modifiers; client->errorValue = stuff->modifiers;
return BadValue; return BadValue;
} }
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
tempGrab.resource = client->clientAsMask; tempGrab.resource = client->clientAsMask;
tempGrab.device = inputInfo.pointer; tempGrab.device = inputInfo.pointer;
tempGrab.window = pWin; tempGrab.window = pWin;
@ -4451,7 +4456,7 @@ ProcRecolorCursor(ClientPtr client)
REQUEST_SIZE_MATCH(xRecolorCursorReq); REQUEST_SIZE_MATCH(xRecolorCursorReq);
pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
RT_CURSOR, SecurityWriteAccess); RT_CURSOR, DixWriteAccess);
if ( !pCursor) if ( !pCursor)
{ {
client->errorValue = stuff->cursor; client->errorValue = stuff->cursor;

View File

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

View File

@ -761,7 +761,7 @@ SwitchCorePointer(DeviceIntPtr pDev)
* to shift the pointer to get it inside the new bounds. * to shift the pointer to get it inside the new bounds.
*/ */
void void
PostSyntheticMotion(int x, int y, ScreenPtr pScreen, unsigned long time) PostSyntheticMotion(int x, int y, int screen, unsigned long time)
{ {
xEvent xE; xEvent xE;
@ -770,8 +770,8 @@ PostSyntheticMotion(int x, int y, ScreenPtr pScreen, unsigned long time)
will translate from sprite screen to screen 0 upon reentry will translate from sprite screen to screen 0 upon reentry
to the DIX layer. */ to the DIX layer. */
if (!noPanoramiXExtension) { if (!noPanoramiXExtension) {
x += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x; x += panoramiXdataPtr[0].x - panoramiXdataPtr[screen].x;
y += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y; y += panoramiXdataPtr[0].y - panoramiXdataPtr[screen].y;
} }
#endif #endif

View File

@ -94,7 +94,7 @@ PrintPropertys(WindowPtr pWin)
int int
ProcRotateProperties(ClientPtr client) ProcRotateProperties(ClientPtr client)
{ {
int i, j, delta; int i, j, delta, rc;
REQUEST(xRotatePropertiesReq); REQUEST(xRotatePropertiesReq);
WindowPtr pWin; WindowPtr pWin;
register Atom * atoms; register Atom * atoms;
@ -104,10 +104,9 @@ ProcRotateProperties(ClientPtr client)
REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
UpdateCurrentTime(); UpdateCurrentTime();
pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
SecurityWriteAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
if (!stuff->nAtoms) if (!stuff->nAtoms)
return(Success); return(Success);
atoms = (Atom *) & stuff[1]; atoms = (Atom *) & stuff[1];
@ -117,7 +116,7 @@ ProcRotateProperties(ClientPtr client)
for (i = 0; i < stuff->nAtoms; i++) for (i = 0; i < stuff->nAtoms; i++)
{ {
char action = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, atoms[i], char action = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, atoms[i],
SecurityReadAccess|SecurityWriteAccess); DixReadAccess|DixWriteAccess);
if (!ValidAtom(atoms[i]) || (XaceErrorOperation == action)) { if (!ValidAtom(atoms[i]) || (XaceErrorOperation == action)) {
DEALLOCATE_LOCAL(props); DEALLOCATE_LOCAL(props);
@ -181,9 +180,7 @@ ProcChangeProperty(ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
char format, mode; char format, mode;
unsigned long len; unsigned long len;
int sizeInBytes; int sizeInBytes, totalSize, err;
int totalSize;
int err;
REQUEST(xChangePropertyReq); REQUEST(xChangePropertyReq);
REQUEST_AT_LEAST_SIZE(xChangePropertyReq); REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
@ -208,10 +205,9 @@ ProcChangeProperty(ClientPtr client)
totalSize = len * sizeInBytes; totalSize = len * sizeInBytes;
REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize); REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, err = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
SecurityWriteAccess); if (err != Success)
if (!pWin) return err;
return(BadWindow);
if (!ValidAtom(stuff->property)) if (!ValidAtom(stuff->property))
{ {
client->errorValue = stuff->property; client->errorValue = stuff->property;
@ -224,7 +220,7 @@ ProcChangeProperty(ClientPtr client)
} }
switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property, switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
SecurityWriteAccess)) DixWriteAccess))
{ {
case XaceErrorOperation: case XaceErrorOperation:
client->errorValue = stuff->property; client->errorValue = stuff->property;
@ -445,19 +441,18 @@ int
ProcGetProperty(ClientPtr client) ProcGetProperty(ClientPtr client)
{ {
PropertyPtr pProp, prevProp; PropertyPtr pProp, prevProp;
unsigned long n, len, ind; unsigned long n, len, ind, rc;
WindowPtr pWin; WindowPtr pWin;
xGetPropertyReply reply; xGetPropertyReply reply;
Mask access_mode = SecurityReadAccess; Mask access_mode = DixReadAccess;
REQUEST(xGetPropertyReq); REQUEST(xGetPropertyReq);
REQUEST_SIZE_MATCH(xGetPropertyReq); REQUEST_SIZE_MATCH(xGetPropertyReq);
if (stuff->delete) if (stuff->delete)
UpdateCurrentTime(); UpdateCurrentTime();
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
if (!pWin) return rc;
return BadWindow;
if (!ValidAtom(stuff->property)) if (!ValidAtom(stuff->property))
{ {
@ -491,7 +486,7 @@ ProcGetProperty(ClientPtr client)
return NullPropertyReply(client, None, 0, &reply); return NullPropertyReply(client, None, 0, &reply);
if (stuff->delete) if (stuff->delete)
access_mode |= SecurityDestroyAccess; access_mode |= DixDestroyAccess;
switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property, switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
access_mode)) access_mode))
{ {
@ -585,16 +580,15 @@ ProcListProperties(ClientPtr client)
{ {
Atom *pAtoms = NULL, *temppAtoms; Atom *pAtoms = NULL, *temppAtoms;
xListPropertiesReply xlpr; xListPropertiesReply xlpr;
int numProps = 0; int rc, numProps = 0;
WindowPtr pWin; WindowPtr pWin;
PropertyPtr pProp; PropertyPtr pProp;
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
SecurityReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
pProp = wUserProps (pWin); pProp = wUserProps (pWin);
while (pProp) while (pProp)
@ -636,10 +630,9 @@ ProcDeleteProperty(register ClientPtr client)
REQUEST_SIZE_MATCH(xDeletePropertyReq); REQUEST_SIZE_MATCH(xDeletePropertyReq);
UpdateCurrentTime(); UpdateCurrentTime();
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, result = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
SecurityWriteAccess); if (result != Success)
if (!pWin) return result;
return(BadWindow);
if (!ValidAtom(stuff->property)) if (!ValidAtom(stuff->property))
{ {
client->errorValue = stuff->property; client->errorValue = stuff->property;
@ -647,7 +640,7 @@ ProcDeleteProperty(register ClientPtr client)
} }
switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property, switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
SecurityDestroyAccess)) DixDestroyAccess))
{ {
case XaceErrorOperation: case XaceErrorOperation:
client->errorValue = stuff->property; client->errorValue = stuff->property;

View File

@ -944,12 +944,12 @@ _X_EXPORT pointer
LookupIDByType(XID id, RESTYPE rtype) LookupIDByType(XID id, RESTYPE rtype)
{ {
return SecurityLookupIDByType(NullClient, id, rtype, return SecurityLookupIDByType(NullClient, id, rtype,
SecurityUnknownAccess); DixUnknownAccess);
} }
_X_EXPORT pointer _X_EXPORT pointer
LookupIDByClass(XID id, RESTYPE classes) LookupIDByClass(XID id, RESTYPE classes)
{ {
return SecurityLookupIDByClass(NullClient, id, classes, return SecurityLookupIDByClass(NullClient, id, classes,
SecurityUnknownAccess); DixUnknownAccess);
} }

View File

@ -1062,7 +1062,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
else else
{ {
pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID, pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID,
RT_PIXMAP, SecurityReadAccess); RT_PIXMAP, DixReadAccess);
if (pPixmap != (PixmapPtr) NULL) if (pPixmap != (PixmapPtr) NULL)
{ {
if ((pPixmap->drawable.depth != pWin->drawable.depth) || if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
@ -1123,7 +1123,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
else else
{ {
pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID, pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID,
RT_PIXMAP, SecurityReadAccess); RT_PIXMAP, DixReadAccess);
if (pPixmap) if (pPixmap)
{ {
if ((pPixmap->drawable.depth != pWin->drawable.depth) || if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
@ -1333,7 +1333,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
goto PatchUp; goto PatchUp;
} }
pCmap = (ColormapPtr)SecurityLookupIDByType(client, cmap, pCmap = (ColormapPtr)SecurityLookupIDByType(client, cmap,
RT_COLORMAP, SecurityReadAccess); RT_COLORMAP, DixReadAccess);
if (!pCmap) if (!pCmap)
{ {
error = BadColor; error = BadColor;
@ -1409,7 +1409,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
else else
{ {
pCursor = (CursorPtr)SecurityLookupIDByType(client, cursorID, pCursor = (CursorPtr)SecurityLookupIDByType(client, cursorID,
RT_CURSOR, SecurityReadAccess); RT_CURSOR, DixReadAccess);
if (!pCursor) if (!pCursor)
{ {
error = BadCursor; error = BadCursor;
@ -2299,7 +2299,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP
sibwid = (Window ) *pVlist; sibwid = (Window ) *pVlist;
pVlist++; pVlist++;
pSib = (WindowPtr )SecurityLookupIDByType(client, sibwid, pSib = (WindowPtr )SecurityLookupIDByType(client, sibwid,
RT_WINDOW, SecurityReadAccess); RT_WINDOW, DixReadAccess);
if (!pSib) if (!pSib)
{ {
client->errorValue = sibwid; client->errorValue = sibwid;

View File

@ -159,6 +159,14 @@ default state is platform and configuration specific.
disables DPMS (display power management services). The default state disables DPMS (display power management services). The default state
is platform and configuration specific. is platform and configuration specific.
.TP 8 .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 .B \-f \fIvolume\fP
sets feep (bell) volume (allowable range: 0-100). sets feep (bell) volume (allowable range: 0-100).
.TP 8 .TP 8

141
exa/exa.c
View File

@ -32,6 +32,10 @@
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#ifdef MITSHM
#include "shmint.h"
#endif
#include <stdlib.h> #include <stdlib.h>
#include "exa_priv.h" #include "exa_priv.h"
@ -117,18 +121,78 @@ exaGetDrawablePixmap(DrawablePtr pDrawable)
return (PixmapPtr) pDrawable; return (PixmapPtr) pDrawable;
} }
/**
* Sets the offsets to add to coordinates to make them address the same bits in
* the backing drawable. These coordinates are nonzero only for redirected
* windows.
*/
static void
exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
int *xp, int *yp)
{
#ifdef COMPOSITE
if (pDrawable->type == DRAWABLE_WINDOW) {
*xp = -pPixmap->screen_x;
*yp = -pPixmap->screen_y;
return;
}
#endif
*xp = 0;
*yp = 0;
}
/**
* exaPixmapDirty() marks a pixmap as dirty, allowing for
* optimizations in pixmap migration when no changes have occurred.
*/
void
exaPixmapDirty (PixmapPtr pPix, int x1, int y1, int x2, int y2)
{
ExaPixmapPriv(pPix);
BoxRec box;
RegionPtr pDamageReg;
RegionRec region;
if (!pExaPixmap)
return;
box.x1 = max(x1, 0);
box.y1 = max(y1, 0);
box.x2 = min(x2, pPix->drawable.width);
box.y2 = min(y2, pPix->drawable.height);
if (box.x1 >= box.x2 || box.y1 >= box.y2)
return;
pDamageReg = DamageRegion(pExaPixmap->pDamage);
REGION_INIT(pScreen, &region, &box, 1);
REGION_UNION(pScreen, pDamageReg, pDamageReg, &region);
REGION_UNINIT(pScreen, &region);
}
/** /**
* exaDrawableDirty() marks a pixmap backing a drawable as dirty, allowing for * exaDrawableDirty() marks a pixmap backing a drawable as dirty, allowing for
* optimizations in pixmap migration when no changes have occurred. * optimizations in pixmap migration when no changes have occurred.
*/ */
void void
exaDrawableDirty (DrawablePtr pDrawable) exaDrawableDirty (DrawablePtr pDrawable, int x1, int y1, int x2, int y2)
{ {
ExaPixmapPrivPtr pExaPixmap; PixmapPtr pPix = exaGetDrawablePixmap(pDrawable);
int xoff, yoff;
pExaPixmap = ExaGetPixmapPriv(exaGetDrawablePixmap (pDrawable)); x1 = max(x1, pDrawable->x);
if (pExaPixmap != NULL) y1 = max(y1, pDrawable->y);
pExaPixmap->dirty = TRUE; x2 = min(x2, pDrawable->x + pDrawable->width);
y2 = min(y2, pDrawable->y + pDrawable->height);
if (x1 >= x2 || y1 >= y2)
return;
exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff);
exaPixmapDirty(pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff);
} }
static Bool static Bool
@ -149,6 +213,7 @@ exaDestroyPixmap (PixmapPtr pPixmap)
pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr; pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
pPixmap->devKind = pExaPixmap->sys_pitch; pPixmap->devKind = pExaPixmap->sys_pitch;
} }
REGION_UNINIT(pPixmap->drawable.pScreen, &pExaPixmap->validReg);
} }
return fbDestroyPixmap (pPixmap); return fbDestroyPixmap (pPixmap);
} }
@ -216,7 +281,20 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
return NULL; return NULL;
} }
pExaPixmap->dirty = FALSE; /* Set up damage tracking */
pExaPixmap->pDamage = DamageCreate (NULL, NULL, DamageReportNone, TRUE,
pScreen, pPixmap);
if (pExaPixmap->pDamage == NULL) {
fbDestroyPixmap (pPixmap);
return NULL;
}
DamageRegister (&pPixmap->drawable, pExaPixmap->pDamage);
DamageSetReportAfterOp (pExaPixmap->pDamage, TRUE);
/* None of the pixmap bits are valid initially */
REGION_NULL(pScreen, &pExaPixmap->validReg);
return pPixmap; return pPixmap;
} }
@ -261,32 +339,14 @@ exaDrawableIsOffscreen (DrawablePtr pDrawable)
/** /**
* Returns the pixmap which backs a drawable, and the offsets to add to * Returns the pixmap which backs a drawable, and the offsets to add to
* coordinates to make them address the same bits in the backing drawable. * coordinates to make them address the same bits in the backing drawable.
* These coordinates are nonzero only for redirected windows.
*/ */
PixmapPtr PixmapPtr
exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp) exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
{ {
PixmapPtr pPixmap; PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
int x, y;
exaGetDrawableDeltas (pDrawable, pPixmap, xp, yp);
if (pDrawable->type == DRAWABLE_WINDOW) {
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
#ifdef COMPOSITE
x = -pPixmap->screen_x;
y = -pPixmap->screen_y;
#else
x = 0;
y = 0;
#endif
}
else
{
pPixmap = (PixmapPtr) pDrawable;
x = 0;
y = 0;
}
*xp = x;
*yp = y;
if (exaPixmapIsOffscreen (pPixmap)) if (exaPixmapIsOffscreen (pPixmap))
return pPixmap; return pPixmap;
else else
@ -334,8 +394,7 @@ exaPrepareAccess(DrawablePtr pDrawable, int index)
/** /**
* exaFinishAccess() is EXA's wrapper for the driver's FinishAccess() handler. * exaFinishAccess() is EXA's wrapper for the driver's FinishAccess() handler.
* *
* It deals with marking drawables as dirty, and calling the driver's * It deals with calling the driver's FinishAccess() only if necessary.
* FinishAccess() only if necessary.
*/ */
void void
exaFinishAccess(DrawablePtr pDrawable, int index) exaFinishAccess(DrawablePtr pDrawable, int index)
@ -345,9 +404,6 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
PixmapPtr pPixmap; PixmapPtr pPixmap;
ExaPixmapPrivPtr pExaPixmap; ExaPixmapPrivPtr pExaPixmap;
if (index == EXA_PREPARE_DEST)
exaDrawableDirty (pDrawable);
pPixmap = exaGetDrawablePixmap (pDrawable); pPixmap = exaGetDrawablePixmap (pDrawable);
pExaPixmap = ExaGetPixmapPriv(pPixmap); pExaPixmap = ExaGetPixmapPriv(pPixmap);
@ -373,7 +429,7 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
* accelerated or may sync the card and fall back to fb. * accelerated or may sync the card and fall back to fb.
*/ */
static void static void
exaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) exaValidateGC (GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{ {
/* fbValidateGC will do direct access to pixmaps if the tiling has changed. /* fbValidateGC will do direct access to pixmaps if the tiling has changed.
* Preempt fbValidateGC by doing its work and masking the change out, so * Preempt fbValidateGC by doing its work and masking the change out, so
@ -404,6 +460,7 @@ exaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
exaPrepareAccess(&pOldTile->drawable, EXA_PREPARE_SRC); exaPrepareAccess(&pOldTile->drawable, EXA_PREPARE_SRC);
pNewTile = fb24_32ReformatTile (pOldTile, pNewTile = fb24_32ReformatTile (pOldTile,
pDrawable->bitsPerPixel); pDrawable->bitsPerPixel);
exaPixmapDirty(pNewTile, 0, 0, pNewTile->drawable.width, pNewTile->drawable.height);
exaFinishAccess(&pOldTile->drawable, EXA_PREPARE_SRC); exaFinishAccess(&pOldTile->drawable, EXA_PREPARE_SRC);
} }
if (pNewTile) if (pNewTile)
@ -419,9 +476,14 @@ exaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
if (!pGC->tileIsPixel && FbEvenTile (pGC->tile.pixmap->drawable.width * if (!pGC->tileIsPixel && FbEvenTile (pGC->tile.pixmap->drawable.width *
pDrawable->bitsPerPixel)) pDrawable->bitsPerPixel))
{ {
exaPrepareAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_SRC); /* XXX This fixes corruption with tiled pixmaps, but may just be a
* workaround for broken drivers
*/
exaMoveOutPixmap(pGC->tile.pixmap);
fbPadPixmap (pGC->tile.pixmap); fbPadPixmap (pGC->tile.pixmap);
exaFinishAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_SRC); exaPixmapDirty(pGC->tile.pixmap, 0, 0,
pGC->tile.pixmap->drawable.width,
pGC->tile.pixmap->drawable.height);
} }
/* Mask out the GCTile change notification, now that we've done FB's /* Mask out the GCTile change notification, now that we've done FB's
* job for it. * job for it.
@ -560,7 +622,7 @@ exaDriverInit (ScreenPtr pScreen,
pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr; pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr;
pExaScr->migration = ExaMigrationSmart; pExaScr->migration = ExaMigrationAlways;
exaDDXDriverInit(pScreen); exaDDXDriverInit(pScreen);
@ -610,6 +672,13 @@ exaDriverInit (ScreenPtr pScreen,
miDisableCompositeWrapper(pScreen); miDisableCompositeWrapper(pScreen);
#endif #endif
#ifdef MITSHM
/* Re-register with the MI funcs, which don't allow shared pixmaps.
* Shared pixmaps are almost always a performance loss for us, but this
* still allows for SHM PutImage.
*/
ShmRegisterFuncs(pScreen, NULL);
#endif
/* /*
* Hookup offscreen pixmaps * Hookup offscreen pixmaps
*/ */

View File

@ -716,6 +716,12 @@ exaGetPixmapSize(PixmapPtr pPix);
void void
exaEnableDisableFBAccess (int index, Bool enable); exaEnableDisableFBAccess (int index, Bool enable);
void
exaMoveInPixmap (PixmapPtr pPixmap);
void
exaMoveOutPixmap (PixmapPtr pPixmap);
/** /**
* Returns TRUE if the given planemask covers all the significant bits in the * Returns TRUE if the given planemask covers all the significant bits in the
* pixel values for pDrawable. * pixel values for pDrawable.

View File

@ -20,6 +20,11 @@
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*
* Authors:
* Eric Anholt <eric@anholt.net>
* Michel Dänzer <michel@tungstengraphics.com>
*
*/ */
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
@ -49,12 +54,12 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable);
if (pExaScr->swappedOut || if (pExaScr->swappedOut ||
pGC->fillStyle != FillSolid || pGC->fillStyle != FillSolid ||
pDrawable->width > pExaScr->info->maxX || pPixmap->drawable.width > pExaScr->info->maxX ||
pDrawable->height > pExaScr->info->maxY) pPixmap->drawable.height > pExaScr->info->maxY)
{ {
exaDoMigration (pixmaps, 1, FALSE); exaDoMigration (pixmaps, 1, FALSE);
ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
@ -104,6 +109,8 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
(*pExaScr->info->Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
fullX1 + off_x, fullY1 + off_y, fullX1 + off_x, fullY1 + off_y,
fullX2 + off_x, fullY1 + 1 + off_y); fullX2 + off_x, fullY1 + 1 + off_y);
exaPixmapDirty (pPixmap, fullX1 + off_x, fullY1 + off_y,
fullX2 + off_x, fullY1 + 1 + off_y);
} }
else else
{ {
@ -118,17 +125,19 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
partX2 = pbox->x2; partX2 = pbox->x2;
if (partX2 > fullX2) if (partX2 > fullX2)
partX2 = fullX2; partX2 = fullX2;
if (partX2 > partX1) if (partX2 > partX1) {
(*pExaScr->info->Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
partX1 + off_x, fullY1 + off_y, partX1 + off_x, fullY1 + off_y,
partX2 + off_x, fullY1 + 1 + off_y); partX2 + off_x, fullY1 + 1 + off_y);
exaPixmapDirty (pPixmap, partX1 + off_x, fullY1 + off_y,
partX2 + off_x, fullY1 + 1 + off_y);
}
} }
pbox++; pbox++;
} }
} }
} }
(*pExaScr->info->DoneSolid) (pPixmap); (*pExaScr->info->DoneSolid) (pPixmap);
exaDrawableDirty (pDrawable);
exaMarkSync(pScreen); exaMarkSync(pScreen);
} }
@ -222,8 +231,8 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
exaFinishAccess(pDrawable, EXA_PREPARE_DEST); exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
} }
exaPixmapDirty(pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff);
} }
exaDrawableDirty(pDrawable);
return; return;
@ -351,11 +360,12 @@ exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
dst_off_y + pbox->y1 + i, dst_off_y + pbox->y1 + i,
pbox->x2 - pbox->x1, 1); pbox->x2 - pbox->x1, 1);
} }
exaPixmapDirty(pDstPixmap, dst_off_x + pbox->x1, dst_off_y + pbox->y1,
dst_off_x + pbox->x2, dst_off_y + pbox->y2);
} }
if (dirsetup != 0) if (dirsetup != 0)
pExaScr->info->DoneCopy(pDstPixmap); pExaScr->info->DoneCopy(pDstPixmap);
exaMarkSync(pDstDrawable->pScreen); exaMarkSync(pDstDrawable->pScreen);
exaDrawableDirty(pDstDrawable);
return TRUE; return TRUE;
} }
@ -380,19 +390,19 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDstDrawable); pixmaps[0].pPix = pDstPixmap = exaGetDrawablePixmap (pDstDrawable);
pixmaps[1].as_dst = FALSE; pixmaps[1].as_dst = FALSE;
pixmaps[1].as_src = TRUE; pixmaps[1].as_src = TRUE;
pixmaps[1].pPix = exaGetDrawablePixmap (pSrcDrawable); pixmaps[1].pPix = pSrcPixmap = exaGetDrawablePixmap (pSrcDrawable);
/* Respect maxX/maxY in a trivial way: don't set up drawing when we might /* Respect maxX/maxY in a trivial way: don't set up drawing when we might
* violate the limits. The proper solution would be a temporary pixmap * violate the limits. The proper solution would be a temporary pixmap
* adjusted so that the drawing happened within limits. * adjusted so that the drawing happened within limits.
*/ */
if (pSrcDrawable->width > pExaScr->info->maxX || if (pSrcPixmap->drawable.width > pExaScr->info->maxX ||
pSrcDrawable->height > pExaScr->info->maxY || pSrcPixmap->drawable.height > pExaScr->info->maxY ||
pDstDrawable->width > pExaScr->info->maxX || pDstPixmap->drawable.width > pExaScr->info->maxX ||
pDstDrawable->height > pExaScr->info->maxY) pDstPixmap->drawable.height > pExaScr->info->maxY)
{ {
exaDoMigration (pixmaps, 2, FALSE); exaDoMigration (pixmaps, 2, FALSE);
goto fallback; goto fallback;
@ -401,7 +411,8 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
} }
/* Mixed directions must be handled specially if the card is lame */ /* Mixed directions must be handled specially if the card is lame */
if (pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS && (dx*dy) < 0) { if (pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS &&
reverse != upsidedown) {
if (!exaCopyNtoNTwoDir(pSrcDrawable, pDstDrawable, pGC, pbox, nbox, if (!exaCopyNtoNTwoDir(pSrcDrawable, pDstDrawable, pGC, pbox, nbox,
dx, dy)) dx, dy))
goto fallback; goto fallback;
@ -411,7 +422,7 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
if ((pSrcPixmap = exaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) && if ((pSrcPixmap = exaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) &&
(pDstPixmap = exaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) && (pDstPixmap = exaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) &&
(*pExaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap, (*pExaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap,
dx, dy, reverse ? -1 : 1, upsidedown ? -1 : 1,
pGC ? pGC->alu : GXcopy, pGC ? pGC->alu : GXcopy,
pGC ? pGC->planemask : FB_ALLONES)) pGC ? pGC->planemask : FB_ALLONES))
{ {
@ -423,11 +434,13 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 - pbox->x1, pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1); pbox->y2 - pbox->y1);
exaPixmapDirty (pDstPixmap,
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
pbox++; pbox++;
} }
(*pExaScr->info->DoneCopy) (pDstPixmap); (*pExaScr->info->DoneCopy) (pDstPixmap);
exaMarkSync(pDstDrawable->pScreen); exaMarkSync(pDstDrawable->pScreen);
exaDrawableDirty (pDstDrawable);
return; return;
} }
@ -442,6 +455,11 @@ fallback:
bitplane, closure); bitplane, closure);
exaFinishAccess (pSrcDrawable, EXA_PREPARE_SRC); exaFinishAccess (pSrcDrawable, EXA_PREPARE_SRC);
exaFinishAccess (pDstDrawable, EXA_PREPARE_DEST); exaFinishAccess (pDstDrawable, EXA_PREPARE_DEST);
while (nbox--)
{
exaDrawableDirty (pDstDrawable, pbox->x1, pbox->y1, pbox->x2, pbox->y2);
pbox++;
}
} }
RegionPtr RegionPtr
@ -621,12 +639,12 @@ exaPolyFillRect(DrawablePtr pDrawable,
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable);
if (pExaScr->swappedOut || if (pExaScr->swappedOut ||
pGC->fillStyle != FillSolid || pGC->fillStyle != FillSolid ||
pDrawable->width > pExaScr->info->maxX || pPixmap->drawable.width > pExaScr->info->maxX ||
pDrawable->height > pExaScr->info->maxY) pPixmap->drawable.height > pExaScr->info->maxY)
{ {
exaDoMigration (pixmaps, 1, FALSE); exaDoMigration (pixmaps, 1, FALSE);
ExaCheckPolyFillRect (pDrawable, pGC, nrect, prect); ExaCheckPolyFillRect (pDrawable, pGC, nrect, prect);
@ -681,6 +699,8 @@ exaPolyFillRect(DrawablePtr pDrawable,
(*pExaScr->info->Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
fullX1 + xoff, fullY1 + yoff, fullX1 + xoff, fullY1 + yoff,
fullX2 + xoff, fullY2 + yoff); fullX2 + xoff, fullY2 + yoff);
exaPixmapDirty (pPixmap, fullX1 + xoff, fullY1 + yoff,
fullX2 + xoff, fullY2 + yoff);
} }
else else
{ {
@ -706,15 +726,17 @@ exaPolyFillRect(DrawablePtr pDrawable,
pbox++; pbox++;
if (partX1 < partX2 && partY1 < partY2) if (partX1 < partX2 && partY1 < partY2) {
(*pExaScr->info->Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
partX1 + xoff, partY1 + yoff, partX1 + xoff, partY1 + yoff,
partX2 + xoff, partY2 + yoff); partX2 + xoff, partY2 + yoff);
exaPixmapDirty (pPixmap, partX1 + xoff, partY1 + yoff,
partX2 + xoff, partY2 + yoff);
}
} }
} }
} }
(*pExaScr->info->DoneSolid) (pPixmap); (*pExaScr->info->DoneSolid) (pPixmap);
exaDrawableDirty (pDrawable);
exaMarkSync(pDrawable->pScreen); exaMarkSync(pDrawable->pScreen);
} }
@ -735,14 +757,15 @@ exaSolidBoxClipped (DrawablePtr pDrawable,
int xoff, yoff; int xoff, yoff;
int partX1, partX2, partY1, partY2; int partX1, partX2, partY1, partY2;
ExaMigrationRec pixmaps[1]; ExaMigrationRec pixmaps[1];
Bool fallback = FALSE;
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable);
if (pExaScr->swappedOut || if (pExaScr->swappedOut ||
pDrawable->width > pExaScr->info->maxX || pPixmap->drawable.width > pExaScr->info->maxX ||
pDrawable->height > pExaScr->info->maxY) pPixmap->drawable.height > pExaScr->info->maxY)
{ {
exaDoMigration (pixmaps, 1, FALSE); exaDoMigration (pixmaps, 1, FALSE);
goto fallback; goto fallback;
@ -750,19 +773,21 @@ exaSolidBoxClipped (DrawablePtr pDrawable,
exaDoMigration (pixmaps, 1, TRUE); exaDoMigration (pixmaps, 1, TRUE);
} }
if (!(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
if (!pPixmap ||
!(*pExaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg)) !(*pExaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg))
{ {
fallback: fallback:
EXA_FALLBACK(("to %p (%c)\n", pDrawable, EXA_FALLBACK(("to %p (%c)\n", pDrawable,
exaDrawableLocation(pDrawable))); exaDrawableLocation(pDrawable)));
fallback = TRUE;
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel); fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel);
fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2, fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2,
fbAnd (GXcopy, fg, pm), fbAnd (GXcopy, fg, pm),
fbXor (GXcopy, fg, pm)); fbXor (GXcopy, fg, pm));
exaFinishAccess (pDrawable, EXA_PREPARE_DEST); exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
return;
} }
for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip); for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);
nbox--; nbox--;
@ -790,12 +815,20 @@ fallback:
if (partY2 <= partY1) if (partY2 <= partY1)
continue; continue;
(*pExaScr->info->Solid) (pPixmap, if (!fallback) {
partX1 + xoff, partY1 + yoff, (*pExaScr->info->Solid) (pPixmap,
partX2 + xoff, partY2 + yoff); partX1 + xoff, partY1 + yoff,
partX2 + xoff, partY2 + yoff);
exaPixmapDirty (pPixmap, partX1 + xoff, partY1 + yoff,
partX2 + xoff, partY2 + yoff);
} else
exaDrawableDirty (pDrawable, partX1, partY1, partX2, partY2);
} }
if (fallback)
return;
(*pExaScr->info->DoneSolid) (pPixmap); (*pExaScr->info->DoneSolid) (pPixmap);
exaDrawableDirty (pDrawable);
exaMarkSync(pDrawable->pScreen); exaMarkSync(pDrawable->pScreen);
} }
@ -908,12 +941,17 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
pPriv->fg, pPriv->fg,
gx + dstXoff, gx + dstXoff,
gHeight); gHeight);
exaDrawableDirty (pDrawable, gx, gy, gx + gWidth, gy + gHeight);
} }
else else
{ {
RegionPtr pClip = fbGetCompositeClip(pGC);
int nbox;
BoxPtr pbox;
gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip); gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
fbPutXYImage (pDrawable, fbPutXYImage (pDrawable,
fbGetCompositeClip(pGC), pClip,
pPriv->fg, pPriv->fg,
pPriv->bg, pPriv->bg,
pPriv->pm, pPriv->pm,
@ -927,6 +965,18 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
(FbStip *) pglyph, (FbStip *) pglyph,
gStride, gStride,
0); 0);
for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);
nbox--; pbox++) {
int x1 = max(gx, pbox->x1), x2 = min(gx + gWidth, pbox->x2);
int y1 = max(gy, pbox->y1), y2 = min(gy + gHeight, pbox->y2);
if (x1 >= x2 || y1 >= y2)
continue;
exaDrawableDirty (pDrawable, gx, gy, gx + gWidth,
gy + gHeight);
}
} }
} }
x += pci->metrics.characterWidth; x += pci->metrics.characterWidth;
@ -994,13 +1044,15 @@ exaFillRegionSolid (DrawablePtr pDrawable,
PixmapPtr pPixmap; PixmapPtr pPixmap;
int xoff, yoff; int xoff, yoff;
ExaMigrationRec pixmaps[1]; ExaMigrationRec pixmaps[1];
int nbox = REGION_NUM_RECTS (pRegion);
BoxPtr pBox = REGION_RECTS (pRegion);
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable);
if (pDrawable->width > pExaScr->info->maxX || if (pPixmap->drawable.width > pExaScr->info->maxX ||
pDrawable->height > pExaScr->info->maxY) pPixmap->drawable.height > pExaScr->info->maxY)
{ {
exaDoMigration (pixmaps, 1, FALSE); exaDoMigration (pixmaps, 1, FALSE);
goto fallback; goto fallback;
@ -1011,19 +1063,17 @@ exaFillRegionSolid (DrawablePtr pDrawable,
if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) &&
(*pExaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel)) (*pExaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel))
{ {
int nbox = REGION_NUM_RECTS (pRegion);
BoxPtr pBox = REGION_RECTS (pRegion);
while (nbox--) while (nbox--)
{ {
(*pExaScr->info->Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
pBox->x1 + xoff, pBox->y1 + yoff, pBox->x1 + xoff, pBox->y1 + yoff,
pBox->x2 + xoff, pBox->y2 + yoff); pBox->x2 + xoff, pBox->y2 + yoff);
exaPixmapDirty (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff,
pBox->x2 + xoff, pBox->y2 + yoff);
pBox++; pBox++;
} }
(*pExaScr->info->DoneSolid) (pPixmap); (*pExaScr->info->DoneSolid) (pPixmap);
exaMarkSync(pDrawable->pScreen); exaMarkSync(pDrawable->pScreen);
exaDrawableDirty (pDrawable);
} }
else else
{ {
@ -1034,6 +1084,11 @@ fallback:
fbFillRegionSolid (pDrawable, pRegion, 0, fbFillRegionSolid (pDrawable, pRegion, 0,
fbReplicatePixel (pixel, pDrawable->bitsPerPixel)); fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
exaFinishAccess (pDrawable, EXA_PREPARE_DEST); exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
while (nbox--)
{
exaDrawableDirty (pDrawable, pBox->x1, pBox->y1, pBox->x2, pBox->y2);
pBox++;
}
} }
} }
@ -1047,9 +1102,11 @@ exaFillRegionTiled (DrawablePtr pDrawable,
{ {
ExaScreenPriv(pDrawable->pScreen); ExaScreenPriv(pDrawable->pScreen);
PixmapPtr pPixmap; PixmapPtr pPixmap;
int xoff, yoff; int xoff, yoff, tileXoff, tileYoff;
int tileWidth, tileHeight; int tileWidth, tileHeight;
ExaMigrationRec pixmaps[2]; ExaMigrationRec pixmaps[2];
int nbox = REGION_NUM_RECTS (pRegion);
BoxPtr pBox = REGION_RECTS (pRegion);
tileWidth = pTile->drawable.width; tileWidth = pTile->drawable.width;
tileHeight = pTile->drawable.height; tileHeight = pTile->drawable.height;
@ -1064,13 +1121,13 @@ exaFillRegionTiled (DrawablePtr pDrawable,
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable);
pixmaps[1].as_dst = FALSE; pixmaps[1].as_dst = FALSE;
pixmaps[1].as_src = TRUE; pixmaps[1].as_src = TRUE;
pixmaps[1].pPix = pTile; pixmaps[1].pPix = pTile;
if (pDrawable->width > pExaScr->info->maxX || if (pPixmap->drawable.width > pExaScr->info->maxX ||
pDrawable->height > pExaScr->info->maxY || pPixmap->drawable.height > pExaScr->info->maxY ||
tileWidth > pExaScr->info->maxX || tileWidth > pExaScr->info->maxX ||
tileHeight > pExaScr->info->maxY) tileHeight > pExaScr->info->maxY)
{ {
@ -1081,18 +1138,16 @@ exaFillRegionTiled (DrawablePtr pDrawable,
} }
pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
if (!pPixmap) if (!pPixmap)
goto fallback; goto fallback;
if (!exaPixmapIsOffscreen(pTile)) if (!exaPixmapIsOffscreen(pTile))
goto fallback; goto fallback;
if ((*pExaScr->info->PrepareCopy) (pTile, pPixmap, 0, 0, GXcopy, if ((*pExaScr->info->PrepareCopy) (exaGetOffscreenPixmap((DrawablePtr)pTile, &tileXoff, &tileYoff), pPixmap, 0, 0, GXcopy,
FB_ALLONES)) FB_ALLONES))
{ {
int nbox = REGION_NUM_RECTS (pRegion);
BoxPtr pBox = REGION_RECTS (pRegion);
while (nbox--) while (nbox--)
{ {
int height = pBox->y2 - pBox->y1; int height = pBox->y2 - pBox->y1;
@ -1118,7 +1173,7 @@ exaFillRegionTiled (DrawablePtr pDrawable,
width -= w; width -= w;
(*pExaScr->info->Copy) (pPixmap, (*pExaScr->info->Copy) (pPixmap,
tileX, tileY, tileX + tileXoff, tileY + tileYoff,
dstX + xoff, dstY + yoff, dstX + xoff, dstY + yoff,
w, h); w, h);
dstX += w; dstX += w;
@ -1127,11 +1182,12 @@ exaFillRegionTiled (DrawablePtr pDrawable,
dstY += h; dstY += h;
tileY = 0; tileY = 0;
} }
exaPixmapDirty (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff,
pBox->x2 + xoff, pBox->y2 + yoff);
pBox++; pBox++;
} }
(*pExaScr->info->DoneCopy) (pPixmap); (*pExaScr->info->DoneCopy) (pPixmap);
exaMarkSync(pDrawable->pScreen); exaMarkSync(pDrawable->pScreen);
exaDrawableDirty (pDrawable);
return; return;
} }
@ -1144,6 +1200,11 @@ fallback:
fbFillRegionTiled (pDrawable, pRegion, pTile); fbFillRegionTiled (pDrawable, pRegion, pTile);
exaFinishAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC); exaFinishAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC);
exaFinishAccess (pDrawable, EXA_PREPARE_DEST); exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
while (nbox--)
{
exaDrawableDirty (pDrawable, pBox->x1, pBox->y1, pBox->x2, pBox->y2);
pBox++;
}
} }
void void

View File

@ -22,6 +22,7 @@
* *
* Authors: * Authors:
* Eric Anholt <eric@anholt.net> * Eric Anholt <eric@anholt.net>
* Michel Dänzer <michel@tungstengraphics.com>
* *
*/ */
@ -57,6 +58,27 @@ exaPixmapIsPinned (PixmapPtr pPix)
return pExaPixmap == NULL || pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED; return pExaPixmap == NULL || pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED;
} }
/**
* The fallback path for UTS/DFS failing is to just memcpy. exaCopyDirtyToSys
* and exaCopyDirtyToFb both needed to do this loop.
*/
static void
exaMemcpyBox (PixmapPtr pPixmap, BoxPtr pbox, CARD8 *src, int src_pitch,
CARD8 *dst, int dst_pitch)
{
int i, cpp = pPixmap->drawable.bitsPerPixel / 8;
int bytes = (pbox->x2 - pbox->x1) * cpp;
src += pbox->y1 * src_pitch + pbox->x1 * cpp;
dst += pbox->y1 * dst_pitch + pbox->x1 * cpp;
for (i = pbox->y2 - pbox->y1; i; i--) {
memcpy (dst, src, bytes);
src += src_pitch;
dst += dst_pitch;
}
}
/** /**
* Returns TRUE if the pixmap is dirty (has been modified in its current * Returns TRUE if the pixmap is dirty (has been modified in its current
* location compared to the other), or lacks a private for tracking * location compared to the other), or lacks a private for tracking
@ -67,7 +89,8 @@ exaPixmapIsDirty (PixmapPtr pPix)
{ {
ExaPixmapPriv (pPix); ExaPixmapPriv (pPix);
return pExaPixmap == NULL || pExaPixmap->dirty == TRUE; return pExaPixmap == NULL ||
REGION_NOTEMPTY (pScreen, DamageRegion(pExaPixmap->pDamage));
} }
/** /**
@ -98,54 +121,62 @@ exaCopyDirtyToSys (PixmapPtr pPixmap)
{ {
ExaScreenPriv (pPixmap->drawable.pScreen); ExaScreenPriv (pPixmap->drawable.pScreen);
ExaPixmapPriv (pPixmap); ExaPixmapPriv (pPixmap);
RegionPtr pRegion = DamageRegion (pExaPixmap->pDamage);
CARD8 *save_ptr; CARD8 *save_ptr;
int save_pitch; int save_pitch;
BoxPtr pBox = REGION_RECTS(pRegion);
if (!pExaPixmap->dirty) int nbox = REGION_NUM_RECTS(pRegion);
return; Bool do_sync = FALSE;
save_ptr = pPixmap->devPrivate.ptr; save_ptr = pPixmap->devPrivate.ptr;
save_pitch = pPixmap->devKind; save_pitch = pPixmap->devKind;
pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr; pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr;
pPixmap->devKind = pExaPixmap->fb_pitch; pPixmap->devKind = pExaPixmap->fb_pitch;
if (pExaScr->info->DownloadFromScreen == NULL || while (nbox--) {
!pExaScr->info->DownloadFromScreen (pPixmap, pBox->x1 = max(pBox->x1, 0);
0, pBox->y1 = max(pBox->y1, 0);
0, pBox->x2 = min(pBox->x2, pPixmap->drawable.width);
pPixmap->drawable.width, pBox->y2 = min(pBox->y2, pPixmap->drawable.height);
pPixmap->drawable.height,
pExaPixmap->sys_ptr,
pExaPixmap->sys_pitch))
{
char *src, *dst;
int src_pitch, dst_pitch, i, bytes;
exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC); if (pBox->x1 >= pBox->x2 || pBox->y1 >= pBox->y2)
continue;
dst = pExaPixmap->sys_ptr; if (pExaScr->info->DownloadFromScreen == NULL ||
dst_pitch = pExaPixmap->sys_pitch; !pExaScr->info->DownloadFromScreen (pPixmap,
src = pExaPixmap->fb_ptr; pBox->x1, pBox->y1,
src_pitch = pExaPixmap->fb_pitch; pBox->x2 - pBox->x1,
bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; pBox->y2 - pBox->y1,
pExaPixmap->sys_ptr
for (i = 0; i < pPixmap->drawable.height; i++) { + pBox->y1 * pExaPixmap->sys_pitch
memcpy (dst, src, bytes); + pBox->x1 * pPixmap->drawable.bitsPerPixel / 8,
dst += dst_pitch; pExaPixmap->sys_pitch))
src += src_pitch; {
exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
exaMemcpyBox (pPixmap, pBox,
pExaPixmap->fb_ptr, pExaPixmap->fb_pitch,
pExaPixmap->sys_ptr, pExaPixmap->sys_pitch);
exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
} }
exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC); else
do_sync = TRUE;
pBox++;
} }
/* Make sure the bits have actually landed, since we don't necessarily sync /* Make sure the bits have actually landed, since we don't necessarily sync
* when accessing pixmaps in system memory. * when accessing pixmaps in system memory.
*/ */
exaWaitSync (pPixmap->drawable.pScreen); if (do_sync)
exaWaitSync (pPixmap->drawable.pScreen);
pPixmap->devPrivate.ptr = save_ptr; pPixmap->devPrivate.ptr = save_ptr;
pPixmap->devKind = save_pitch; pPixmap->devKind = save_pitch;
pExaPixmap->dirty = FALSE; /* The previously damaged bits are now no longer damaged but valid */
REGION_UNION(pPixmap->drawable.pScreen,
&pExaPixmap->validReg, &pExaPixmap->validReg, pRegion);
DamageEmpty (pExaPixmap->pDamage);
} }
/** /**
@ -158,49 +189,59 @@ exaCopyDirtyToFb (PixmapPtr pPixmap)
{ {
ExaScreenPriv (pPixmap->drawable.pScreen); ExaScreenPriv (pPixmap->drawable.pScreen);
ExaPixmapPriv (pPixmap); ExaPixmapPriv (pPixmap);
RegionPtr pRegion = DamageRegion (pExaPixmap->pDamage);
CARD8 *save_ptr; CARD8 *save_ptr;
int save_pitch; int save_pitch;
BoxPtr pBox = REGION_RECTS(pRegion);
if (!pExaPixmap->dirty) int nbox = REGION_NUM_RECTS(pRegion);
return; Bool do_sync = FALSE;
save_ptr = pPixmap->devPrivate.ptr; save_ptr = pPixmap->devPrivate.ptr;
save_pitch = pPixmap->devKind; save_pitch = pPixmap->devKind;
pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr; pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr;
pPixmap->devKind = pExaPixmap->fb_pitch; pPixmap->devKind = pExaPixmap->fb_pitch;
if (pExaScr->info->UploadToScreen == NULL || while (nbox--) {
!pExaScr->info->UploadToScreen (pPixmap, pBox->x1 = max(pBox->x1, 0);
0, pBox->y1 = max(pBox->y1, 0);
0, pBox->x2 = min(pBox->x2, pPixmap->drawable.width);
pPixmap->drawable.width, pBox->y2 = min(pBox->y2, pPixmap->drawable.height);
pPixmap->drawable.height,
pExaPixmap->sys_ptr,
pExaPixmap->sys_pitch))
{
char *src, *dst;
int src_pitch, dst_pitch, i, bytes;
exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_DEST); if (pBox->x1 >= pBox->x2 || pBox->y1 >= pBox->y2)
continue;
dst = pExaPixmap->fb_ptr; if (pExaScr->info->UploadToScreen == NULL ||
dst_pitch = pExaPixmap->fb_pitch; !pExaScr->info->UploadToScreen (pPixmap,
src = pExaPixmap->sys_ptr; pBox->x1, pBox->y1,
src_pitch = pExaPixmap->sys_pitch; pBox->x2 - pBox->x1,
bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; pBox->y2 - pBox->y1,
pExaPixmap->sys_ptr
for (i = 0; i < pPixmap->drawable.height; i++) { + pBox->y1 * pExaPixmap->sys_pitch
memcpy (dst, src, bytes); + pBox->x1 * pPixmap->drawable.bitsPerPixel / 8,
dst += dst_pitch; pExaPixmap->sys_pitch))
src += src_pitch; {
exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_DEST);
exaMemcpyBox (pPixmap, pBox,
pExaPixmap->sys_ptr, pExaPixmap->sys_pitch,
pExaPixmap->fb_ptr, pExaPixmap->fb_pitch);
exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_DEST);
} }
exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_DEST); else
do_sync = TRUE;
pBox++;
} }
if (do_sync)
exaMarkSync (pPixmap->drawable.pScreen);
pPixmap->devPrivate.ptr = save_ptr; pPixmap->devPrivate.ptr = save_ptr;
pPixmap->devKind = save_pitch; pPixmap->devKind = save_pitch;
pExaPixmap->dirty = FALSE; /* The previously damaged bits are now no longer damaged but valid */
REGION_UNION(pPixmap->drawable.pScreen,
&pExaPixmap->validReg, &pExaPixmap->validReg, pRegion);
DamageEmpty (pExaPixmap->pDamage);
} }
/** /**
@ -213,6 +254,7 @@ exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area)
{ {
PixmapPtr pPixmap = area->privData; PixmapPtr pPixmap = area->privData;
ExaPixmapPriv(pPixmap); ExaPixmapPriv(pPixmap);
RegionPtr pDamageReg = DamageRegion(pExaPixmap->pDamage);
DBG_MIGRATE (("Save %p (%p) (%dx%d) (%c)\n", pPixmap, DBG_MIGRATE (("Save %p (%p) (%dx%d) (%c)\n", pPixmap,
(void*)(ExaGetPixmapPriv(pPixmap)->area ? (void*)(ExaGetPixmapPriv(pPixmap)->area ?
@ -231,10 +273,9 @@ exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area)
pExaPixmap->fb_ptr = NULL; pExaPixmap->fb_ptr = NULL;
pExaPixmap->area = NULL; pExaPixmap->area = NULL;
/* Mark it dirty now, to say that there is important data in the /* Mark all valid bits as damaged, so they'll get copied to FB next time */
* system-memory copy. REGION_UNION(pPixmap->drawable.pScreen, pDamageReg, pDamageReg,
*/ &pExaPixmap->validReg);
pExaPixmap->dirty = TRUE;
} }
/** /**
@ -413,32 +454,57 @@ exaMigrateTowardSys (PixmapPtr pPixmap)
* If the pixmap has both a framebuffer and system memory copy, this function * If the pixmap has both a framebuffer and system memory copy, this function
* asserts that both of them are the same. * asserts that both of them are the same.
*/ */
static void static Bool
exaAssertNotDirty (PixmapPtr pPixmap) exaAssertNotDirty (PixmapPtr pPixmap)
{ {
ExaPixmapPriv (pPixmap); ExaPixmapPriv (pPixmap);
CARD8 *dst, *src; CARD8 *dst, *src;
int dst_pitch, src_pitch, data_row_bytes, y; RegionPtr pValidReg = &pExaPixmap->validReg;
int dst_pitch, src_pitch, cpp, y, nbox = REGION_NUM_RECTS(pValidReg);
BoxPtr pBox = REGION_RECTS(pValidReg);
Bool ret = TRUE;
if (pExaPixmap == NULL || pExaPixmap->fb_ptr == NULL) if (pExaPixmap == NULL || pExaPixmap->fb_ptr == NULL)
return; return ret;
dst = pExaPixmap->sys_ptr; dst = pExaPixmap->sys_ptr;
dst_pitch = pExaPixmap->sys_pitch; dst_pitch = pExaPixmap->sys_pitch;
src = pExaPixmap->fb_ptr; src = pExaPixmap->fb_ptr;
src_pitch = pExaPixmap->fb_pitch; src_pitch = pExaPixmap->fb_pitch;
data_row_bytes = pPixmap->drawable.width * cpp = pPixmap->drawable.bitsPerPixel / 8;
pPixmap->drawable.bitsPerPixel / 8;
exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC); exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
for (y = 0; y < pPixmap->drawable.height; y++) { while (nbox--) {
if (memcmp(dst, src, data_row_bytes) != 0) { int rowbytes;
abort();
} pBox->x1 = max(pBox->x1, 0);
dst += dst_pitch; pBox->y1 = max(pBox->y1, 0);
src += src_pitch; pBox->x2 = min(pBox->x2, pPixmap->drawable.width);
pBox->y2 = min(pBox->y2, pPixmap->drawable.height);
if (pBox->x1 >= pBox->x2 || pBox->y1 >= pBox->y2)
continue;
rowbytes = (pBox->x2 - pBox->x1) * cpp;
src += pBox->y1 * src_pitch + pBox->x1 * cpp;
dst += pBox->y1 * dst_pitch + pBox->x1 * cpp;
for (y = pBox->y2 - pBox->y1; y; y--) {
if (memcmp(dst + pBox->y1 * dst_pitch + pBox->x1 * cpp,
src + pBox->y1 * src_pitch + pBox->x1 * cpp,
(pBox->x2 - pBox->x1) * cpp) != 0) {
ret = FALSE;
break;
}
src += src_pitch;
dst += dst_pitch;
}
src -= pBox->y1 * src_pitch + pBox->x1 * cpp;
dst -= pBox->y1 * dst_pitch + pBox->x1 * cpp;
} }
exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC); exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
return ret;
} }
/** /**
@ -462,8 +528,9 @@ exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
*/ */
if (pExaScr->checkDirtyCorrectness) { if (pExaScr->checkDirtyCorrectness) {
for (i = 0; i < npixmaps; i++) { for (i = 0; i < npixmaps; i++) {
if (!exaPixmapIsDirty (pixmaps[i].pPix)) if (!exaPixmapIsDirty (pixmaps[i].pPix) &&
exaAssertNotDirty (pixmaps[i].pPix); !exaAssertNotDirty (pixmaps[i].pPix))
ErrorF("%s: Pixmap %d dirty but not marked as such!\n", __func__, i);
} }
} }
/* If anything is pinned in system memory, we won't be able to /* If anything is pinned in system memory, we won't be able to

View File

@ -390,6 +390,7 @@ ExaOffscreenMarkUsed (PixmapPtr pPixmap)
if (area->state == ExaOffscreenRemovable) if (area->state == ExaOffscreenRemovable)
area->score = (area->score * 7) / 8; area->score = (area->score * 7) / 8;
} }
iter = 0;
} }
} }

View File

@ -51,6 +51,7 @@
#ifdef RENDER #ifdef RENDER
#include "fbpict.h" #include "fbpict.h"
#endif #endif
#include "damage.h"
#define DEBUG_TRACE_FALL 0 #define DEBUG_TRACE_FALL 0
#define DEBUG_MIGRATE 0 #define DEBUG_MIGRATE 0
@ -160,16 +161,16 @@ typedef struct {
unsigned int fb_size; /**< size of pixmap in framebuffer memory */ unsigned int fb_size; /**< size of pixmap in framebuffer memory */
/** /**
* If area is NULL, then dirty == TRUE means that the pixmap has been * The damage record contains the areas of the pixmap's current location
* modified, so the contents are defined. Used to avoid uploads of * (framebuffer or system) that have been damaged compared to the other
* undefined data. * location.
*
* If area is non-NULL, then dirty == TRUE means that the pixmap data at
* pPixmap->devPrivate.ptr (either fb_ptr or sys_ptr) has been changed
* compared to the copy in the other location. This is used to avoid
* uploads/downloads of unmodified data.
*/ */
Bool dirty; DamagePtr pDamage;
/**
* The valid region marks the valid bits of a drawable (at least, as it's
* derived from damage, which may be overreported).
*/
RegionRec validReg;
} ExaPixmapPrivRec, *ExaPixmapPrivPtr; } ExaPixmapPrivRec, *ExaPixmapPrivPtr;
typedef struct _ExaMigrationRec { typedef struct _ExaMigrationRec {
@ -315,7 +316,7 @@ ExaCheckComposite (CARD8 op,
CARD16 height); CARD16 height);
#endif #endif
/* exaoffscreen.c */ /* exa_offscreen.c */
void void
ExaOffscreenMarkUsed (PixmapPtr pPixmap); ExaOffscreenMarkUsed (PixmapPtr pPixmap);
@ -339,7 +340,10 @@ void
exaFinishAccess(DrawablePtr pDrawable, int index); exaFinishAccess(DrawablePtr pDrawable, int index);
void void
exaDrawableDirty(DrawablePtr pDrawable); exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2);
void
exaDrawableDirty(DrawablePtr pDrawable, int x1, int y1, int x2, int y2);
Bool Bool
exaDrawableIsOffscreen (DrawablePtr pDrawable); exaDrawableIsOffscreen (DrawablePtr pDrawable);
@ -408,10 +412,4 @@ exaGlyphs (CARD8 op,
void void
exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel); exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
void
exaMoveInPixmap (PixmapPtr pPixmap);
void
exaMoveOutPixmap (PixmapPtr pPixmap);
#endif /* EXAPRIV_H */ #endif /* EXAPRIV_H */

View File

@ -302,12 +302,12 @@ exaTryDriverSolidFill(PicturePtr pSrc,
(*pExaScr->info->Solid) (pDstPix, (*pExaScr->info->Solid) (pDstPix,
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
exaPixmapDirty (pDstPix, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
pbox++; pbox++;
} }
(*pExaScr->info->DoneSolid) (pDstPix); (*pExaScr->info->DoneSolid) (pDstPix);
exaMarkSync(pDst->pDrawable->pScreen); exaMarkSync(pDst->pDrawable->pScreen);
exaDrawableDirty (pDst->pDrawable);
REGION_UNINIT(pDst->pDrawable->pScreen, &region); REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 1; return 1;
@ -336,16 +336,21 @@ exaTryDriverComposite(CARD8 op,
struct _Pixmap scratch; struct _Pixmap scratch;
ExaMigrationRec pixmaps[3]; ExaMigrationRec pixmaps[3];
pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable);
pDstPix = exaGetDrawablePixmap(pDst->pDrawable);
if (pMask)
pMaskPix = exaGetDrawablePixmap(pMask->pDrawable);
/* Bail if we might exceed coord limits by rendering from/to these. We /* Bail if we might exceed coord limits by rendering from/to these. We
* should really be making some scratch pixmaps with offsets and coords * should really be making some scratch pixmaps with offsets and coords
* adjusted to deal with this, but it hasn't been done yet. * adjusted to deal with this, but it hasn't been done yet.
*/ */
if (pSrc->pDrawable->width > pExaScr->info->maxX || if (pSrcPix->drawable.width > pExaScr->info->maxX ||
pSrc->pDrawable->height > pExaScr->info->maxY || pSrcPix->drawable.height > pExaScr->info->maxY ||
pDst->pDrawable->width > pExaScr->info->maxX || pDstPix->drawable.width > pExaScr->info->maxX ||
pDst->pDrawable->height > pExaScr->info->maxY || pDstPix->drawable.height > pExaScr->info->maxY ||
(pMask && (pMask->pDrawable->width > pExaScr->info->maxX || (pMask && (pMaskPix->drawable.width > pExaScr->info->maxX ||
pMask->pDrawable->height > pExaScr->info->maxY))) pMaskPix->drawable.height > pExaScr->info->maxY)))
{ {
return -1; return -1;
} }
@ -441,12 +446,12 @@ exaTryDriverComposite(CARD8 op,
pbox->y1 + dst_off_y, pbox->y1 + dst_off_y,
pbox->x2 - pbox->x1, pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1); pbox->y2 - pbox->y1);
exaPixmapDirty (pDstPix, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
pbox++; pbox++;
} }
(*pExaScr->info->DoneComposite) (pDstPix); (*pExaScr->info->DoneComposite) (pDstPix);
exaMarkSync(pDst->pDrawable->pScreen); exaMarkSync(pDst->pDrawable->pScreen);
exaDrawableDirty (pDst->pDrawable);
REGION_UNINIT(pDst->pDrawable->pScreen, &region); REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 1; return 1;
@ -705,16 +710,19 @@ void
exaRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap, exaRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap,
int x_off, int y_off) int x_off, int y_off)
{ {
DrawablePtr pDraw = pPicture->pDrawable;
ExaMigrationRec pixmaps[1]; ExaMigrationRec pixmaps[1];
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = TRUE; pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = exaGetDrawablePixmap (pPicture->pDrawable); pixmaps[0].pPix = exaGetDrawablePixmap (pDraw);
exaDoMigration(pixmaps, 1, FALSE); exaDoMigration(pixmaps, 1, FALSE);
exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST); exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
fbRasterizeTrapezoid(pPicture, trap, x_off, y_off); fbRasterizeTrapezoid(pPicture, trap, x_off, y_off);
exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST); exaDrawableDirty(pDraw, pDraw->x, pDraw->y,
pDraw->x + pDraw->width, pDraw->y + pDraw->height);
exaFinishAccess(pDraw, EXA_PREPARE_DEST);
} }
/** /**
@ -725,16 +733,19 @@ void
exaAddTriangles (PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntri, exaAddTriangles (PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntri,
xTriangle *tris) xTriangle *tris)
{ {
DrawablePtr pDraw = pPicture->pDrawable;
ExaMigrationRec pixmaps[1]; ExaMigrationRec pixmaps[1];
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = TRUE; pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = exaGetDrawablePixmap (pPicture->pDrawable); pixmaps[0].pPix = exaGetDrawablePixmap (pDraw);
exaDoMigration(pixmaps, 1, FALSE); exaDoMigration(pixmaps, 1, FALSE);
exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST); exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
fbAddTriangles(pPicture, x_off, y_off, ntri, tris); fbAddTriangles(pPicture, x_off, y_off, ntri, tris);
exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST); exaDrawableDirty(pDraw, pDraw->x, pDraw->y,
pDraw->x + pDraw->width, pDraw->y + pDraw->height);
exaFinishAccess(pDraw, EXA_PREPARE_DEST);
} }
/** /**
@ -1023,10 +1034,11 @@ exaGlyphs (CARD8 op,
exaCopyArea (&pScratchPixmap->drawable, &pPixmap->drawable, pGC, exaCopyArea (&pScratchPixmap->drawable, &pPixmap->drawable, pGC,
0, 0, glyph->info.width, glyph->info.height, 0, 0); 0, 0, glyph->info.width, glyph->info.height, 0, 0);
} else {
exaDrawableDirty (&pPixmap->drawable);
} }
exaPixmapDirty (pPixmap, 0, 0,
glyph->info.width, glyph->info.height);
if (maskFormat) if (maskFormat)
{ {
exaComposite (PictOpAdd, pPicture, NULL, pMask, 0, 0, 0, 0, exaComposite (PictOpAdd, pPicture, NULL, pMask, 0, 0, 0, 0,

View File

@ -200,11 +200,33 @@ ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
int nrect, xRectangle *prect) int nrect, xRectangle *prect)
{ {
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable))); EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
exaPrepareAccessGC (pGC); if (nrect) {
fbPolyFillRect (pDrawable, pGC, nrect, prect); int x1 = max(prect->x, 0), y1 = max(prect->y, 0);
exaFinishAccessGC (pGC); int x2 = min(prect->x + prect->width, pDrawable->width);
exaFinishAccess (pDrawable, EXA_PREPARE_DEST); int y2 = min(prect->y + prect->height, pDrawable->height);
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
exaPrepareAccessGC (pGC);
fbPolyFillRect (pDrawable, pGC, nrect, prect);
exaFinishAccessGC (pGC);
exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
/* Only track bounding box of damage, as this path can degenerate to
* zillions of damage boxes
*/
while (--nrect)
{
prect++;
x1 = min(x1, prect->x);
x2 = max(x2, prect->x + prect->width);
y1 = min(y1, prect->y);
y2 = max(y2, prect->y + prect->height);
}
exaDrawableDirty (pDrawable, pDrawable->x + x1, pDrawable->y + y1,
pDrawable->x + x2, pDrawable->y + y2);
}
} }
void void

View File

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

View File

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

View File

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

View File

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

View File

@ -1056,6 +1056,116 @@ static Bool dmxCompareScreens(DMXScreenInfo *new, DMXScreenInfo *old)
return TRUE; 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. */ /** Reattach previously detached back-end screen. */
int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr) int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
{ {
@ -1174,6 +1284,20 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
/* Create window hierarchy (top down) */ /* Create window hierarchy (top down) */
dmxBECreateWindowTree(idx); 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 */ /* Refresh screen by generating exposure events for all windows */
dmxForceExposures(idx); dmxForceExposures(idx);
@ -1362,8 +1486,15 @@ static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type,
#ifdef RENDER #ifdef RENDER
} else if ((type & TypeMask) == (PictureType & TypeMask)) { } else if ((type & TypeMask) == (PictureType & TypeMask)) {
PicturePtr pPict = value; 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); dmxBEFreePicture((PicturePtr)value);
}
} else if ((type & TypeMask) == (GlyphSetType & TypeMask)) { } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value); dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value);
#endif #endif

View File

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

View File

@ -223,6 +223,36 @@ Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet)
return FALSE; 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 /** 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 * 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 * 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); ret = dmxSaveRenderVector[stuff->renderReqType](client);
if (ret == Success) { if (ret == Success) {
int (*oldErrorHandler)(Display *, XErrorEvent *);
GlyphSetPtr glyphSet; GlyphSetPtr glyphSet;
dmxGlyphPrivPtr glyphPriv; dmxGlyphPrivPtr glyphPriv;
int i; int i;
PictFormatPtr pFmt;
XRenderPictFormat *pFormat;
/* Look up glyphSet that was just created ???? */ /* Look up glyphSet that was just created ???? */
/* Store glyphsets from backends in glyphSet->devPrivate ????? */ /* Store glyphsets from backends in glyphSet->devPrivate ????? */
/* Make sure we handle all errors here!! */ /* Make sure we handle all errors here!! */
glyphSet = SecurityLookupIDByType(client, stuff->gsid, GlyphSetType, glyphSet = SecurityLookupIDByType(client, stuff->gsid, GlyphSetType,
SecurityDestroyAccess); DixDestroyAccess);
glyphPriv = xalloc(sizeof(dmxGlyphPrivRec)); glyphPriv = xalloc(sizeof(dmxGlyphPrivRec));
if (!glyphPriv) return BadAlloc; if (!glyphPriv) return BadAlloc;
glyphPriv->glyphSets = NULL; glyphPriv->glyphSets = NULL;
MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc); MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc);
DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv); DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv);
pFmt = SecurityLookupIDByType(client, stuff->format, PictFormatType,
SecurityReadAccess);
oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler);
for (i = 0; i < dmxNumScreens; i++) { for (i = 0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i]; DMXScreenInfo *dmxScreen = &dmxScreens[i];
int beret;
if (!dmxScreen->beDisplay) { if (!dmxScreen->beDisplay) {
glyphPriv->glyphSets[i] = 0; glyphPriv->glyphSets[i] = 0;
continue; continue;
} }
pFormat = dmxFindFormat(dmxScreen, pFmt); if ((beret = dmxBECreateGlyphSet(i, glyphSet)) != Success) {
if (!pFormat) {
int j; int j;
/* Free the glyph sets we've allocated thus far */ /* Free the glyph sets we've allocated thus far */
@ -278,30 +300,9 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client)
/* Free the resource created by render */ /* Free the resource created by render */
FreeResource(stuff->gsid, RT_NONE); FreeResource(stuff->gsid, RT_NONE);
ret = BadMatch; return beret;
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;
} }
} }
XSetErrorHandler(oldErrorHandler);
} }
return ret; return ret;
@ -315,7 +316,7 @@ static int dmxProcRenderFreeGlyphSet(ClientPtr client)
REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType, glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType,
SecurityDestroyAccess); DixDestroyAccess);
if (glyphSet && glyphSet->refcnt == 1) { if (glyphSet && glyphSet->refcnt == 1) {
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
@ -358,7 +359,7 @@ static int dmxProcRenderAddGlyphs(ClientPtr client)
int nbytes; int nbytes;
glyphSet = SecurityLookupIDByType(client, stuff->glyphset, glyphSet = SecurityLookupIDByType(client, stuff->glyphset,
GlyphSetType, SecurityReadAccess); GlyphSetType, DixReadAccess);
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
nglyphs = stuff->nglyphs; nglyphs = stuff->nglyphs;
@ -401,7 +402,7 @@ static int dmxProcRenderFreeGlyphs(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType, glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType,
SecurityWriteAccess); DixWriteAccess);
if (glyphSet) { if (glyphSet) {
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
@ -473,13 +474,13 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
dmxGlyphPrivPtr glyphPriv; dmxGlyphPrivPtr glyphPriv;
pSrc = SecurityLookupIDByType(client, stuff->src, PictureType, pSrc = SecurityLookupIDByType(client, stuff->src, PictureType,
SecurityReadAccess); DixReadAccess);
pSrcPriv = DMX_GET_PICT_PRIV(pSrc); pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
if (!pSrcPriv->pict) if (!pSrcPriv->pict)
return ret; return ret;
pDst = SecurityLookupIDByType(client, stuff->dst, PictureType, pDst = SecurityLookupIDByType(client, stuff->dst, PictureType,
SecurityWriteAccess); DixWriteAccess);
pDstPriv = DMX_GET_PICT_PRIV(pDst); pDstPriv = DMX_GET_PICT_PRIV(pDst);
if (!pDstPriv->pict) if (!pDstPriv->pict)
return ret; return ret;
@ -496,7 +497,7 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
if (stuff->maskFormat) if (stuff->maskFormat)
pFmt = SecurityLookupIDByType(client, stuff->maskFormat, pFmt = SecurityLookupIDByType(client, stuff->maskFormat,
PictFormatType, SecurityReadAccess); PictFormatType, DixReadAccess);
else else
pFmt = NULL; pFmt = NULL;
@ -547,7 +548,7 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
curElt = elts; curElt = elts;
glyphSet = SecurityLookupIDByType(client, stuff->glyphset, glyphSet = SecurityLookupIDByType(client, stuff->glyphset,
GlyphSetType, SecurityReadAccess); GlyphSetType, DixReadAccess);
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
while (buffer + sizeof(xGlyphElt) < end) { while (buffer + sizeof(xGlyphElt) < end) {
@ -558,7 +559,7 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
glyphSet = SecurityLookupIDByType(client, glyphSet = SecurityLookupIDByType(client,
*((CARD32 *)buffer), *((CARD32 *)buffer),
GlyphSetType, GlyphSetType,
SecurityReadAccess); DixReadAccess);
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
buffer += 4; buffer += 4;
} else { } else {
@ -622,7 +623,7 @@ static int dmxProcRenderSetPictureTransform(ClientPtr client)
REQUEST(xRenderSetPictureTransformReq); REQUEST(xRenderSetPictureTransformReq);
REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
VERIFY_PICTURE(pPicture, stuff->picture, client, SecurityWriteAccess, VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess,
RenderErrBase + BadPicture); RenderErrBase + BadPicture);
/* For the following to work with PanoramiX, it assumes that Render /* For the following to work with PanoramiX, it assumes that Render
@ -663,7 +664,7 @@ static int dmxProcRenderSetPictureFilter(ClientPtr client)
REQUEST(xRenderSetPictureFilterReq); REQUEST(xRenderSetPictureFilterReq);
REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq); REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
VERIFY_PICTURE(pPicture, stuff->picture, client, SecurityWriteAccess, VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess,
RenderErrBase + BadPicture); RenderErrBase + BadPicture);
/* For the following to work with PanoramiX, it assumes that Render /* 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 /** Create a picture. This function handles the CreatePicture
* unwrapping/wrapping and calls dmxDoCreatePicture to actually create * unwrapping/wrapping and calls dmxDoCreatePicture to actually create
* the picture on the appropriate screen. */ * 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 /* The clip has already been changed into a region by the mi
* routine called above. * 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; RegionPtr pClip = pPicture->clientClip;
BoxPtr pBox = REGION_RECTS(pClip); BoxPtr pBox = REGION_RECTS(pClip);
int nBox = REGION_NUM_RECTS(pClip); int nBox = REGION_NUM_RECTS(pClip);

View File

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

View File

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

View File

@ -21,6 +21,7 @@ Xvfb_LDFLAGS =
AM_CFLAGS = -DHAVE_DIX_CONFIG_H \ AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
-DNO_HW_ONLY_EXTS \ -DNO_HW_ONLY_EXTS \
-DNO_MODULE_EXTS \ -DNO_MODULE_EXTS \
-DXFree86Server \
$(XVFBMODULES_CFLAGS) \ $(XVFBMODULES_CFLAGS) \
$(DIX_CFLAGS) $(DIX_CFLAGS)

View File

@ -368,10 +368,8 @@ AllocateArea(
/* look through the free boxes */ /* look through the free boxes */
for(i = 0; i < num; i++, boxp++) { for(i = 0; i < num; i++, boxp++) {
x = boxp->x1; x = boxp->x1;
if(granularity) { if (granularity > 1)
int tmp = x % granularity; x = ((x + granularity - 1) / granularity) * granularity;
if(tmp) x += (granularity - tmp);
}
if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w))
continue; continue;
@ -398,10 +396,8 @@ AllocateArea(
boxp = &(link->area.box); boxp = &(link->area.box);
x = boxp->x1; x = boxp->x1;
if(granularity) { if (granularity > 1)
int tmp = x % granularity; x = ((x + granularity - 1) / granularity) * granularity;
if(tmp) x += (granularity - tmp);
}
if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) { if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) {
link = link->next; link = link->next;
@ -685,10 +681,8 @@ localQueryLargestOffscreenArea(
while(nbox--) { while(nbox--) {
x = pbox->x1; x = pbox->x1;
if(granularity) { if (granularity > 1)
int tmp = x % granularity; x = ((x + granularity - 1) / granularity) * granularity;
if(tmp) x += (granularity - tmp);
}
w = pbox->x2 - x; w = pbox->x2 - x;
h = pbox->y2 - pbox->y1; h = pbox->y2 - pbox->y1;
@ -845,7 +839,9 @@ AllocateLinear(
while (linear) { while (linear) {
/* Make sure we get a free area that's not an XY fallback case */ /* Make sure we get a free area that's not an XY fallback case */
if (!linear->area && linear->free) { if (!linear->area && linear->free) {
offset = (linear->linear.offset + granularity) & ~granularity; offset = linear->linear.offset;
if (granularity > 1)
offset = ((offset + granularity - 1) / granularity) * granularity;
end = offset+size; end = offset+size;
if (end <= (linear->linear.offset + linear->linear.size)) if (end <= (linear->linear.offset + linear->linear.size))
break; break;
@ -935,17 +931,20 @@ localAllocateOffscreenLinear(
extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); extents = REGION_EXTENTS(pScreen, offman->InitialBoxes);
pitch = extents->x2 - extents->x1; pitch = extents->x2 - extents->x1;
if (gran && gran > pitch) { if (gran > 1) {
/* we can't match the specified alignment with XY allocations */ if (gran > pitch) {
xfree(link); /* we can't match the specified alignment with XY allocations */
return NULL; xfree(link);
} return NULL;
if (gran && (pitch % gran)) { }
/* pitch and granularity aren't a perfect match, let's allocate
* a bit more so we can align later on if (pitch % gran) {
*/ /* pitch and granularity aren't a perfect match, let's allocate
length += gran - 1; * a bit more so we can align later on
} */
length += gran - 1;
}
}
if(length < pitch) { /* special case */ if(length < pitch) { /* special case */
w = length; w = length;
@ -968,8 +967,8 @@ localAllocateOffscreenLinear(
linear->pScreen = pScreen; linear->pScreen = pScreen;
linear->size = h * w; linear->size = h * w;
linear->offset = (pitch * area->box.y1) + area->box.x1; linear->offset = (pitch * area->box.y1) + area->box.x1;
if (gran && linear->offset % gran) if (gran > 1)
linear->offset += gran - (linear->offset % gran); linear->offset += ((linear->offset + gran - 1) / gran) * gran;
linear->granularity = gran; linear->granularity = gran;
linear->MoveLinearCallback = moveCB; linear->MoveLinearCallback = moveCB;
linear->RemoveLinearCallback = removeCB; linear->RemoveLinearCallback = removeCB;
@ -1435,9 +1434,12 @@ xf86AllocateLinearOffscreenArea (
extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); extents = REGION_EXTENTS(pScreen, offman->InitialBoxes);
w = extents->x2 - extents->x1; w = extents->x2 - extents->x1;
if(gran && ((gran > w) || (w % gran))) { if (gran > 1) {
/* we can't match the specified alignment with XY allocations */ if (gran > w)
return NULL; return NULL;
if (w % gran)
length += gran - 1;
} }
if(length <= w) { /* special case */ if(length <= w) { /* special case */

View File

@ -32,9 +32,6 @@
#include "propertyst.h" #include "propertyst.h"
#include "xf86DDC.h" #include "xf86DDC.h"
#define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA" #define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA"
#define EDID2_ATOM_NAME "XFree86_DDC_EDID2_RAWDATA" #define EDID2_ATOM_NAME "XFree86_DDC_EDID2_RAWDATA"
#define VDIF_ATOM_NAME "XFree86_DDC_VDIF_RAWDATA" #define VDIF_ATOM_NAME "XFree86_DDC_VDIF_RAWDATA"

View File

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

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 $ .\" $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__ .TH __xservername__ __appmansuffix__ __vendorversion__
.SH NAME .SH NAME
__xservername__ - X11R6 X server __xservername__ - X11R7 X server
.SH SYNOPSIS .SH SYNOPSIS
.B __xservername__ .B __xservername__
.RI [\fB:\fP display ] .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 UNIX-like operating systems running on Intel x86 hardware. It now runs
on a wider range of hardware and OS platforms. on a wider range of hardware and OS platforms.
.PP .PP
This work was derived from This work was derived by the X.Org Foundation from the XFree86 Project's
.I "XFree86\ 4.4rc2" .I "XFree86\ 4.4rc2"
by the X.Org Foundation. release.
The XFree86 4.4rc2 release was originally derived from The XFree86 release was originally derived from
.I "X386\ 1.2" .I "X386\ 1.2"
by Thomas Roell which was contributed to X11R5 by Snitily Graphics by Thomas Roell which was contributed to X11R5 by Snitily Graphics
Consulting Service. The Consulting Service.
.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.
.SH PLATFORMS .SH PLATFORMS
.PP .PP
.B __xservername__ .B __xservername__
operates under a wide range of operating systems and hardware platforms. operates under a wide range of operating systems and hardware platforms.
The Intel x86 (IA32) architecture is the most widely supported hardware 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 SPARC and PowerPC. The most widely supported operating systems are the
free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD and free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD,
OpenBSD. Commercial UNIX operating systems such as Solaris (x86) and OpenBSD, and Solaris. Commercial UNIX operating systems such as
UnixWare are also supported. Other supported operating systems include UnixWare are also supported. Other supported operating systems include
LynxOS, and GNU Hurd. Darwin and Mac OS X are supported with the 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 .PP
.SH "NETWORK CONNECTIONS" .SH "NETWORK CONNECTIONS"
.B __xservername__ .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 is ordered from highest precedence to lowest. Note that not all parameters
can be supplied via all methods. The available command line options can be supplied via all methods. The available command line options
and environment variables (and some defaults) are described here and in and environment variables (and some defaults) are described here and in
the Xserver(1) manual page. Most configuration file parameters, with the Xserver(__appmansuffix__) manual page. Most configuration file
their defaults, are described in the __xconfigfile__(__filemansuffix__) manual parameters, with their defaults, are described in the
page. Driver and module specific configuration parameters are described __xconfigfile__(__filemansuffix__) manual page. Driver and module specific
in the relevant driver or module manual page. configuration parameters are described in the relevant driver or module
manual page.
.PP .PP
In addition to the normal server options described in the Xserver(1) In addition to the normal server options described in the
manual page, Xserver(__appmansuffix__) manual page,
.B __xservername__ .B __xservername__
accepts the following command line switches: accepts the following command line switches:
.TP 8 .TP 8
@ -385,7 +382,8 @@ options.
When this option is specified, the When this option is specified, the
.B __xservername__ .B __xservername__
server scans the PCI bus, and prints out some information about each 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 .TP 8
.BI \-screen " screen-name" .BI \-screen " screen-name"
Use the __xconfigfile__(__filemansuffix__) file Use the __xconfigfile__(__filemansuffix__) file
@ -508,13 +506,12 @@ for its initial setup.
Refer to the __xconfigfile__(__filemansuffix__) manual page for information Refer to the __xconfigfile__(__filemansuffix__) manual page for information
about the format of this file. about the format of this file.
.PP .PP
Starting with version 4.4,
.B __xservername__ .B __xservername__
has a mechanism for automatically generating a built-in configuration has a mechanism for automatically generating a built-in configuration
at run-time when no at run-time when no
.B __xconfigfile__ .B __xconfigfile__
file is present. The current version of this automatic configuration file is present. The current version of this automatic configuration
mechanism works in three ways. mechanism works in two ways.
.PP .PP
The first is via enhancements that have made many components of the The first is via enhancements that have made many components of the
.B __xconfigfile__ .B __xconfigfile__
@ -523,14 +520,7 @@ reasonably deduced doesn't need to be specified explicitly, greatly
reducing the amount of built-in configuration information that needs to reducing the amount of built-in configuration information that needs to
be generated at run-time. be generated at run-time.
.PP .PP
The second is to use an external utility called getconfig(1), when The second is to have "safe" fallbacks for most configuration information.
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.
This maximises the likelihood that the This maximises the likelihood that the
.B __xservername__ .B __xservername__
server will start up in some usable configuration even when information server will start up in some usable configuration even when information
@ -644,7 +634,7 @@ __xservername__ was originally based on XFree86 4.4rc2.
That was originally based on \fIX386 1.2\fP by Thomas Roell, which 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. was contributed to the then X Consortium's X11R5 distribution by SGCS.
.PP .PP
__xservername__ is released by the X.org Foundation. __xservername__ is released by the X.Org Foundation.
.PP .PP
The project that became XFree86 was originally founded in 1992 by The project that became XFree86 was originally founded in 1992 by
David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat. David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat.
@ -685,9 +675,9 @@ Orest Zborowski \fIorestz@eskimo.com\fP
.RE .RE
.PP .PP
__xservername__ source is available from the FTP server __xservername__ source is available from the FTP server
\fI<ftp://ftp.x.org/>\fP, and from the X.org \fI<ftp://ftp.x.org/>\fP, and from the X.Org
server \fI<http://www.freedesktop.org/cvs/>\fP. Documentation and other server \fI<http://gitweb.freedesktop.org/>\fP. Documentation and other
information can be found from the X.org web site information can be found from the X.Org web site
\fI<http://www.x.org/>\fP. \fI<http://www.x.org/>\fP.
.SH LEGAL .SH LEGAL

View File

@ -649,7 +649,7 @@ being
that are passed to the module when it is loaded. that are passed to the module when it is loaded.
.PP .PP
Example: the extmod module (which contains a miscellaneous group of Example: the extmod module (which contains a miscellaneous group of
server extensions) can be loaded, with the __xservername__-DGA extension server extensions) can be loaded, with the XFree86-DGA extension
disabled by using the following entry: disabled by using the following entry:
.PP .PP
.RS 4 .RS 4

View File

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

View File

@ -35,6 +35,6 @@ Default: No.
Chooses an alternate pixmap migration heuristic, for debugging purposes. The Chooses an alternate pixmap migration heuristic, for debugging purposes. The
default is intended to be the best performing one for general use, though others default is intended to be the best performing one for general use, though others
may help with specific use cases. Available options include \*qalways\*q, may help with specific use cases. Available options include \*qalways\*q,
\*qgreedy\*q, and \*qsmart\*q. Default: smart. \*qgreedy\*q, and \*qsmart\*q. Default: always.
.SH AUTHORS .SH AUTHORS
Authors include: Keith Packard, Eric Anholt, Zack Rusin, and Michel Dänzer Authors include: Keith Packard, Eric Anholt, Zack Rusin, and Michel Dänzer

View File

@ -183,7 +183,8 @@ print_xfree_mode(char *txt, DisplayModePtr mode)
static void static void
xfree2fbdev_fblayout(ScrnInfoPtr pScrn, struct fb_var_screeninfo *var) xfree2fbdev_fblayout(ScrnInfoPtr pScrn, struct fb_var_screeninfo *var)
{ {
var->xres_virtual = pScrn->virtualX; var->xres_virtual = pScrn->displayWidth ? pScrn->displayWidth :
pScrn->virtualX;
var->yres_virtual = pScrn->virtualY; var->yres_virtual = pScrn->virtualY;
var->bits_per_pixel = pScrn->bitsPerPixel; var->bits_per_pixel = pScrn->bitsPerPixel;
var->red.length = pScrn->weight.red; var->red.length = pScrn->weight.red;
@ -227,6 +228,26 @@ xfree2fbdev_timing(DisplayModePtr mode, struct fb_var_screeninfo *var)
var->vmode = FB_VMODE_NONINTERLACED; var->vmode = FB_VMODE_NONINTERLACED;
} }
static Bool
fbdev_modes_equal(struct fb_var_screeninfo *one, struct fb_var_screeninfo *two)
{
return (one->xres_virtual == two->xres_virtual &&
one->yres_virtual == two->yres_virtual &&
one->bits_per_pixel == two->bits_per_pixel &&
one->red.length == two->red.length &&
one->green.length == two->green.length &&
one->blue.length == two->blue.length &&
one->xres == two->xres && one->yres == two->yres &&
one->pixclock == two->pixclock &&
one->right_margin == two->right_margin &&
one->hsync_len == two->hsync_len &&
one->left_margin == two->left_margin &&
one->lower_margin == two->lower_margin &&
one->vsync_len == two->vsync_len &&
one->upper_margin == two->upper_margin &&
one->sync == two->sync && one->vmode == two->vmode);
}
static void static void
fbdev2xfree_timing(struct fb_var_screeninfo *var, DisplayModePtr mode) fbdev2xfree_timing(struct fb_var_screeninfo *var, DisplayModePtr mode)
{ {
@ -516,13 +537,53 @@ fbdevHWGetVidmem(ScrnInfoPtr pScrn)
return fPtr->fix.smem_len; return fPtr->fix.smem_len;
} }
static Bool
fbdevHWSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool check)
{
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
struct fb_var_screeninfo req_var = fPtr->var, set_var;
TRACE_ENTER("SetMode");
xfree2fbdev_fblayout(pScrn, &req_var);
xfree2fbdev_timing(mode, &req_var);
#if DEBUG
print_xfree_mode("init", mode);
print_fbdev_mode("init", &req_var);
#endif
set_var = req_var;
if (check)
set_var.activate = FB_ACTIVATE_TEST;
if (0 != ioctl(fPtr->fd, FBIOPUT_VSCREENINFO, (void*)(&set_var))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
return FALSE;
}
if (!fbdev_modes_equal(&set_var, &req_var)) {
if (!check)
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"FBIOPUT_VSCREENINFO succeeded but modified "
"mode\n");
#if DEBUG
print_fbdev_mode("returned", &set_var);
#endif
return FALSE;
}
if (!check)
fPtr->var = set_var;
return TRUE;
}
void void
fbdevHWSetVideoModes(ScrnInfoPtr pScrn) fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
{ {
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
int virtX = pScrn->display->virtualX;
int virtY = pScrn->display->virtualY;
struct fb_var_screeninfo var;
char **modename; char **modename;
DisplayModePtr mode,this,last = pScrn->modes; DisplayModePtr mode,this,last = pScrn->modes;
@ -530,6 +591,9 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
if (NULL == pScrn->display->modes) if (NULL == pScrn->display->modes)
return; return;
pScrn->virtualX = pScrn->display->virtualX;
pScrn->virtualY = pScrn->display->virtualY;
for (modename = pScrn->display->modes; *modename != NULL; modename++) { for (modename = pScrn->display->modes; *modename != NULL; modename++) {
for (mode = pScrn->monitor->Modes; mode != NULL; mode = mode->next) for (mode = pScrn->monitor->Modes; mode != NULL; mode = mode->next)
if (0 == strcmp(mode->name,*modename)) if (0 == strcmp(mode->name,*modename))
@ -539,27 +603,20 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
"\tmode \"%s\" not found\n", *modename); "\tmode \"%s\" not found\n", *modename);
continue; continue;
} }
memset(&var,0,sizeof(var));
xfree2fbdev_timing(mode,&var);
var.xres_virtual = virtX;
var.yres_virtual = virtY;
var.bits_per_pixel = pScrn->bitsPerPixel;
var.red.length = pScrn->weight.red;
var.green.length = pScrn->weight.green;
var.blue.length = pScrn->weight.blue;
var.activate = FB_ACTIVATE_TEST; if (!fbdevHWSetMode(pScrn, mode, TRUE)) {
if (var.xres_virtual < var.xres) var.xres_virtual = var.xres;
if (var.yres_virtual < var.yres) var.yres_virtual = var.yres;
if (-1 == ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&var))) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"\tmode \"%s\" test failed\n", *modename); "\tmode \"%s\" test failed\n", *modename);
continue; continue;
} }
xf86DrvMsg(pScrn->scrnIndex, X_INFO, xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"\tmode \"%s\" ok\n", *modename); "\tmode \"%s\" ok\n", *modename);
if (virtX < var.xres) virtX = var.xres;
if (virtY < var.yres) virtY = var.yres; if (pScrn->virtualX < mode->HDisplay)
pScrn->virtualX = mode->HDisplay;
if (pScrn->virtualY < mode->VDisplay)
pScrn->virtualY = mode->VDisplay;
if (NULL == pScrn->modes) { if (NULL == pScrn->modes) {
pScrn->modes = xnfalloc(sizeof(DisplayModeRec)); pScrn->modes = xnfalloc(sizeof(DisplayModeRec));
this = pScrn->modes; this = pScrn->modes;
@ -576,8 +633,6 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
} }
last = this; last = this;
} }
pScrn->virtualX = virtX;
pScrn->virtualY = virtY;
} }
DisplayModePtr DisplayModePtr
@ -719,21 +774,12 @@ fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
{ {
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
TRACE_ENTER("ModeInit");
xfree2fbdev_fblayout(pScrn, &fPtr->var);
xfree2fbdev_timing(mode, &fPtr->var);
#if DEBUG
print_xfree_mode("init",mode);
print_fbdev_mode("init",&fPtr->var);
#endif
pScrn->vtSema = TRUE; pScrn->vtSema = TRUE;
/* set */ /* set */
if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) { if (!fbdevHWSetMode(pScrn, mode, FALSE))
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
return FALSE; return FALSE;
}
/* read back */ /* read back */
if (0 != ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) { if (0 != ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@ -745,6 +791,17 @@ fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
"FBIOGET_VSCREENINFO: %s\n", strerror(errno)); "FBIOGET_VSCREENINFO: %s\n", strerror(errno));
return FALSE; return FALSE;
} }
/* XXX: This is a hack, but it should be a NOP for all the setups that
* worked before and actually seems to fix some others...
*/
pScrn->offset.red = fPtr->var.red.offset;
pScrn->offset.green = fPtr->var.green.offset;
pScrn->offset.blue = fPtr->var.blue.offset;
pScrn->mask.red = ((1 << fPtr->var.red.length) - 1) << fPtr->var.red.offset;
pScrn->mask.green = ((1 << fPtr->var.green.length) - 1) << fPtr->var.green.offset;
pScrn->mask.blue = ((1 << fPtr->var.blue.length) - 1) << fPtr->var.blue.offset;
return TRUE; return TRUE;
} }
@ -813,18 +870,12 @@ ModeStatus
fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
{ {
ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
struct fb_var_screeninfo var;
TRACE_ENTER("ValidMode"); TRACE_ENTER("ValidMode");
memcpy(&var,&fPtr->var,sizeof(var));
xfree2fbdev_timing(mode, &var); if (!fbdevHWSetMode(pScrn, mode, TRUE))
var.activate = FB_ACTIVATE_TEST;
if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) {
xf86DrvMsg(scrnIndex, X_ERROR,
"FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
return MODE_BAD; return MODE_BAD;
}
return MODE_OK; return MODE_OK;
} }
@ -832,15 +883,12 @@ Bool
fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
{ {
ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
TRACE_ENTER("SwitchMode"); TRACE_ENTER("SwitchMode");
xfree2fbdev_timing(mode, &fPtr->var);
if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) { if (!fbdevHWSetMode(pScrn, mode, FALSE))
xf86DrvMsg(scrnIndex, X_ERROR,
"FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }

View File

@ -155,17 +155,21 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(CompareTimeStamps) SYMFUNC(CompareTimeStamps)
SYMFUNC(CopyISOLatin1Lowered) SYMFUNC(CopyISOLatin1Lowered)
SYMFUNC(DeleteCallback) SYMFUNC(DeleteCallback)
SYMFUNC(dixLookupDrawable)
SYMFUNC(dixLookupWindow)
SYMFUNC(dixLookupClient)
SYMFUNC(dixLookupGC)
/* following are deprecated */
SYMFUNC(LookupClient) SYMFUNC(LookupClient)
SYMFUNC(LookupDrawable) SYMFUNC(LookupDrawable)
SYMFUNC(LookupWindow) SYMFUNC(LookupWindow)
SYMFUNC(SecurityLookupDrawable)
SYMFUNC(SecurityLookupWindow)
/* end deprecated */
SYMFUNC(NoopDDA) SYMFUNC(NoopDDA)
SYMFUNC(QueueWorkProc) SYMFUNC(QueueWorkProc)
SYMFUNC(RegisterBlockAndWakeupHandlers) SYMFUNC(RegisterBlockAndWakeupHandlers)
SYMFUNC(RemoveBlockAndWakeupHandlers) SYMFUNC(RemoveBlockAndWakeupHandlers)
#ifdef XACE
SYMFUNC(SecurityLookupDrawable)
SYMFUNC(SecurityLookupWindow)
#endif
/* events.c */ /* events.c */
SYMFUNC(CheckCursorConfinement) SYMFUNC(CheckCursorConfinement)
SYMFUNC(DeliverEvents) SYMFUNC(DeliverEvents)

View File

@ -113,6 +113,10 @@ DLFindSymbol(const char *name)
DLModuleList *l; DLModuleList *l;
void *p; void *p;
p = dlsym(RTLD_DEFAULT, name);
if (p != NULL)
return p;
for (l = dlModuleList; l != NULL; l = l->next) { for (l = dlModuleList; l != NULL; l = l->next) {
p = DLFindSymbolLocal(l->module, name); p = DLFindSymbolLocal(l->module, name);
if (p) if (p)

View File

@ -90,6 +90,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
legacyVGARec vga; legacyVGARec vga;
xf86int10BiosLocation bios; xf86int10BiosLocation bios;
Bool videoBiosMapped = FALSE; Bool videoBiosMapped = FALSE;
pciVideoPtr pvp;
if (int10Generation != serverGeneration) { if (int10Generation != serverGeneration) {
counter = 0; counter = 0;
@ -151,6 +152,8 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec)); pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec));
pInt->scrnIndex = screen; pInt->scrnIndex = screen;
pInt->entityIndex = entityIndex; pInt->entityIndex = entityIndex;
pvp = xf86GetPciInfoForEntity(entityIndex);
if (pvp) pInt->Tag = pciTag(pvp->bus, pvp->device, pvp->func);
if (!xf86Int10ExecSetup(pInt)) if (!xf86Int10ExecSetup(pInt))
goto error0; goto error0;
pInt->mem = &linuxMem; pInt->mem = &linuxMem;

View File

@ -2129,7 +2129,7 @@ static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
uint srcoffset; uint srcoffset;
START_OF_INSTR(); START_OF_INSTR();
DECODE_PRINTF("BSF\n"); DECODE_PRINTF("BSF\t");
FETCH_DECODE_MODRM(mod, rh, rl); FETCH_DECODE_MODRM(mod, rh, rl);
switch(mod) { switch(mod) {
case 0: case 0:
@ -2209,25 +2209,25 @@ static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
break; break;
case 3: /* register to register */ case 3: /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) { if (M.x86.mode & SYSMODE_PREFIX_DATA) {
u32 *srcreg, *dstreg; u32 srcval, *dstreg;
srcreg = DECODE_RM_LONG_REGISTER(rl); srcval = *DECODE_RM_LONG_REGISTER(rl);
DECODE_PRINTF(","); DECODE_PRINTF(",");
dstreg = DECODE_RM_LONG_REGISTER(rh); dstreg = DECODE_RM_LONG_REGISTER(rh);
TRACE_AND_STEP(); TRACE_AND_STEP();
CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
for(*dstreg = 0; *dstreg < 32; (*dstreg)++) for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
if ((*srcreg >> *dstreg) & 1) break; if ((srcval >> *dstreg) & 1) break;
} else { } else {
u16 *srcreg, *dstreg; u16 srcval, *dstreg;
srcreg = DECODE_RM_WORD_REGISTER(rl); srcval = *DECODE_RM_WORD_REGISTER(rl);
DECODE_PRINTF(","); DECODE_PRINTF(",");
dstreg = DECODE_RM_WORD_REGISTER(rh); dstreg = DECODE_RM_WORD_REGISTER(rh);
TRACE_AND_STEP(); TRACE_AND_STEP();
CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
for(*dstreg = 0; *dstreg < 16; (*dstreg)++) for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
if ((*srcreg >> *dstreg) & 1) break; if ((srcval >> *dstreg) & 1) break;
} }
break; break;
} }
@ -2245,7 +2245,7 @@ static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
uint srcoffset; uint srcoffset;
START_OF_INSTR(); START_OF_INSTR();
DECODE_PRINTF("BSF\n"); DECODE_PRINTF("BSR\t");
FETCH_DECODE_MODRM(mod, rh, rl); FETCH_DECODE_MODRM(mod, rh, rl);
switch(mod) { switch(mod) {
case 0: case 0:
@ -2325,25 +2325,25 @@ static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
break; break;
case 3: /* register to register */ case 3: /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) { if (M.x86.mode & SYSMODE_PREFIX_DATA) {
u32 *srcreg, *dstreg; u32 srcval, *dstreg;
srcreg = DECODE_RM_LONG_REGISTER(rl); srcval = *DECODE_RM_LONG_REGISTER(rl);
DECODE_PRINTF(","); DECODE_PRINTF(",");
dstreg = DECODE_RM_LONG_REGISTER(rh); dstreg = DECODE_RM_LONG_REGISTER(rh);
TRACE_AND_STEP(); TRACE_AND_STEP();
CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
for(*dstreg = 31; *dstreg > 0; (*dstreg)--) for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
if ((*srcreg >> *dstreg) & 1) break; if ((srcval >> *dstreg) & 1) break;
} else { } else {
u16 *srcreg, *dstreg; u16 srcval, *dstreg;
srcreg = DECODE_RM_WORD_REGISTER(rl); srcval = *DECODE_RM_WORD_REGISTER(rl);
DECODE_PRINTF(","); DECODE_PRINTF(",");
dstreg = DECODE_RM_WORD_REGISTER(rh); dstreg = DECODE_RM_WORD_REGISTER(rh);
TRACE_AND_STEP(); TRACE_AND_STEP();
CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
for(*dstreg = 15; *dstreg > 0; (*dstreg)--) for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
if ((*srcreg >> *dstreg) & 1) break; if ((srcval >> *dstreg) & 1) break;
} }
break; break;
} }

View File

@ -51,6 +51,7 @@ Xnest_LDFLAGS =
AM_CFLAGS = -DHAVE_XNEST_CONFIG_H \ AM_CFLAGS = -DHAVE_XNEST_CONFIG_H \
-DNO_HW_ONLY_EXTS \ -DNO_HW_ONLY_EXTS \
-DXFree86Server \
$(DIX_CFLAGS) \ $(DIX_CFLAGS) \
$(XNESTMODULES_CFLAGS) $(XNESTMODULES_CFLAGS)

View File

@ -5,7 +5,8 @@ bin_PROGRAMS = Xprt
Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ \ Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ \
-DXPRINT -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \ -DXPRINT -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \
-DXPRINTDIR=\"$(libdir)/X11/xserver\" \ -DXPRINTDIR=\"$(libdir)/X11/xserver\" \
-DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX -DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX \
-DXFree86Server
Xprt_LDFLAGS = -L$(top_srcdir) Xprt_LDFLAGS = -L$(top_srcdir)
Xprt_LDADD = @XPRINT_LIBS@ ps/libps.la raster/libraster.la \ Xprt_LDADD = @XPRINT_LIBS@ ps/libps.la raster/libraster.la \

View File

@ -694,6 +694,7 @@ winFixupPaths (void)
if (sizeof(xkbbasedir) > 0) if (sizeof(xkbbasedir) > 0)
xkbbasedir[sizeof(xkbbasedir)-1] = 0; xkbbasedir[sizeof(xkbbasedir)-1] = 0;
XkbBaseDirectory = xkbbasedir; XkbBaseDirectory = xkbbasedir;
XkbBinDirectory = basedir;
} }
#endif /* XKB */ #endif /* XKB */
#endif /* RELOCATE_PROJECTROOT */ #endif /* RELOCATE_PROJECTROOT */

View File

@ -344,13 +344,11 @@ winProcSetSelectionOwner (ClientPtr client)
if (None != stuff->window) if (None != stuff->window)
{ {
/* Grab the Window from the request */ /* Grab the Window from the request */
pWindow = (WindowPtr) SecurityLookupWindow (stuff->window, client, int rc = dixLookupWindow(&pWindow, stuff->window, client, DixReadAccess);
SecurityReadAccess); if (rc != Success) {
if (!pWindow)
{
ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n"); ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n");
goto winProcSetSelectionOwner_Done; goto winProcSetSelectionOwner_Done;
} }
} }
/* Now we either have a valid window or None */ /* Now we either have a valid window or None */

View File

@ -982,11 +982,10 @@ winAdjustXWindow (WindowPtr pWin, HWND hwnd)
/* /*
* If the Windows window is minimized, its WindowRect has * If the Windows window is minimized, its WindowRect has
* meaningless values so we don't adjust X window to it. * meaningless values so we don't adjust X window to it.
* Instead we put the X window to the bottom in Z order to
* be obscured by other windows.
*/ */
vlist[0] = Below; vlist[0] = 0;
return ConfigureWindow (pWin, CWStackMode, vlist, wClient(pWin)); vlist[1] = 0;
return ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
} }
pDraw = &pWin->drawable; pDraw = &pWin->drawable;

View File

@ -203,7 +203,7 @@ ProcWindowsWMSelectInput (register ClientPtr client)
REQUEST_SIZE_MATCH (xWindowsWMSelectInputReq); REQUEST_SIZE_MATCH (xWindowsWMSelectInputReq);
pHead = (WMEventPtr *)SecurityLookupIDByType(client, eventResource, pHead = (WMEventPtr *)SecurityLookupIDByType(client, eventResource,
EventType, SecurityWriteAccess); EventType, DixWriteAccess);
if (stuff->mask != 0) if (stuff->mask != 0)
{ {
if (pHead) if (pHead)
@ -441,7 +441,7 @@ ProcWindowsWMFrameDraw (register ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
win32RootlessWindowPtr pRLWinPriv; win32RootlessWindowPtr pRLWinPriv;
RECT rcNew; RECT rcNew;
int nCmdShow; int nCmdShow, rc;
RegionRec newShape; RegionRec newShape;
ScreenPtr pScreen; ScreenPtr pScreen;
@ -450,11 +450,9 @@ ProcWindowsWMFrameDraw (register ClientPtr client)
#if CYGMULTIWINDOW_DEBUG #if CYGMULTIWINDOW_DEBUG
ErrorF ("ProcWindowsWMFrameDraw\n"); ErrorF ("ProcWindowsWMFrameDraw\n");
#endif #endif
if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
client, SecurityReadAccess))) if (rc != Success)
{ return rc;
return BadValue;
}
#if CYGMULTIWINDOW_DEBUG #if CYGMULTIWINDOW_DEBUG
ErrorF ("ProcWindowsWMFrameDraw - Window found\n"); ErrorF ("ProcWindowsWMFrameDraw - Window found\n");
#endif #endif
@ -538,6 +536,7 @@ ProcWindowsWMFrameSetTitle(
REQUEST(xWindowsWMFrameSetTitleReq); REQUEST(xWindowsWMFrameSetTitleReq);
WindowPtr pWin; WindowPtr pWin;
win32RootlessWindowPtr pRLWinPriv; win32RootlessWindowPtr pRLWinPriv;
int rc;
#if CYGMULTIWINDOW_DEBUG #if CYGMULTIWINDOW_DEBUG
ErrorF ("ProcWindowsWMFrameSetTitle\n"); ErrorF ("ProcWindowsWMFrameSetTitle\n");
@ -545,11 +544,9 @@ ProcWindowsWMFrameSetTitle(
REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq); REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq);
if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
client, SecurityReadAccess))) if (rc != Success)
{ return rc;
return BadValue;
}
#if CYGMULTIWINDOW_DEBUG #if CYGMULTIWINDOW_DEBUG
ErrorF ("ProcWindowsWMFrameSetTitle - Window found\n"); ErrorF ("ProcWindowsWMFrameSetTitle - Window found\n");
#endif #endif

View File

@ -93,6 +93,9 @@
/* Define to 1 if you have the <asm/mtrr.h> header file. */ /* Define to 1 if you have the <asm/mtrr.h> header file. */
#undef HAVE_ASM_MTRR_H #undef HAVE_ASM_MTRR_H
/* Define to 1 if you have the <byteswap.h> header file. */
#undef HAVE_BYTESWAP_H
/* Define to 1 if you have the <dbm.h> header file. */ /* Define to 1 if you have the <dbm.h> header file. */
#undef HAVE_DBM_H #undef HAVE_DBM_H
@ -311,6 +314,9 @@
/* Use rgb.txt directly */ /* Use rgb.txt directly */
#undef USE_RGB_TXT #undef USE_RGB_TXT
/* Define to use byteswap macros from <sys/endian.h> */
#undef USE_SYS_ENDIAN_H
/* unaligned word accesses behave as expected */ /* unaligned word accesses behave as expected */
#undef WORKING_UNALIGNED_INT #undef WORKING_UNALIGNED_INT
@ -469,4 +475,13 @@
/* Path to XErrorDB file */ /* Path to XErrorDB file */
#undef XERRORDB_PATH #undef XERRORDB_PATH
/* Define to 16-bit byteswap macro */
#undef bswap_16
/* Define to 32-bit byteswap macro */
#undef bswap_32
/* Define to 64-bit byteswap macro */
#undef bswap_64
#endif /* _DIX_CONFIG_H_ */ #endif /* _DIX_CONFIG_H_ */

View File

@ -81,107 +81,6 @@ SOFTWARE.
return(BadIDChoice);\ return(BadIDChoice);\
} }
/* XXX if you are using this macro, you are probably not generating Match
* errors where appropriate */
#define LOOKUP_DRAWABLE(did, client)\
((client->lastDrawableID == did) ? \
client->lastDrawable : (DrawablePtr)LookupDrawable(did, client))
#ifdef XACE
#define SECURITY_VERIFY_DRAWABLE(pDraw, did, client, mode)\
{\
pDraw = (DrawablePtr) SecurityLookupIDByClass(client, did, \
RC_DRAWABLE, mode);\
if (!pDraw) \
{\
client->errorValue = did; \
return BadDrawable;\
}\
if (pDraw->type == UNDRAWABLE_WINDOW)\
return BadMatch;\
}
#define SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, mode)\
{\
pDraw = (DrawablePtr) SecurityLookupIDByClass(client, did, \
RC_DRAWABLE, mode);\
if (!pDraw) \
{\
client->errorValue = did; \
return BadDrawable;\
}\
}
#define SECURITY_VERIFY_GC(pGC, rid, client, mode)\
pGC = (GC *) SecurityLookupIDByType(client, rid, RT_GC, mode);\
if (!pGC)\
{\
client->errorValue = rid;\
return (BadGC);\
}
#define VERIFY_DRAWABLE(pDraw, did, client)\
SECURITY_VERIFY_DRAWABLE(pDraw, did, client, SecurityUnknownAccess)
#define VERIFY_GEOMETRABLE(pDraw, did, client)\
SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, SecurityUnknownAccess)
#define VERIFY_GC(pGC, rid, client)\
SECURITY_VERIFY_GC(pGC, rid, client, SecurityUnknownAccess)
#else /* not XACE */
#define VERIFY_DRAWABLE(pDraw, did, client)\
if (client->lastDrawableID == did)\
pDraw = client->lastDrawable;\
else \
{\
pDraw = (DrawablePtr) LookupIDByClass(did, RC_DRAWABLE);\
if (!pDraw) \
{\
client->errorValue = did; \
return BadDrawable;\
}\
if (pDraw->type == UNDRAWABLE_WINDOW)\
return BadMatch;\
}
#define VERIFY_GEOMETRABLE(pDraw, did, client)\
if (client->lastDrawableID == did)\
pDraw = client->lastDrawable;\
else \
{\
pDraw = (DrawablePtr) LookupIDByClass(did, RC_DRAWABLE);\
if (!pDraw) \
{\
client->errorValue = did; \
return BadDrawable;\
}\
}
#define VERIFY_GC(pGC, rid, client)\
if (client->lastGCID == rid)\
pGC = client->lastGC;\
else\
pGC = (GC *)LookupIDByType(rid, RT_GC);\
if (!pGC)\
{\
client->errorValue = rid;\
return (BadGC);\
}
#define SECURITY_VERIFY_DRAWABLE(pDraw, did, client, mode)\
VERIFY_DRAWABLE(pDraw, did, client)
#define SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, mode)\
VERIFY_GEOMETRABLE(pDraw, did, client)
#define SECURITY_VERIFY_GC(pGC, rid, client, mode)\
VERIFY_GC(pGC, rid, client)
#endif /* XACE */
/* /*
* We think that most hardware implementations of DBE will want * We think that most hardware implementations of DBE will want
* LookupID*(dbe_back_buffer_id) to return the window structure that the * LookupID*(dbe_back_buffer_id) to return the window structure that the
@ -239,10 +138,15 @@ SOFTWARE.
if ((stuff->gc == INVALID) || (client->lastGCID != stuff->gc) ||\ if ((stuff->gc == INVALID) || (client->lastGCID != stuff->gc) ||\
(client->lastDrawableID != drawID))\ (client->lastDrawableID != drawID))\
{\ {\
SECURITY_VERIFY_GEOMETRABLE(pDraw, drawID, client, SecurityWriteAccess);\ int rc;\
SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityReadAccess);\ rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY,\
if ((pGC->depth != pDraw->depth) ||\ DixWriteAccess);\
(pGC->pScreen != pDraw->pScreen))\ if (rc != Success)\
return rc;\
rc = dixLookupGC(&(pGC), stuff->gc, client, DixReadAccess);\
if (rc != Success)\
return rc;\
if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\
return (BadMatch);\ return (BadMatch);\
client->lastDrawable = pDraw;\ client->lastDrawable = pDraw;\
client->lastDrawableID = drawID;\ client->lastDrawableID = drawID;\
@ -375,47 +279,41 @@ extern int CompareISOLatin1Lowered(
unsigned char * /*b*/, unsigned char * /*b*/,
int blen); int blen);
#ifdef XACE extern int dixLookupWindow(
WindowPtr *result,
XID id,
ClientPtr client,
Mask access_mode);
extern WindowPtr SecurityLookupWindow( extern int dixLookupDrawable(
XID /*rid*/, DrawablePtr *result,
ClientPtr /*client*/, XID id,
Mask /*access_mode*/); ClientPtr client,
Mask type_mask,
Mask access_mode);
extern pointer SecurityLookupDrawable( extern int dixLookupGC(
XID /*rid*/, GCPtr *result,
ClientPtr /*client*/, XID id,
Mask /*access_mode*/); ClientPtr client,
Mask access_mode);
extern WindowPtr LookupWindow( extern int dixLookupClient(
XID /*rid*/, ClientPtr *result,
ClientPtr /*client*/); XID id,
ClientPtr client,
Mask access_mode);
extern pointer LookupDrawable( /*
XID /*rid*/, * These are deprecated compatibility functions and will be removed soon!
ClientPtr /*client*/); * Please use the new dixLookup*() functions above.
*/
#else extern WindowPtr SecurityLookupWindow(XID, ClientPtr, Mask);
extern WindowPtr LookupWindow(XID, ClientPtr);
extern WindowPtr LookupWindow( extern pointer SecurityLookupDrawable(XID, ClientPtr, Mask);
XID /*rid*/, extern pointer LookupDrawable(XID, ClientPtr);
ClientPtr /*client*/); extern ClientPtr LookupClient(XID, ClientPtr);
/* end deprecated functions */
extern pointer LookupDrawable(
XID /*rid*/,
ClientPtr /*client*/);
#define SecurityLookupWindow(rid, client, access_mode) \
LookupWindow(rid, client)
#define SecurityLookupDrawable(rid, client, access_mode) \
LookupDrawable(rid, client)
#endif /* XACE */
extern ClientPtr LookupClient(
XID /*rid*/,
ClientPtr /*client*/);
extern void NoopDDA(void); extern void NoopDDA(void);

View File

@ -103,7 +103,7 @@ extern int ProcUngrabButton(ClientPtr /* client */);
extern int ProcRecolorCursor(ClientPtr /* client */); extern int ProcRecolorCursor(ClientPtr /* client */);
#ifdef PANORAMIX #ifdef PANORAMIX
extern void PostSyntheticMotion(int x, int y, ScreenPtr pScreen, unsigned long time); extern void PostSyntheticMotion(int x, int y, int screen, unsigned long time);
#endif #endif
#endif /* DIXEVENTS_H */ #endif /* DIXEVENTS_H */

View File

@ -421,7 +421,7 @@ extern int GetProximityEvents(
extern void PostSyntheticMotion( extern void PostSyntheticMotion(
int x, int x,
int y, int y,
ScreenPtr pScreen, int screen,
unsigned long time); unsigned long time);
extern int GetMotionHistorySize( extern int GetMotionHistorySize(

View File

@ -58,6 +58,16 @@ SOFTWARE.
#define UNDRAWABLE_WINDOW 2 #define UNDRAWABLE_WINDOW 2
#define DRAWABLE_BUFFER 3 #define DRAWABLE_BUFFER 3
/* corresponding type masks for dixLookupDrawable() */
#define M_DRAWABLE_WINDOW (1<<0)
#define M_DRAWABLE_PIXMAP (1<<1)
#define M_UNDRAWABLE_WINDOW (1<<2)
#define M_DRAWABLE_BUFFER (1<<3)
#define M_ANY (-1)
#define M_WINDOW (M_DRAWABLE_WINDOW|M_UNDRAWABLE_WINDOW)
#define M_DRAWABLE (M_DRAWABLE_WINDOW|M_DRAWABLE_PIXMAP|M_DRAWABLE_BUFFER)
#define M_UNDRAWABLE (M_UNDRAWABLE_WINDOW)
/* flags to PaintWindow() */ /* flags to PaintWindow() */
#define PW_BACKGROUND 0 #define PW_BACKGROUND 0
#define PW_BORDER 1 #define PW_BORDER 1

View File

@ -220,10 +220,11 @@ extern pointer LookupClientResourceComplex(
* simultaneously. * simultaneously.
*/ */
#define SecurityUnknownAccess 0 /* don't know intentions */ #define DixUnknownAccess 0 /* don't know intentions */
#define SecurityReadAccess (1<<0) /* inspecting the object */ #define DixReadAccess (1<<0) /* inspecting the object */
#define SecurityWriteAccess (1<<1) /* changing the object */ #define DixWriteAccess (1<<1) /* changing the object */
#define SecurityDestroyAccess (1<<2) /* destroying the object */ #define DixReadWriteAccess (DixReadAccess|DixWriteAccess)
#define DixDestroyAccess (1<<2) /* destroying the object */
extern pointer SecurityLookupIDByType( extern pointer SecurityLookupIDByType(
ClientPtr /*client*/, ClientPtr /*client*/,

View File

@ -52,6 +52,12 @@ in this Software without prior written authorization from The Open Group.
# include "extinit.h" # include "extinit.h"
# include "exglobals.h" # include "exglobals.h"
#ifdef DPMSExtension
# include "dpmsproc.h"
# define DPMS_SERVER
# include <X11/extensions/dpms.h>
#endif
#define QUEUE_SIZE 256 #define QUEUE_SIZE 256
typedef struct _Event { typedef struct _Event {
@ -183,6 +189,13 @@ mieqProcessInputEvents()
while (miEventQueue.head != miEventQueue.tail) { while (miEventQueue.head != miEventQueue.tail) {
if (screenIsSaved == SCREEN_SAVER_ON) if (screenIsSaved == SCREEN_SAVER_ON)
SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset); SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
#ifdef DPMSExtension
else if (DPMSPowerLevel != DPMSModeOn)
SetScreenSaverTimer();
if (DPMSPowerLevel != DPMSModeOn)
DPMSSet(DPMSModeOn);
#endif
e = &miEventQueue.events[miEventQueue.head]; e = &miEventQueue.events[miEventQueue.head];
/* Assumption - screen switching can only occur on motion events. */ /* Assumption - screen switching can only occur on motion events. */

View File

@ -113,6 +113,52 @@ getDrawableDamageRef (DrawablePtr pDrawable)
DamagePtr *pPrev = (DamagePtr *) \ DamagePtr *pPrev = (DamagePtr *) \
&(pWindow->devPrivates[damageWinPrivateIndex].ptr) &(pWindow->devPrivates[damageWinPrivateIndex].ptr)
static void
DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion)
{
BoxRec tmpBox;
RegionRec tmpRegion;
Bool was_empty;
switch (pDamage->damageLevel) {
case DamageReportRawRegion:
(*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure);
break;
case DamageReportDeltaRegion:
REGION_NULL (pScreen, &tmpRegion);
REGION_SUBTRACT (pScreen, &tmpRegion, pDamageRegion, &pDamage->damage);
if (REGION_NOTEMPTY (pScreen, &tmpRegion)) {
REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage,
pDamageRegion);
(*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure);
}
REGION_UNINIT(pScreen, &tmpRegion);
break;
case DamageReportBoundingBox:
tmpBox = *REGION_EXTENTS (pScreen, &pDamage->damage);
REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage,
pDamageRegion);
if (!BOX_SAME (&tmpBox, REGION_EXTENTS (pScreen, &pDamage->damage))) {
(*pDamage->damageReport) (pDamage, &pDamage->damage,
pDamage->closure);
}
break;
case DamageReportNonEmpty:
was_empty = !REGION_NOTEMPTY(pScreen, &pDamage->damage);
REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage,
pDamageRegion);
if (was_empty && REGION_NOTEMPTY(pScreen, &pDamage->damage)) {
(*pDamage->damageReport) (pDamage, &pDamage->damage,
pDamage->closure);
}
break;
case DamageReportNone:
REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage,
pDamageRegion);
break;
}
}
#if DAMAGE_DEBUG_ENABLE #if DAMAGE_DEBUG_ENABLE
static void static void
_damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, int subWindowMode, const char *where) _damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, int subWindowMode, const char *where)
@ -130,9 +176,6 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
RegionRec clippedRec; RegionRec clippedRec;
RegionPtr pDamageRegion; RegionPtr pDamageRegion;
RegionRec pixClip; RegionRec pixClip;
Bool was_empty;
RegionRec tmpRegion;
BoxRec tmpBox;
int draw_x, draw_y; int draw_x, draw_y;
#ifdef COMPOSITE #ifdef COMPOSITE
int screen_x = 0, screen_y = 0; int screen_x = 0, screen_y = 0;
@ -256,41 +299,18 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
*/ */
if (draw_x || draw_y) if (draw_x || draw_y)
REGION_TRANSLATE (pScreen, pDamageRegion, -draw_x, -draw_y); REGION_TRANSLATE (pScreen, pDamageRegion, -draw_x, -draw_y);
switch (pDamage->damageLevel) { /* If the damage rec has been flagged to report damage after the op has
case DamageReportRawRegion: * completed, then union it into the delayed damage region, which will
(*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure); * be used for reporting after calling down, and skip the reporting
break; */
case DamageReportDeltaRegion: if (!pDamage->reportAfter) {
REGION_NULL (pScreen, &tmpRegion); DamageReportDamage (pDamage, pDamageRegion);
REGION_SUBTRACT (pScreen, &tmpRegion, pDamageRegion, &pDamage->damage); } else {
if (REGION_NOTEMPTY (pScreen, &tmpRegion)) REGION_UNION(pScreen, &pDamage->pendingDamage,
{ &pDamage->pendingDamage, pDamageRegion);
REGION_UNION(pScreen, &pDamage->damage,
&pDamage->damage, pDamageRegion);
(*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure);
}
REGION_UNINIT(pScreen, &tmpRegion);
break;
case DamageReportBoundingBox:
tmpBox = *REGION_EXTENTS (pScreen, &pDamage->damage);
REGION_UNION(pScreen, &pDamage->damage,
&pDamage->damage, pDamageRegion);
if (!BOX_SAME (&tmpBox, REGION_EXTENTS (pScreen, &pDamage->damage)))
(*pDamage->damageReport) (pDamage, &pDamage->damage, pDamage->closure);
break;
case DamageReportNonEmpty:
was_empty = !REGION_NOTEMPTY(pScreen, &pDamage->damage);
REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage,
pDamageRegion);
if (was_empty && REGION_NOTEMPTY(pScreen, &pDamage->damage))
(*pDamage->damageReport) (pDamage, &pDamage->damage, pDamage->closure);
break;
case DamageReportNone:
REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage,
pDamageRegion);
break;
} }
/* /*
* translate original region back * translate original region back
*/ */
@ -305,6 +325,21 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
REGION_UNINIT (pScreen, &clippedRec); REGION_UNINIT (pScreen, &clippedRec);
} }
static void
damageReportPostOp (DrawablePtr pDrawable)
{
drawableDamage(pDrawable);
for (; pDamage != NULL; pDamage = pDamage->pNext)
{
if (pDamage->reportAfter) {
DamageReportDamage (pDamage, &pDamage->pendingDamage);
REGION_EMPTY (pScreen, &pDamage->pendingDamage);
}
}
}
#if DAMAGE_DEBUG_ENABLE #if DAMAGE_DEBUG_ENABLE
#define damageDamageBox(d,b,m) _damageDamageBox(d,b,m,__FUNCTION__) #define damageDamageBox(d,b,m) _damageDamageBox(d,b,m,__FUNCTION__)
static void static void
@ -550,6 +585,7 @@ damageComposite (CARD8 op,
yDst, yDst,
width, width,
height); height);
damageReportPostOp (pDst->pDrawable);
wrap (pScrPriv, ps, Composite, damageComposite); wrap (pScrPriv, ps, Composite, damageComposite);
} }
@ -616,6 +652,7 @@ damageGlyphs (CARD8 op,
} }
unwrap (pScrPriv, ps, Glyphs); unwrap (pScrPriv, ps, Glyphs);
(*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
damageReportPostOp (pDst->pDrawable);
wrap (pScrPriv, ps, Glyphs, damageGlyphs); wrap (pScrPriv, ps, Glyphs, damageGlyphs);
} }
#endif #endif
@ -668,6 +705,7 @@ damageFillSpans(DrawablePtr pDrawable,
(*pGC->ops->FillSpans)(pDrawable, pGC, npt, ppt, pwidth, fSorted); (*pGC->ops->FillSpans)(pDrawable, pGC, npt, ppt, pwidth, fSorted);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -715,6 +753,7 @@ damageSetSpans(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->SetSpans)(pDrawable, pGC, pcharsrc, ppt, pwidth, npt, fSorted); (*pGC->ops->SetSpans)(pDrawable, pGC, pcharsrc, ppt, pwidth, npt, fSorted);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -746,6 +785,7 @@ damagePutImage(DrawablePtr pDrawable,
} }
(*pGC->ops->PutImage)(pDrawable, pGC, depth, x, y, w, h, (*pGC->ops->PutImage)(pDrawable, pGC, depth, x, y, w, h,
leftPad, format, pImage); leftPad, format, pImage);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -789,6 +829,7 @@ damageCopyArea(DrawablePtr pSrc,
ret = (*pGC->ops->CopyArea)(pSrc, pDst, ret = (*pGC->ops->CopyArea)(pSrc, pDst,
pGC, srcx, srcy, width, height, dstx, dsty); pGC, srcx, srcy, width, height, dstx, dsty);
damageReportPostOp (pDst);
DAMAGE_GC_OP_EPILOGUE(pGC, pDst); DAMAGE_GC_OP_EPILOGUE(pGC, pDst);
return ret; return ret;
} }
@ -834,6 +875,7 @@ damageCopyPlane(DrawablePtr pSrc,
ret = (*pGC->ops->CopyPlane)(pSrc, pDst, ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
damageReportPostOp (pDst);
DAMAGE_GC_OP_EPILOGUE(pGC, pDst); DAMAGE_GC_OP_EPILOGUE(pGC, pDst);
return ret; return ret;
} }
@ -875,6 +917,7 @@ damagePolyPoint(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolyPoint)(pDrawable, pGC, mode, npt, ppt); (*pGC->ops->PolyPoint)(pDrawable, pGC, mode, npt, ppt);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -948,6 +991,7 @@ damagePolylines(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->Polylines)(pDrawable, pGC, mode, npt, ppt); (*pGC->ops->Polylines)(pDrawable, pGC, mode, npt, ppt);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1026,6 +1070,7 @@ damagePolySegment(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolySegment)(pDrawable, pGC, nSeg, pSeg); (*pGC->ops->PolySegment)(pDrawable, pGC, nSeg, pSeg);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1087,6 +1132,7 @@ damagePolyRectangle(DrawablePtr pDrawable,
} }
} }
(*pGC->ops->PolyRectangle)(pDrawable, pGC, nRects, pRects); (*pGC->ops->PolyRectangle)(pDrawable, pGC, nRects, pRects);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1139,6 +1185,7 @@ damagePolyArc(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolyArc)(pDrawable, pGC, nArcs, pArcs); (*pGC->ops->PolyArc)(pDrawable, pGC, nArcs, pArcs);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1197,6 +1244,7 @@ damageFillPolygon(DrawablePtr pDrawable,
} }
(*pGC->ops->FillPolygon)(pDrawable, pGC, shape, mode, npt, ppt); (*pGC->ops->FillPolygon)(pDrawable, pGC, shape, mode, npt, ppt);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1235,6 +1283,7 @@ damagePolyFillRect(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolyFillRect)(pDrawable, pGC, nRects, pRects); (*pGC->ops->PolyFillRect)(pDrawable, pGC, nRects, pRects);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1276,6 +1325,7 @@ damagePolyFillArc(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolyFillArc)(pDrawable, pGC, nArcs, pArcs); (*pGC->ops->PolyFillArc)(pDrawable, pGC, nArcs, pArcs);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1386,6 +1436,7 @@ damagePolyText8(DrawablePtr pDrawable,
Linear8Bit, TT_POLY8); Linear8Bit, TT_POLY8);
else else
x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars); x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x; return x;
} }
@ -1406,6 +1457,7 @@ damagePolyText16(DrawablePtr pDrawable,
TT_POLY16); TT_POLY16);
else else
x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars); x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x; return x;
} }
@ -1425,6 +1477,7 @@ damageImageText8(DrawablePtr pDrawable,
Linear8Bit, TT_IMAGE8); Linear8Bit, TT_IMAGE8);
else else
(*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars); (*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1444,6 +1497,7 @@ damageImageText16(DrawablePtr pDrawable,
TT_IMAGE16); TT_IMAGE16);
else else
(*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars); (*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1462,6 +1516,7 @@ damageImageGlyphBlt(DrawablePtr pDrawable,
nglyph, ppci, TRUE, pGC->subWindowMode); nglyph, ppci, TRUE, pGC->subWindowMode);
(*pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, (*pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph,
ppci, pglyphBase); ppci, pglyphBase);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1479,6 +1534,7 @@ damagePolyGlyphBlt(DrawablePtr pDrawable,
nglyph, ppci, FALSE, pGC->subWindowMode); nglyph, ppci, FALSE, pGC->subWindowMode);
(*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph,
ppci, pglyphBase); ppci, pglyphBase);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1512,6 +1568,7 @@ damagePushPixels(GCPtr pGC,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PushPixels)(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg); (*pGC->ops->PushPixels)(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg);
damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1591,10 +1648,12 @@ damagePaintWindow(WindowPtr pWindow,
if(what == PW_BACKGROUND) { if(what == PW_BACKGROUND) {
unwrap (pScrPriv, pScreen, PaintWindowBackground); unwrap (pScrPriv, pScreen, PaintWindowBackground);
(*pScreen->PaintWindowBackground) (pWindow, prgn, what); (*pScreen->PaintWindowBackground) (pWindow, prgn, what);
damageReportPostOp (&pWindow->drawable);
wrap (pScrPriv, pScreen, PaintWindowBackground, damagePaintWindow); wrap (pScrPriv, pScreen, PaintWindowBackground, damagePaintWindow);
} else { } else {
unwrap (pScrPriv, pScreen, PaintWindowBorder); unwrap (pScrPriv, pScreen, PaintWindowBorder);
(*pScreen->PaintWindowBorder) (pWindow, prgn, what); (*pScreen->PaintWindowBorder) (pWindow, prgn, what);
damageReportPostOp (&pWindow->drawable);
wrap (pScrPriv, pScreen, PaintWindowBorder, damagePaintWindow); wrap (pScrPriv, pScreen, PaintWindowBorder, damagePaintWindow);
} }
} }
@ -1623,6 +1682,7 @@ damageCopyWindow(WindowPtr pWindow,
} }
unwrap (pScrPriv, pScreen, CopyWindow); unwrap (pScrPriv, pScreen, CopyWindow);
(*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc); (*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc);
damageReportPostOp (&pWindow->drawable);
wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow); wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow);
} }
@ -1654,6 +1714,7 @@ damageRestoreAreas (PixmapPtr pPixmap,
unwrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas); unwrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas);
(*pScreen->BackingStoreFuncs.RestoreAreas) (pPixmap, prgn, (*pScreen->BackingStoreFuncs.RestoreAreas) (pPixmap, prgn,
xorg, yorg, pWindow); xorg, yorg, pWindow);
damageReportPostOp (&pWindow->drawable);
wrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas, wrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas,
damageRestoreAreas); damageRestoreAreas);
} }
@ -1820,12 +1881,14 @@ DamageCreate (DamageReportFunc damageReport,
pDamage->pNext = 0; pDamage->pNext = 0;
pDamage->pNextWin = 0; pDamage->pNextWin = 0;
REGION_NULL(pScreen, &pDamage->damage); REGION_NULL(pScreen, &pDamage->damage);
REGION_NULL(pScreen, &pDamage->pendingDamage);
pDamage->damageLevel = damageLevel; pDamage->damageLevel = damageLevel;
pDamage->isInternal = isInternal; pDamage->isInternal = isInternal;
pDamage->closure = closure; pDamage->closure = closure;
pDamage->isWindow = FALSE; pDamage->isWindow = FALSE;
pDamage->pDrawable = 0; pDamage->pDrawable = 0;
pDamage->reportAfter = FALSE;
pDamage->damageReport = damageReport; pDamage->damageReport = damageReport;
pDamage->damageDestroy = damageDestroy; pDamage->damageDestroy = damageDestroy;
@ -1909,6 +1972,7 @@ DamageDestroy (DamagePtr pDamage)
if (pDamage->damageDestroy) if (pDamage->damageDestroy)
(*pDamage->damageDestroy) (pDamage, pDamage->closure); (*pDamage->damageDestroy) (pDamage, pDamage->closure);
REGION_UNINIT (pDamage->pDrawable->pScreen, &pDamage->damage); REGION_UNINIT (pDamage->pDrawable->pScreen, &pDamage->damage);
REGION_UNINIT (pDamage->pDrawable->pScreen, &pDamage->pendingDamage);
xfree (pDamage); xfree (pDamage);
} }
@ -1962,4 +2026,16 @@ DamageDamageRegion (DrawablePtr pDrawable,
RegionPtr pRegion) RegionPtr pRegion)
{ {
damageDamageRegion (pDrawable, pRegion, FALSE, -1); damageDamageRegion (pDrawable, pRegion, FALSE, -1);
/* Go back and report this damage for DamagePtrs with reportAfter set, since
* this call isn't part of an in-progress drawing op in the call chain and
* the DDX probably just wants to know about it right away.
*/
damageReportPostOp (pDrawable);
}
void
DamageSetReportAfterOp (DamagePtr pDamage, Bool reportAfter)
{
pDamage->reportAfter = reportAfter;
} }

View File

@ -81,4 +81,7 @@ void
DamageDamageRegion (DrawablePtr pDrawable, DamageDamageRegion (DrawablePtr pDrawable,
const RegionPtr pRegion); const RegionPtr pRegion);
void
DamageSetReportAfterOp (DamagePtr pDamage, Bool reportAfter);
#endif /* _DAMAGE_H_ */ #endif /* _DAMAGE_H_ */

View File

@ -48,6 +48,9 @@ typedef struct _damage {
DamageReportFunc damageReport; DamageReportFunc damageReport;
DamageDestroyFunc damageDestroy; DamageDestroyFunc damageDestroy;
Bool reportAfter;
RegionRec pendingDamage;
} DamageRec; } DamageRec;
typedef struct _damageScrPriv { typedef struct _damageScrPriv {

View File

@ -337,10 +337,7 @@ WaitForSomething(int *pClientsReady)
if (XFD_ANYSET(&tmp_set)) if (XFD_ANYSET(&tmp_set))
QueueWorkProc(EstablishNewConnections, NULL, QueueWorkProc(EstablishNewConnections, NULL,
(pointer)&LastSelectMask); (pointer)&LastSelectMask);
#ifdef DPMSExtension
if (XFD_ANYSET (&devicesReadable) && (DPMSPowerLevel != DPMSModeOn))
DPMSSet(DPMSModeOn);
#endif
if (XFD_ANYSET (&devicesReadable) || XFD_ANYSET (&clientsReadable)) if (XFD_ANYSET (&devicesReadable) || XFD_ANYSET (&clientsReadable))
break; break;
#ifdef WIN32 #ifdef WIN32

View File

@ -1528,7 +1528,7 @@ AuthorizedClient(ClientPtr client)
return TRUE; return TRUE;
/* untrusted clients can't change host access */ /* untrusted clients can't change host access */
if (!XaceHook(XACE_HOSTLIST_ACCESS, client, SecurityWriteAccess)) if (!XaceHook(XACE_HOSTLIST_ACCESS, client, DixWriteAccess))
return FALSE; return FALSE;
return LocalClient(client); return LocalClient(client);

View File

@ -53,12 +53,11 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#ifndef __GLIBC__
#include <time.h>
#else
/* The world's most shocking hack, to ensure we get clock_gettime() and /* The world's most shocking hack, to ensure we get clock_gettime() and
* CLOCK_MONOTONIC. */ * CLOCK_MONOTONIC. */
#ifdef sun /* Needed to tell Solaris headers not to restrict to */
#define __EXTENSIONS__ /* only the functions defined in POSIX 199309. */
#endif
#ifdef _POSIX_C_SOURCE #ifdef _POSIX_C_SOURCE
#define _SAVED_POSIX_C_SOURCE _POSIX_C_SOURCE #define _SAVED_POSIX_C_SOURCE _POSIX_C_SOURCE
#undef _POSIX_C_SOURCE #undef _POSIX_C_SOURCE
@ -69,6 +68,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#ifdef _SAVED_POSIX_C_SOURCE #ifdef _SAVED_POSIX_C_SOURCE
#define _POSIX_C_SOURCE _SAVED_POSIX_C_SOURCE #define _POSIX_C_SOURCE _SAVED_POSIX_C_SOURCE
#endif #endif
#endif /* __linux__ */
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#include <stdlib.h> #include <stdlib.h>

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