mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-20 11:20:31 +01:00
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into glucose-2
Conflicts: GL/glx/glxext.c GL/glx/glxscreens.c
This commit is contained in:
commit
90e14393d6
147 changed files with 11895 additions and 3949 deletions
2049
GL/apple/indirect.c
2049
GL/apple/indirect.c
File diff suppressed because it is too large
Load diff
|
|
@ -34,7 +34,6 @@
|
|||
** version 1.2.1 Specification.
|
||||
*/
|
||||
|
||||
extern int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXDisp_QueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXDisp_QueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
|
|
@ -42,7 +41,6 @@ extern int __glXDisp_DestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *p
|
|||
extern int __glXDisp_QueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXDisp_HyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
|
||||
extern int __glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXDispSwap_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXDispSwap_QueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXDispSwap_QueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
|
|
|
|||
757
GL/glx/glxcmds.c
757
GL/glx/glxcmds.c
File diff suppressed because it is too large
Load diff
|
|
@ -77,8 +77,7 @@ int __glXDispSwap_CreateContext(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLX_SWAP_INT(&req->screen);
|
||||
__GLX_SWAP_INT(&req->shareList);
|
||||
|
||||
return DoCreateContext( cl, req->context, req->shareList, req->visual,
|
||||
req->screen, req->isDirect );
|
||||
return __glXDisp_CreateContext(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
@ -93,8 +92,7 @@ int __glXDispSwap_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLX_SWAP_INT(&req->renderType);
|
||||
__GLX_SWAP_INT(&req->shareList);
|
||||
|
||||
return DoCreateContext( cl, req->context, req->shareList, req->fbconfig,
|
||||
req->screen, req->isDirect );
|
||||
return __glXDisp_CreateNewContext(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
@ -110,8 +108,7 @@ int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLX_SWAP_INT(&req->renderType);
|
||||
__GLX_SWAP_INT(&req->shareList);
|
||||
|
||||
return DoCreateContext( cl, req->context, req->shareList, req->fbconfig,
|
||||
req->screen, req->isDirect );
|
||||
return __glXDisp_CreateContextWithConfigSGIX(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_DestroyContext(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
@ -135,8 +132,7 @@ int __glXDispSwap_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLX_SWAP_INT(&req->context);
|
||||
__GLX_SWAP_INT(&req->oldContextTag);
|
||||
|
||||
return DoMakeCurrent( cl, req->drawable, req->drawable,
|
||||
req->context, req->oldContextTag );
|
||||
return __glXDisp_MakeCurrent(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
@ -150,8 +146,7 @@ int __glXDispSwap_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLX_SWAP_INT(&req->context);
|
||||
__GLX_SWAP_INT(&req->oldContextTag);
|
||||
|
||||
return DoMakeCurrent( cl, req->drawable, req->readdrawable,
|
||||
req->context, req->oldContextTag );
|
||||
return __glXDisp_MakeContextCurrent(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
@ -165,8 +160,7 @@ int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLX_SWAP_INT(&req->context);
|
||||
__GLX_SWAP_INT(&req->oldContextTag);
|
||||
|
||||
return DoMakeCurrent( cl, req->drawable, req->readable,
|
||||
req->context, req->oldContextTag );
|
||||
return __glXDisp_MakeCurrentReadSGI(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_IsDirect(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
@ -233,7 +227,7 @@ int __glXDispSwap_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
__GLX_SWAP_INT(&req->screen);
|
||||
return DoGetVisualConfigs( cl, req->screen, GL_TRUE );
|
||||
return __glXDisp_GetVisualConfigs(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
@ -242,7 +236,7 @@ int __glXDispSwap_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
__GLX_SWAP_INT(&req->screen);
|
||||
return DoGetFBConfigs( cl, req->screen, GL_TRUE );
|
||||
return __glXDisp_GetFBConfigs(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
@ -251,7 +245,7 @@ int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
__GLX_SWAP_INT(&req->screen);
|
||||
return DoGetFBConfigs( cl, req->screen, GL_TRUE );
|
||||
return __glXDisp_GetFBConfigsSGIX(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
@ -265,14 +259,15 @@ int __glXDispSwap_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLX_SWAP_INT(&req->pixmap);
|
||||
__GLX_SWAP_INT(&req->glxpixmap);
|
||||
|
||||
return DoCreateGLXPixmap( cl, req->visual, req->screen,
|
||||
req->pixmap, req->glxpixmap, NULL, 0 );
|
||||
return __glXDisp_CreateGLXPixmap(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
|
||||
CARD32 *attribs;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
|
||||
|
||||
__GLX_SWAP_SHORT(&req->length);
|
||||
__GLX_SWAP_INT(&req->screen);
|
||||
|
|
@ -280,11 +275,10 @@ int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLX_SWAP_INT(&req->pixmap);
|
||||
__GLX_SWAP_INT(&req->glxpixmap);
|
||||
__GLX_SWAP_INT(&req->numAttribs);
|
||||
attribs = (CARD32*)(req + 1);
|
||||
__GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
|
||||
|
||||
return DoCreateGLXPixmap( cl, req->fbconfig, req->screen,
|
||||
req->pixmap, req->glxpixmap,
|
||||
(CARD32*)(req + 1),
|
||||
req->numAttribs );
|
||||
return __glXDisp_CreatePixmap(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
@ -299,8 +293,7 @@ int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc
|
|||
__GLX_SWAP_INT(&req->pixmap);
|
||||
__GLX_SWAP_INT(&req->glxpixmap);
|
||||
|
||||
return DoCreateGLXPixmap( cl, req->fbconfig, req->screen,
|
||||
req->pixmap, req->glxpixmap, NULL, 0 );
|
||||
return __glXDisp_CreateGLXPixmapWithConfigSGIX(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
@ -328,52 +321,123 @@ int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
|
|||
int __glXDispSwap_QueryContext(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
(void) req;
|
||||
__GLX_SWAP_INT(&req->context);
|
||||
|
||||
return BadRequest;
|
||||
return __glXDisp_QueryContext(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
|
||||
CARD32 *attribs;
|
||||
|
||||
(void) req;
|
||||
__GLX_SWAP_INT(&req->screen);
|
||||
__GLX_SWAP_INT(&req->fbconfig);
|
||||
__GLX_SWAP_INT(&req->pbuffer);
|
||||
__GLX_SWAP_INT(&req->numAttribs);
|
||||
attribs = (CARD32*)(req + 1);
|
||||
__GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
|
||||
|
||||
return BadRequest;
|
||||
return __glXDisp_CreatePbuffer(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
__GLX_SWAP_INT(&req->screen);
|
||||
__GLX_SWAP_INT(&req->fbconfig);
|
||||
__GLX_SWAP_INT(&req->pbuffer);
|
||||
__GLX_SWAP_INT(&req->width);
|
||||
__GLX_SWAP_INT(&req->height);
|
||||
|
||||
return __glXDisp_CreateGLXPbufferSGIX(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) req;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
return BadRequest;
|
||||
__GLX_SWAP_INT(&req->pbuffer);
|
||||
|
||||
return __glXDisp_DestroyPbuffer(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) req;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
__GLX_SWAP_INT(&req->pbuffer);
|
||||
|
||||
return __glXDisp_DestroyGLXPbufferSGIX(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXChangeDrawableAttributesReq *req =
|
||||
(xGLXChangeDrawableAttributesReq *) req;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
|
||||
CARD32 *attribs;
|
||||
|
||||
return BadRequest;
|
||||
__GLX_SWAP_INT(&req->drawable);
|
||||
__GLX_SWAP_INT(&req->numAttribs);
|
||||
attribs = (CARD32*)(req + 1);
|
||||
__GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
|
||||
|
||||
return __glXDisp_ChangeDrawableAttributes(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl,
|
||||
GLbyte *pc)
|
||||
{
|
||||
xGLXChangeDrawableAttributesSGIXReq *req =
|
||||
(xGLXChangeDrawableAttributesSGIXReq *) req;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
|
||||
CARD32 *attribs;
|
||||
|
||||
__GLX_SWAP_INT(&req->drawable);
|
||||
__GLX_SWAP_INT(&req->numAttribs);
|
||||
attribs = (CARD32*)(req + 1);
|
||||
__GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
|
||||
|
||||
return __glXDisp_ChangeDrawableAttributesSGIX(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_CreateWindow(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
|
||||
CARD32 *attribs;
|
||||
|
||||
(void) req;
|
||||
__GLX_SWAP_INT(&req->screen);
|
||||
__GLX_SWAP_INT(&req->fbconfig);
|
||||
__GLX_SWAP_INT(&req->window);
|
||||
__GLX_SWAP_INT(&req->glxwindow);
|
||||
__GLX_SWAP_INT(&req->numAttribs);
|
||||
attribs = (CARD32*)(req + 1);
|
||||
__GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
|
||||
|
||||
return BadRequest;
|
||||
return __glXDisp_CreateWindow(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
(void) req;
|
||||
__GLX_SWAP_INT(&req->glxwindow);
|
||||
|
||||
return BadRequest;
|
||||
return __glXDisp_DestroyWindow(cl, pc);
|
||||
}
|
||||
|
||||
int __glXDispSwap_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
@ -643,7 +707,7 @@ void __glXSwapGetDrawableAttributesReply(ClientPtr client,
|
|||
|
||||
int __glXDispSwap_Render(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
return DoRender(cl, pc, True);
|
||||
return __glXDisp_Render(cl, pc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -651,7 +715,7 @@ int __glXDispSwap_Render(__GLXclientState *cl, GLbyte *pc)
|
|||
*/
|
||||
int __glXDispSwap_RenderLarge(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
return DoRenderLarge(cl, pc, True);
|
||||
return __glXDisp_RenderLarge(cl, pc);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
|
|
|||
|
|
@ -44,12 +44,12 @@
|
|||
|
||||
typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
|
||||
struct __GLXtextureFromPixmap {
|
||||
int (*bindTexImage) (__GLXcontext *baseContext,
|
||||
int buffer,
|
||||
__GLXpixmap *pixmap);
|
||||
int (*releaseTexImage) (__GLXcontext *baseContext,
|
||||
int buffer,
|
||||
__GLXpixmap *pixmap);
|
||||
int (*bindTexImage) (__GLXcontext *baseContext,
|
||||
int buffer,
|
||||
__GLXdrawable *pixmap);
|
||||
int (*releaseTexImage) (__GLXcontext *baseContext,
|
||||
int buffer,
|
||||
__GLXdrawable *pixmap);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -151,12 +151,6 @@ struct __GLXcontext {
|
|||
GLuint *selectBuf;
|
||||
GLint selectBufSize; /* number of elements allocated */
|
||||
|
||||
/*
|
||||
** Set only if current drawable is a glx pixmap.
|
||||
*/
|
||||
__GLXpixmap *drawPixmap;
|
||||
__GLXpixmap *readPixmap;
|
||||
|
||||
/*
|
||||
** The drawable private this context is bound to
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -46,22 +46,12 @@
|
|||
#include <GL/internal/dri_interface.h>
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
|
||||
DrawablePtr pDraw;
|
||||
__GLcontextModes *modes;
|
||||
__GLXscreen *pGlxScreen;
|
||||
ScreenPtr pScreen;
|
||||
Bool idExists;
|
||||
int refcnt;
|
||||
GLenum target;
|
||||
#ifdef XF86DRI
|
||||
DamagePtr pDamage;
|
||||
__DRIcontext *pDRICtx;
|
||||
GLint texname;
|
||||
unsigned long offset;
|
||||
#endif
|
||||
} __GLXpixmap;
|
||||
/* We just need to avoid clashing with DRAWABLE_{WINDOW,PIXMAP} */
|
||||
enum {
|
||||
GLX_DRAWABLE_WINDOW,
|
||||
GLX_DRAWABLE_PIXMAP,
|
||||
GLX_DRAWABLE_PBUFFER
|
||||
};
|
||||
|
||||
struct __GLXdrawable {
|
||||
void (*destroy)(__GLXdrawable *private);
|
||||
|
|
@ -78,12 +68,10 @@ struct __GLXdrawable {
|
|||
|
||||
DrawablePtr pDraw;
|
||||
XID drawId;
|
||||
__GLXpixmap *pGlxPixmap;
|
||||
|
||||
/*
|
||||
** Either DRAWABLE_PIXMAP or DRAWABLE_WINDOW, copied from pDraw above.
|
||||
** Needed by the resource freer because pDraw might already have been
|
||||
** freed.
|
||||
** Either GLX_DRAWABLE_PIXMAP, GLX_DRAWABLE_WINDOW or
|
||||
** GLX_DRAWABLE_PBUFFER.
|
||||
*/
|
||||
int type;
|
||||
|
||||
|
|
@ -105,6 +93,13 @@ struct __GLXdrawable {
|
|||
** reference count
|
||||
*/
|
||||
int refCount;
|
||||
|
||||
GLenum target;
|
||||
|
||||
/*
|
||||
** Event mask
|
||||
*/
|
||||
unsigned long eventMask;
|
||||
};
|
||||
|
||||
#endif /* !__GLX_drawable_h__ */
|
||||
|
|
|
|||
540
GL/glx/glxdri.c
540
GL/glx/glxdri.c
|
|
@ -59,77 +59,55 @@
|
|||
#include "dispatch.h"
|
||||
#include "extension_string.h"
|
||||
|
||||
#define containerOf(ptr, type, member) \
|
||||
(type *)( (char *)ptr - offsetof(type,member) )
|
||||
|
||||
#define STRINGIFY(macro_or_string) STRINGIFY_ARG (macro_or_string)
|
||||
#define STRINGIFY_ARG(contents) #contents
|
||||
|
||||
typedef struct __GLXDRIscreen __GLXDRIscreen;
|
||||
typedef struct __GLXDRIcontext __GLXDRIcontext;
|
||||
typedef struct __GLXDRIscreen __GLXDRIscreen;
|
||||
typedef struct __GLXDRIcontext __GLXDRIcontext;
|
||||
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
|
||||
|
||||
struct __GLXDRIscreen {
|
||||
__GLXscreen base;
|
||||
__DRIscreen driScreen;
|
||||
void *driver;
|
||||
|
||||
__DRIscreen driScreen;
|
||||
void *driver;
|
||||
xf86EnterVTProc *enterVT;
|
||||
xf86LeaveVTProc *leaveVT;
|
||||
|
||||
xf86EnterVTProc *enterVT;
|
||||
xf86LeaveVTProc *leaveVT;
|
||||
__DRIcopySubBufferExtension *copySubBuffer;
|
||||
__DRIswapControlExtension *swapControl;
|
||||
|
||||
#ifdef __DRI_TEX_OFFSET
|
||||
__DRItexOffsetExtension *texOffset;
|
||||
DRITexOffsetStartProcPtr texOffsetStart;
|
||||
DRITexOffsetFinishProcPtr texOffsetFinish;
|
||||
__GLXpixmap* texOffsetOverride[16];
|
||||
__GLXDRIdrawable *texOffsetOverride[16];
|
||||
GLuint lastTexOffsetOverride;
|
||||
#endif
|
||||
|
||||
unsigned char glx_enable_bits[__GLX_EXT_BYTES];
|
||||
};
|
||||
|
||||
struct __GLXDRIcontext {
|
||||
__GLXcontext base;
|
||||
|
||||
__DRIcontext driContext;
|
||||
__GLXcontext base;
|
||||
__DRIcontext driContext;
|
||||
XID hwContextID;
|
||||
};
|
||||
|
||||
struct __GLXDRIdrawable {
|
||||
__GLXdrawable base;
|
||||
__GLXdrawable base;
|
||||
__DRIdrawable driDrawable;
|
||||
|
||||
__DRIdrawable *driDrawable;
|
||||
/* Pulled in from old __GLXpixmap */
|
||||
#ifdef __DRI_TEX_OFFSET
|
||||
GLint texname;
|
||||
__GLXDRIcontext *ctx;
|
||||
unsigned long offset;
|
||||
DamagePtr pDamage;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* History:
|
||||
* 20021121 - Initial version
|
||||
* 20021128 - Added __glXWindowExists() function
|
||||
* 20021207 - Added support for dynamic GLX extensions,
|
||||
* GLX_SGI_swap_control, GLX_SGI_video_sync,
|
||||
* GLX_OML_sync_control, and GLX_MESA_swap_control.
|
||||
* Never officially released. Do NOT test against
|
||||
* this version. Use 20030317 instead.
|
||||
* 20030317 - Added support GLX_SGIX_fbconfig,
|
||||
* GLX_MESA_swap_frame_usage, GLX_OML_swap_method,
|
||||
* GLX_{ARB,SGIS}_multisample, and
|
||||
* GLX_SGIX_visual_select_group.
|
||||
* 20030606 - Added support for GLX_SGI_make_current_read.
|
||||
* 20030813 - Made support for dynamic extensions multi-head aware.
|
||||
* 20030818 - Added support for GLX_MESA_allocate_memory in place of the
|
||||
* deprecated GLX_NV_vertex_array_range & GLX_MESA_agp_offset
|
||||
* interfaces.
|
||||
* 20031201 - Added support for the first round of DRI interface changes.
|
||||
* Do NOT test against this version! It has binary
|
||||
* compatibility bugs, use 20040317 instead.
|
||||
* 20040317 - Added the 'mode' field to __DRIcontextRec.
|
||||
* 20040415 - Added support for bindContext3 and unbindContext3.
|
||||
* 20040602 - Add __glXGetDrawableInfo. I though that was there
|
||||
* months ago. :(
|
||||
* 20050727 - Gut all the old interfaces. This breaks compatability with
|
||||
* any DRI driver built to any previous version.
|
||||
* 20060314 - Added support for GLX_MESA_copy_sub_buffer.
|
||||
*/
|
||||
|
||||
#define INTERNAL_VERSION 20050727
|
||||
|
||||
static const char CREATE_NEW_SCREEN_FUNC[] =
|
||||
"__driCreateNewScreen_" STRINGIFY (INTERNAL_VERSION);
|
||||
|
||||
static const char CREATE_NEW_SCREEN_FUNC[] = __DRI_CREATE_NEW_SCREEN_STRING;
|
||||
|
||||
static void
|
||||
__glXDRIleaveServer(GLboolean rendering)
|
||||
|
|
@ -138,19 +116,19 @@ __glXDRIleaveServer(GLboolean rendering)
|
|||
|
||||
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
|
||||
__GLXDRIscreen * const screen =
|
||||
(__GLXDRIscreen *) __glXgetActiveScreen(i);
|
||||
(__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
|
||||
GLuint lastOverride = screen->lastTexOffsetOverride;
|
||||
|
||||
if (lastOverride) {
|
||||
__GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
|
||||
__GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < lastOverride; j++) {
|
||||
__GLXpixmap *pGlxPix = texOffsetOverride[j];
|
||||
__GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
|
||||
|
||||
if (pGlxPix && pGlxPix->texname) {
|
||||
pGlxPix->offset =
|
||||
screen->texOffsetStart((PixmapPtr)pGlxPix->pDraw);
|
||||
screen->texOffsetStart((PixmapPtr)pGlxPix->base.pDraw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -160,23 +138,22 @@ __glXDRIleaveServer(GLboolean rendering)
|
|||
|
||||
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
|
||||
__GLXDRIscreen * const screen =
|
||||
(__GLXDRIscreen *) __glXgetActiveScreen(i);
|
||||
(__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
|
||||
GLuint lastOverride = screen->lastTexOffsetOverride;
|
||||
|
||||
if (lastOverride) {
|
||||
__GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
|
||||
__GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < lastOverride; j++) {
|
||||
__GLXpixmap *pGlxPix = texOffsetOverride[j];
|
||||
__GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
|
||||
|
||||
if (pGlxPix && pGlxPix->texname) {
|
||||
screen->driScreen.setTexOffset(pGlxPix->pDRICtx,
|
||||
pGlxPix->texname,
|
||||
pGlxPix->offset,
|
||||
pGlxPix->pDraw->depth,
|
||||
((PixmapPtr)pGlxPix->pDraw)->
|
||||
devKind);
|
||||
screen->texOffset->setTexOffset(&pGlxPix->ctx->driContext,
|
||||
pGlxPix->texname,
|
||||
pGlxPix->offset,
|
||||
pGlxPix->base.pDraw->depth,
|
||||
((PixmapPtr)pGlxPix->base.pDraw)->devKind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -189,8 +166,8 @@ __glXDRIenterServer(GLboolean rendering)
|
|||
int i;
|
||||
|
||||
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
|
||||
__GLXDRIscreen * const screen =
|
||||
(__GLXDRIscreen *) __glXgetActiveScreen(i);
|
||||
__GLXDRIscreen * const screen = (__GLXDRIscreen *)
|
||||
glxGetScreen(screenInfo.screens[i]);
|
||||
|
||||
if (screen->lastTexOffsetOverride) {
|
||||
CALL_Flush(GET_DISPATCH(), ());
|
||||
|
|
@ -201,29 +178,17 @@ __glXDRIenterServer(GLboolean rendering)
|
|||
DRIWakeupHandler(NULL, 0, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* \bug
|
||||
* We're jumping through hoops here to get the DRIdrawable which the DRI
|
||||
* driver tries to keep to it self... cf. FIXME in \c createDrawable.
|
||||
*/
|
||||
static void
|
||||
__glXDRIdrawableFoo(__GLXDRIdrawable *draw)
|
||||
__glXDRIdrawableDestroy(__GLXdrawable *drawable)
|
||||
{
|
||||
__GLXDRIscreen * const screen =
|
||||
(__GLXDRIscreen *) __glXgetActiveScreen(draw->base.pDraw->pScreen->myNum);
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
|
||||
|
||||
draw->driDrawable = (*screen->driScreen.getDrawable)(NULL,
|
||||
draw->base.drawId,
|
||||
screen->driScreen.private);
|
||||
}
|
||||
(*private->driDrawable.destroyDrawable)(&private->driDrawable);
|
||||
|
||||
static void
|
||||
__glXDRIdrawableDestroy(__GLXdrawable *private)
|
||||
{
|
||||
#if 0
|
||||
(*glxPriv->driDrawable.destroyDrawable)(NULL,
|
||||
glxPriv->driDrawable.private);
|
||||
#endif
|
||||
__glXenterServer(GL_FALSE);
|
||||
DRIDestroyDrawable(drawable->pDraw->pScreen,
|
||||
serverClient, drawable->pDraw);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
||||
xfree(private);
|
||||
}
|
||||
|
|
@ -242,10 +207,7 @@ __glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate)
|
|||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
|
||||
|
||||
__glXDRIdrawableFoo(private);
|
||||
|
||||
(*private->driDrawable->swapBuffers)(NULL,
|
||||
private->driDrawable->private);
|
||||
(*private->driDrawable.swapBuffers)(&private->driDrawable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -255,10 +217,12 @@ static int
|
|||
__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval)
|
||||
{
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||
glxGetScreen(baseDrawable->pDraw->pScreen);
|
||||
|
||||
__glXDRIdrawableFoo(draw);
|
||||
if (screen->swapControl)
|
||||
screen->swapControl->setSwapInterval(&draw->driDrawable, interval);
|
||||
|
||||
draw->driDrawable->swap_interval = interval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -268,22 +232,26 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
|
|||
int x, int y, int w, int h)
|
||||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||
glxGetScreen(basePrivate->pDraw->pScreen);
|
||||
|
||||
__glXDRIdrawableFoo(private);
|
||||
|
||||
(*private->driDrawable->copySubBuffer)(NULL,
|
||||
private->driDrawable->private,
|
||||
x, y, w, h);
|
||||
if (screen->copySubBuffer)
|
||||
screen->copySubBuffer->copySubBuffer(&private->driDrawable,
|
||||
x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
__glXDRIcontextDestroy(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
Bool retval;
|
||||
|
||||
context->driContext.destroyContext(&context->driContext);
|
||||
|
||||
__glXenterServer(GL_FALSE);
|
||||
retval = DRIDestroyContext(baseContext->pScreen, context->hwContextID);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
||||
context->driContext.destroyContext(NULL,
|
||||
context->base.pScreen->myNum,
|
||||
context->driContext.private);
|
||||
__glXContextDestroy(&context->base);
|
||||
xfree(context);
|
||||
}
|
||||
|
|
@ -292,24 +260,20 @@ static int
|
|||
__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
|
||||
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
|
||||
|
||||
return (*context->driContext.bindContext)(NULL,
|
||||
context->base.pScreen->myNum,
|
||||
baseContext->drawPriv->drawId,
|
||||
baseContext->readPriv->drawId,
|
||||
&context->driContext);
|
||||
}
|
||||
return (*context->driContext.bindContext)(&context->driContext,
|
||||
&draw->driDrawable,
|
||||
&read->driDrawable);
|
||||
}
|
||||
|
||||
static int
|
||||
__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
|
||||
return (*context->driContext.unbindContext)(NULL,
|
||||
context->base.pScreen->myNum,
|
||||
baseContext->drawPriv->drawId,
|
||||
baseContext->readPriv->drawId,
|
||||
&context->driContext);
|
||||
return (*context->driContext.unbindContext)(&context->driContext);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -331,12 +295,12 @@ static int
|
|||
__glXDRIcontextForceCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
|
||||
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
|
||||
|
||||
return (*context->driContext.bindContext)(NULL,
|
||||
context->base.pScreen->myNum,
|
||||
baseContext->drawPriv->drawId,
|
||||
baseContext->readPriv->drawId,
|
||||
&context->driContext);
|
||||
return (*context->driContext.bindContext)(&context->driContext,
|
||||
&draw->driDrawable,
|
||||
&read->driDrawable);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -370,15 +334,17 @@ glxFillAlphaChannel (PixmapPtr pixmap, int x, int y, int width, int height)
|
|||
static int
|
||||
__glXDRIbindTexImage(__GLXcontext *baseContext,
|
||||
int buffer,
|
||||
__GLXpixmap *glxPixmap)
|
||||
__GLXdrawable *glxPixmap)
|
||||
{
|
||||
RegionPtr pRegion = NULL;
|
||||
PixmapPtr pixmap;
|
||||
int bpp, override = 0, texname;
|
||||
GLenum format, type;
|
||||
ScreenPtr pScreen = glxPixmap->pScreen;
|
||||
ScreenPtr pScreen = glxPixmap->pDraw->pScreen;
|
||||
__GLXDRIdrawable *driDraw =
|
||||
containerOf(glxPixmap, __GLXDRIdrawable, base);
|
||||
__GLXDRIscreen * const screen =
|
||||
(__GLXDRIscreen *) __glXgetActiveScreen(pScreen->myNum);
|
||||
(__GLXDRIscreen *) glxGetScreen(pScreen);
|
||||
|
||||
CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
|
||||
GL_TEXTURE_BINDING_2D :
|
||||
|
|
@ -390,12 +356,12 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
|
|||
|
||||
pixmap = (PixmapPtr) glxPixmap->pDraw;
|
||||
|
||||
if (screen->texOffsetStart && screen->driScreen.setTexOffset) {
|
||||
__GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
|
||||
if (screen->texOffsetStart && screen->texOffset) {
|
||||
__GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
|
||||
int i, firstEmpty = 16;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (texOffsetOverride[i] == glxPixmap)
|
||||
if (texOffsetOverride[i] == driDraw)
|
||||
goto alreadyin;
|
||||
|
||||
if (firstEmpty == 16 && !texOffsetOverride[i])
|
||||
|
|
@ -410,36 +376,37 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
|
|||
if (firstEmpty >= screen->lastTexOffsetOverride)
|
||||
screen->lastTexOffsetOverride = firstEmpty + 1;
|
||||
|
||||
texOffsetOverride[firstEmpty] = glxPixmap;
|
||||
texOffsetOverride[firstEmpty] = driDraw;
|
||||
|
||||
alreadyin:
|
||||
override = 1;
|
||||
|
||||
glxPixmap->pDRICtx = &((__GLXDRIcontext*)baseContext)->driContext;
|
||||
driDraw->ctx = (__GLXDRIcontext*)baseContext;
|
||||
|
||||
if (texname == glxPixmap->texname)
|
||||
if (texname == driDraw->texname)
|
||||
return Success;
|
||||
|
||||
glxPixmap->texname = texname;
|
||||
driDraw->texname = texname;
|
||||
|
||||
screen->driScreen.setTexOffset(glxPixmap->pDRICtx, texname, 0,
|
||||
pixmap->drawable.depth, pixmap->devKind);
|
||||
screen->texOffset->setTexOffset(&driDraw->ctx->driContext, texname, 0,
|
||||
pixmap->drawable.depth,
|
||||
pixmap->devKind);
|
||||
}
|
||||
nooverride:
|
||||
|
||||
if (!glxPixmap->pDamage) {
|
||||
if (!driDraw->pDamage) {
|
||||
if (!override) {
|
||||
glxPixmap->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
|
||||
TRUE, pScreen, NULL);
|
||||
if (!glxPixmap->pDamage)
|
||||
driDraw->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
|
||||
TRUE, pScreen, NULL);
|
||||
if (!driDraw->pDamage)
|
||||
return BadAlloc;
|
||||
|
||||
DamageRegister ((DrawablePtr) pixmap, glxPixmap->pDamage);
|
||||
DamageRegister ((DrawablePtr) pixmap, driDraw->pDamage);
|
||||
}
|
||||
|
||||
pRegion = NULL;
|
||||
} else {
|
||||
pRegion = DamageRegion(glxPixmap->pDamage);
|
||||
pRegion = DamageRegion(driDraw->pDamage);
|
||||
if (REGION_NIL(pRegion))
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -518,7 +485,7 @@ nooverride:
|
|||
}
|
||||
|
||||
if (!override)
|
||||
DamageEmpty(glxPixmap->pDamage);
|
||||
DamageEmpty(driDraw->pDamage);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -526,19 +493,21 @@ nooverride:
|
|||
static int
|
||||
__glXDRIreleaseTexImage(__GLXcontext *baseContext,
|
||||
int buffer,
|
||||
__GLXpixmap *pixmap)
|
||||
__GLXdrawable *pixmap)
|
||||
{
|
||||
ScreenPtr pScreen = pixmap->pScreen;
|
||||
ScreenPtr pScreen = pixmap->pDraw->pScreen;
|
||||
__GLXDRIdrawable *driDraw =
|
||||
containerOf(pixmap, __GLXDRIdrawable, base);
|
||||
__GLXDRIscreen * const screen =
|
||||
(__GLXDRIscreen *) __glXgetActiveScreen(pScreen->myNum);
|
||||
(__GLXDRIscreen *) glxGetScreen(pScreen);
|
||||
GLuint lastOverride = screen->lastTexOffsetOverride;
|
||||
|
||||
if (lastOverride) {
|
||||
__GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
|
||||
__GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < lastOverride; i++) {
|
||||
if (texOffsetOverride[i] == pixmap) {
|
||||
if (texOffsetOverride[i] == driDraw) {
|
||||
if (screen->texOffsetFinish)
|
||||
screen->texOffsetFinish((PixmapPtr)pixmap->pDraw);
|
||||
|
||||
|
|
@ -575,9 +544,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
|
|||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
|
||||
screen->driScreen.destroyScreen(NULL,
|
||||
screen->base.pScreen->myNum,
|
||||
screen->driScreen.private);
|
||||
screen->driScreen.destroyScreen(&screen->driScreen);
|
||||
|
||||
dlclose(screen->driver);
|
||||
|
||||
|
|
@ -593,13 +560,18 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
|||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
__GLXDRIcontext *context, *shareContext;
|
||||
void *sharePrivate;
|
||||
VisualPtr visual;
|
||||
int i;
|
||||
GLboolean retval;
|
||||
__DRIcontext *driShare;
|
||||
drm_context_t hwContext;
|
||||
ScreenPtr pScreen = baseScreen->pScreen;
|
||||
|
||||
shareContext = (__GLXDRIcontext *) baseShareContext;
|
||||
if (shareContext)
|
||||
sharePrivate = shareContext->driContext.private;
|
||||
driShare = &shareContext->driContext;
|
||||
else
|
||||
sharePrivate = NULL;
|
||||
driShare = NULL;
|
||||
|
||||
context = xalloc(sizeof *context);
|
||||
if (context == NULL)
|
||||
|
|
@ -614,25 +586,43 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
|||
context->base.pScreen = screen->base.pScreen;
|
||||
|
||||
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
|
||||
/* Find the requested X visual */
|
||||
visual = pScreen->visuals;
|
||||
for (i = 0; i < pScreen->numVisuals; i++, visual++)
|
||||
if (visual->vid == modes->visualID)
|
||||
break;
|
||||
if (i == pScreen->numVisuals)
|
||||
return GL_FALSE;
|
||||
|
||||
context->hwContextID = FakeClientID(0);
|
||||
|
||||
__glXenterServer(GL_FALSE);
|
||||
retval = DRICreateContext(baseScreen->pScreen, visual,
|
||||
context->hwContextID, &hwContext);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
||||
context->driContext.private =
|
||||
screen->driScreen.createNewContext(NULL, modes,
|
||||
screen->driScreen.createNewContext(&screen->driScreen,
|
||||
modes,
|
||||
0, /* render type */
|
||||
sharePrivate,
|
||||
driShare,
|
||||
hwContext,
|
||||
&context->driContext);
|
||||
|
||||
context->driContext.mode = modes;
|
||||
|
||||
return &context->base;
|
||||
}
|
||||
|
||||
static __GLXdrawable *
|
||||
__glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
||||
DrawablePtr pDraw,
|
||||
int type,
|
||||
XID drawId,
|
||||
__GLcontextModes *modes)
|
||||
{
|
||||
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
|
||||
__GLXDRIdrawable *private;
|
||||
GLboolean retval;
|
||||
drm_drawable_t hwDrawable;
|
||||
|
||||
private = xalloc(sizeof *private);
|
||||
if (private == NULL)
|
||||
|
|
@ -640,7 +630,8 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
|
||||
memset(private, 0, sizeof *private);
|
||||
|
||||
if (!__glXDrawableInit(&private->base, screen, pDraw, drawId, modes)) {
|
||||
if (!__glXDrawableInit(&private->base, screen,
|
||||
pDraw, type, drawId, modes)) {
|
||||
xfree(private);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -650,21 +641,19 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
|
||||
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
|
||||
|
||||
#if 0
|
||||
/* FIXME: It would only be natural that we called
|
||||
* driScreen->createNewDrawable here but the DRI drivers manage
|
||||
* them a little oddly. FIXME: describe this better.*/
|
||||
__glXenterServer(GL_FALSE);
|
||||
retval = DRICreateDrawable(screen->pScreen, serverClient,
|
||||
pDraw, &hwDrawable);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
||||
/* The last argument is 'attrs', which is used with pbuffers which
|
||||
* we currently don't support. */
|
||||
|
||||
glxPriv->driDrawable.private =
|
||||
(screen->driScreen.createNewDrawable)(NULL, modes,
|
||||
drawId,
|
||||
&glxPriv->driDrawable,
|
||||
0,
|
||||
NULL);
|
||||
#endif
|
||||
private->driDrawable.private =
|
||||
(driScreen->driScreen.createNewDrawable)(&driScreen->driScreen,
|
||||
modes,
|
||||
&private->driDrawable,
|
||||
hwDrawable, 0, NULL);
|
||||
|
||||
return &private->base;
|
||||
}
|
||||
|
|
@ -727,161 +716,28 @@ filter_modes(__GLcontextModes **server_modes,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
enable_glx_extension(void *psc, const char *ext_name)
|
||||
{
|
||||
__GLXDRIscreen * const screen = (__GLXDRIscreen *) psc;
|
||||
|
||||
__glXEnableExtension(screen->glx_enable_bits, ext_name);
|
||||
}
|
||||
|
||||
|
||||
static __DRIfuncPtr getProcAddress(const char *proc_name)
|
||||
{
|
||||
if (strcmp(proc_name, "glxEnableExtension") == 0) {
|
||||
return (__DRIfuncPtr) enable_glx_extension;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static __DRIscreen *findScreen(__DRInativeDisplay *dpy, int scrn)
|
||||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(scrn);
|
||||
|
||||
return &screen->driScreen;
|
||||
}
|
||||
|
||||
static GLboolean windowExists(__DRInativeDisplay *dpy, __DRIid draw)
|
||||
{
|
||||
DrawablePtr pDrawable = (DrawablePtr) LookupIDByType(draw, RT_WINDOW);
|
||||
int unused;
|
||||
drm_clip_rect_t *pRects;
|
||||
|
||||
return pDrawable ? DRIGetDrawableInfo(pDrawable->pScreen, pDrawable,
|
||||
(unsigned*)&unused, (unsigned*)&unused,
|
||||
&unused, &unused, &unused, &unused,
|
||||
&unused, &pRects, &unused, &unused,
|
||||
&unused, &pRects)
|
||||
: GL_FALSE;
|
||||
}
|
||||
|
||||
static GLboolean createContext(__DRInativeDisplay *dpy, int screen,
|
||||
int configID, void *contextID,
|
||||
drm_context_t *hw_context)
|
||||
{
|
||||
XID fakeID;
|
||||
VisualPtr visual;
|
||||
int i;
|
||||
ScreenPtr pScreen;
|
||||
GLboolean retval;
|
||||
|
||||
pScreen = screenInfo.screens[screen];
|
||||
|
||||
/* Find the requested X visual */
|
||||
visual = pScreen->visuals;
|
||||
for (i = 0; i < pScreen->numVisuals; i++, visual++)
|
||||
if (visual->vid == configID)
|
||||
break;
|
||||
if (i == pScreen->numVisuals)
|
||||
return GL_FALSE;
|
||||
|
||||
fakeID = FakeClientID(0);
|
||||
*(XID *) contextID = fakeID;
|
||||
|
||||
__glXDRIenterServer(GL_FALSE);
|
||||
retval = DRICreateContext(pScreen, visual, fakeID, hw_context);
|
||||
__glXDRIleaveServer(GL_FALSE);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GLboolean destroyContext(__DRInativeDisplay *dpy, int screen,
|
||||
__DRIid context)
|
||||
{
|
||||
GLboolean retval;
|
||||
|
||||
__glXDRIenterServer(GL_FALSE);
|
||||
retval = DRIDestroyContext(screenInfo.screens[screen], context);
|
||||
__glXDRIleaveServer(GL_FALSE);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
createDrawable(__DRInativeDisplay *dpy, int screen,
|
||||
__DRIid drawable, drm_drawable_t *hHWDrawable)
|
||||
{
|
||||
DrawablePtr pDrawable;
|
||||
GLboolean retval;
|
||||
|
||||
pDrawable = (DrawablePtr) LookupIDByClass(drawable, RC_DRAWABLE);
|
||||
if (!pDrawable)
|
||||
return GL_FALSE;
|
||||
|
||||
__glXDRIenterServer(GL_FALSE);
|
||||
retval = DRICreateDrawable(screenInfo.screens[screen], __pGlxClient,
|
||||
pDrawable, hHWDrawable);
|
||||
__glXDRIleaveServer(GL_FALSE);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
destroyDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable)
|
||||
{
|
||||
DrawablePtr pDrawable;
|
||||
GLboolean retval;
|
||||
|
||||
pDrawable = (DrawablePtr) LookupIDByClass(drawable, RC_DRAWABLE);
|
||||
if (!pDrawable)
|
||||
return GL_FALSE;
|
||||
|
||||
__glXDRIenterServer(GL_FALSE);
|
||||
retval = DRIDestroyDrawable(screenInfo.screens[screen], __pGlxClient,
|
||||
pDrawable);
|
||||
__glXDRIleaveServer(GL_FALSE);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
getDrawableInfo(__DRInativeDisplay *dpy, int screen,
|
||||
__DRIid drawable, unsigned int *index, unsigned int *stamp,
|
||||
getDrawableInfo(__DRIdrawable *driDrawable,
|
||||
unsigned int *index, unsigned int *stamp,
|
||||
int *x, int *y, int *width, int *height,
|
||||
int *numClipRects, drm_clip_rect_t **ppClipRects,
|
||||
int *backX, int *backY,
|
||||
int *numBackClipRects, drm_clip_rect_t **ppBackClipRects)
|
||||
{
|
||||
DrawablePtr pDrawable;
|
||||
__GLXDRIdrawable *drawable = containerOf(driDrawable,
|
||||
__GLXDRIdrawable, driDrawable);
|
||||
ScreenPtr pScreen = drawable->base.pDraw->pScreen;
|
||||
drm_clip_rect_t *pClipRects, *pBackClipRects;
|
||||
GLboolean retval;
|
||||
size_t size;
|
||||
|
||||
pDrawable = (DrawablePtr) LookupIDByClass(drawable, RC_DRAWABLE);
|
||||
if (!pDrawable) {
|
||||
ErrorF("getDrawableInfo failed to look up window\n");
|
||||
|
||||
*index = 0;
|
||||
*stamp = 0;
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
*numClipRects = 0;
|
||||
*ppClipRects = NULL;
|
||||
*backX = 0;
|
||||
*backY = 0;
|
||||
*numBackClipRects = 0;
|
||||
*ppBackClipRects = NULL;
|
||||
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
__glXDRIenterServer(GL_FALSE);
|
||||
retval = DRIGetDrawableInfo(screenInfo.screens[screen],
|
||||
pDrawable, index, stamp,
|
||||
__glXenterServer(GL_FALSE);
|
||||
retval = DRIGetDrawableInfo(pScreen, drawable->base.pDraw, index, stamp,
|
||||
x, y, width, height,
|
||||
numClipRects, &pClipRects,
|
||||
backX, backY,
|
||||
numBackClipRects, &pBackClipRects);
|
||||
__glXDRIleaveServer(GL_FALSE);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
||||
if (*numClipRects > 0) {
|
||||
size = sizeof (drm_clip_rect_t) * *numClipRects;
|
||||
|
|
@ -889,7 +745,6 @@ getDrawableInfo(__DRInativeDisplay *dpy, int screen,
|
|||
|
||||
/* Clip cliprects to screen dimensions (redirected windows) */
|
||||
if (*ppClipRects != NULL) {
|
||||
ScreenPtr pScreen = screenInfo.screens[screen];
|
||||
int i, j;
|
||||
|
||||
for (i = 0, j = 0; i < *numClipRects; i++) {
|
||||
|
|
@ -946,25 +801,33 @@ getUST(int64_t *ust)
|
|||
}
|
||||
}
|
||||
|
||||
static void __glXReportDamage(__DRIdrawable *driDraw,
|
||||
int x, int y,
|
||||
drm_clip_rect_t *rects, int num_rects,
|
||||
GLboolean front_buffer)
|
||||
{
|
||||
__GLXDRIdrawable *drawable =
|
||||
containerOf(driDraw, __GLXDRIdrawable, driDrawable);
|
||||
DrawablePtr pDraw = drawable->base.pDraw;
|
||||
RegionRec region;
|
||||
|
||||
REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, num_rects);
|
||||
REGION_TRANSLATE(pScreen, ®ion, pDraw->x, pDraw->y);
|
||||
DamageDamageRegion(pDraw, ®ion);
|
||||
REGION_UNINIT(pDraw->pScreen, ®ion);
|
||||
}
|
||||
|
||||
/* Table of functions that we export to the driver. */
|
||||
static const __DRIinterfaceMethods interface_methods = {
|
||||
getProcAddress,
|
||||
|
||||
_gl_context_modes_create,
|
||||
_gl_context_modes_destroy,
|
||||
|
||||
findScreen,
|
||||
windowExists,
|
||||
|
||||
createContext,
|
||||
destroyContext,
|
||||
|
||||
createDrawable,
|
||||
destroyDrawable,
|
||||
getDrawableInfo,
|
||||
|
||||
getUST,
|
||||
NULL, /* glXGetMscRateOML, */
|
||||
|
||||
__glXReportDamage,
|
||||
};
|
||||
|
||||
static const char dri_driver_path[] = DRI_DRIVER_PATH;
|
||||
|
|
@ -972,7 +835,8 @@ static const char dri_driver_path[] = DRI_DRIVER_PATH;
|
|||
static Bool
|
||||
glxDRIEnterVT (int index, int flags)
|
||||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(index);
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||
glxGetScreen(screenInfo.screens[index]);
|
||||
|
||||
LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
|
||||
|
||||
|
|
@ -987,7 +851,8 @@ glxDRIEnterVT (int index, int flags)
|
|||
static void
|
||||
glxDRILeaveVT (int index, int flags)
|
||||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(index);
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||
glxGetScreen(screenInfo.screens[index]);
|
||||
|
||||
LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
|
||||
|
||||
|
|
@ -996,6 +861,48 @@ glxDRILeaveVT (int index, int flags)
|
|||
return (*screen->leaveVT) (index, flags);
|
||||
}
|
||||
|
||||
static void
|
||||
initializeExtensions(__GLXDRIscreen *screen)
|
||||
{
|
||||
const __DRIextension **extensions;
|
||||
int i;
|
||||
|
||||
extensions = screen->driScreen.getExtensions(&screen->driScreen);
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
#ifdef __DRI_COPY_SUB_BUFFER
|
||||
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
|
||||
screen->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
|
||||
__glXEnableExtension(screen->glx_enable_bits,
|
||||
"GLX_MESA_copy_sub_buffer");
|
||||
|
||||
LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_SWAP_CONTROL
|
||||
if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
|
||||
screen->swapControl = (__DRIswapControlExtension *) extensions[i];
|
||||
__glXEnableExtension(screen->glx_enable_bits,
|
||||
"GLX_SGI_swap_control");
|
||||
__glXEnableExtension(screen->glx_enable_bits,
|
||||
"GLX_MESA_swap_control");
|
||||
|
||||
LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_TEX_OFFSET
|
||||
if (strcmp(extensions[i]->name, __DRI_TEX_OFFSET) == 0) {
|
||||
screen->texOffset = (__DRItexOffsetExtension *) extensions[i];
|
||||
LogMessage(X_INFO, "AIGLX: enabled GLX_texture_from_pixmap with driver support\n");
|
||||
}
|
||||
#endif
|
||||
/* Ignore unknown extensions */
|
||||
}
|
||||
}
|
||||
|
||||
#define COPY_SUB_BUFFER_INTERNAL_VERSION 20060314
|
||||
|
||||
static __GLXscreen *
|
||||
__glXDRIscreenProbe(ScreenPtr pScreen)
|
||||
{
|
||||
|
|
@ -1044,8 +951,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
screen->base.pScreen = pScreen;
|
||||
|
||||
__glXInitExtensionEnableBits(screen->glx_enable_bits);
|
||||
screen->driScreen.screenConfigs = screen;
|
||||
|
||||
|
||||
/* DRI protocol version. */
|
||||
dri_version.major = XF86DRI_MAJOR_VERSION;
|
||||
|
|
@ -1170,9 +1075,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
|
||||
driver_modes = NULL;
|
||||
screen->driScreen.private =
|
||||
(*createNewScreen)(NULL, pScreen->myNum,
|
||||
(*createNewScreen)(pScreen->myNum,
|
||||
&screen->driScreen,
|
||||
screen->base.modes,
|
||||
&ddx_version,
|
||||
&dri_version,
|
||||
&drm_version,
|
||||
|
|
@ -1191,6 +1095,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
|
||||
&screen->texOffsetFinish);
|
||||
|
||||
initializeExtensions(screen);
|
||||
|
||||
__glXScreenInit(&screen->base, pScreen);
|
||||
|
||||
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
|
||||
|
|
|
|||
255
GL/glx/glxext.c
255
GL/glx/glxext.c
|
|
@ -45,8 +45,6 @@ __GLXcontext *__glXLastContext;
|
|||
** X resources.
|
||||
*/
|
||||
RESTYPE __glXContextRes;
|
||||
RESTYPE __glXClientRes;
|
||||
RESTYPE __glXPixmapRes;
|
||||
RESTYPE __glXDrawableRes;
|
||||
RESTYPE __glXSwapBarrierRes;
|
||||
|
||||
|
|
@ -55,11 +53,7 @@ RESTYPE __glXSwapBarrierRes;
|
|||
*/
|
||||
xGLXSingleReply __glXReply;
|
||||
|
||||
/*
|
||||
** A set of state for each client. The 0th one is unused because client
|
||||
** indices start at 1, not 0.
|
||||
*/
|
||||
static __GLXclientState *__glXClients[MAXCLIENTS + 1];
|
||||
static int glxClientPrivateIndex;
|
||||
|
||||
/*
|
||||
** Client that called into GLX dispatch.
|
||||
|
|
@ -77,31 +71,6 @@ static int __glXDispatch(ClientPtr);
|
|||
static void ResetExtension(ExtensionEntry* extEntry)
|
||||
{
|
||||
__glXFlushContextCache();
|
||||
#if 0 /* glucose makes this a nuisance */
|
||||
__glXResetScreens();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** Initialize the per-client context storage.
|
||||
*/
|
||||
static void ResetClientState(int clientIndex)
|
||||
{
|
||||
__GLXclientState *cl = __glXClients[clientIndex];
|
||||
|
||||
if (cl->returnBuf) xfree(cl->returnBuf);
|
||||
if (cl->largeCmdBuf) xfree(cl->largeCmdBuf);
|
||||
if (cl->currentContexts) xfree(cl->currentContexts);
|
||||
memset(cl, 0, sizeof(__GLXclientState));
|
||||
/*
|
||||
** By default, assume that the client supports
|
||||
** GLX major version 1 minor version 0 protocol.
|
||||
*/
|
||||
cl->GLClientmajorVersion = 1;
|
||||
cl->GLClientminorVersion = 0;
|
||||
if (cl->GLClientextensions)
|
||||
xfree(cl->GLClientextensions);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -131,66 +100,6 @@ static int ContextGone(__GLXcontext* cx, XID id)
|
|||
return True;
|
||||
}
|
||||
|
||||
/*
|
||||
** Free a client's state.
|
||||
*/
|
||||
static int ClientGone(int clientIndex, XID id)
|
||||
{
|
||||
__GLXcontext *cx;
|
||||
__GLXclientState *cl = __glXClients[clientIndex];
|
||||
int i;
|
||||
|
||||
if (cl) {
|
||||
/*
|
||||
** Free all the contexts that are current for this client.
|
||||
*/
|
||||
for (i=0; i < cl->numCurrentContexts; i++) {
|
||||
cx = cl->currentContexts[i];
|
||||
if (cx) {
|
||||
__glXDeassociateContext(cx);
|
||||
cx->isCurrent = GL_FALSE;
|
||||
if (!cx->idExists) {
|
||||
__glXFreeContext(cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
** Re-initialize the client state structure. Don't free it because
|
||||
** we'll probably get another client with this index and use the struct
|
||||
** again. There is a maximum of MAXCLIENTS of these structures.
|
||||
*/
|
||||
ResetClientState(clientIndex);
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*
|
||||
** Free a GLX Pixmap.
|
||||
*/
|
||||
static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id)
|
||||
{
|
||||
PixmapPtr pPixmap = (PixmapPtr) pGlxPixmap->pDraw;
|
||||
|
||||
pGlxPixmap->idExists = False;
|
||||
if (!pGlxPixmap->refcnt) {
|
||||
#ifdef XF86DRI
|
||||
if (pGlxPixmap->pDamage) {
|
||||
DamageUnregister (pGlxPixmap->pDraw, pGlxPixmap->pDamage);
|
||||
DamageDestroy(pGlxPixmap->pDamage);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
** The DestroyPixmap routine should decrement the refcount and free
|
||||
** only if it's zero.
|
||||
*/
|
||||
(*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap);
|
||||
xfree(pGlxPixmap);
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*
|
||||
** Destroy routine that gets called when a drawable is freed. A drawable
|
||||
** contains the ancillary buffers needed for rendering.
|
||||
|
|
@ -200,24 +109,17 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
|
|||
__GLXcontext *cx, *cx1;
|
||||
|
||||
/*
|
||||
** Use glxPriv->type to figure out what kind of drawable this is. Don't
|
||||
** use glxPriv->pDraw->type because by the time this routine is called,
|
||||
** the pDraw might already have been freed.
|
||||
** When a drawable is destroyed, notify all context bound to
|
||||
** it, that there are no longer bound to anything.
|
||||
*/
|
||||
if (glxPriv->type == DRAWABLE_WINDOW) {
|
||||
/*
|
||||
** When a window is destroyed, notify all context bound to
|
||||
** it, that there are no longer bound to anything.
|
||||
*/
|
||||
for (cx = glxPriv->drawGlxc; cx; cx = cx1) {
|
||||
cx1 = cx->nextDrawPriv;
|
||||
cx->pendingState |= __GLX_PENDING_DESTROY;
|
||||
}
|
||||
for (cx = glxPriv->drawGlxc; cx; cx = cx1) {
|
||||
cx1 = cx->nextDrawPriv;
|
||||
cx->pendingState |= __GLX_PENDING_DESTROY;
|
||||
}
|
||||
|
||||
for (cx = glxPriv->readGlxc; cx; cx = cx1) {
|
||||
cx1 = cx->nextReadPriv;
|
||||
cx->pendingState |= __GLX_PENDING_DESTROY;
|
||||
}
|
||||
for (cx = glxPriv->readGlxc; cx; cx = cx1) {
|
||||
cx1 = cx->nextReadPriv;
|
||||
cx->pendingState |= __GLX_PENDING_DESTROY;
|
||||
}
|
||||
|
||||
__glXUnrefDrawable(glxPriv);
|
||||
|
|
@ -262,9 +164,10 @@ extern RESTYPE __glXSwapBarrierRes;
|
|||
|
||||
static int SwapBarrierGone(int screen, XID drawable)
|
||||
{
|
||||
if (__glXSwapBarrierFuncs &&
|
||||
__glXSwapBarrierFuncs[screen].bindSwapBarrierFunc != NULL) {
|
||||
__glXSwapBarrierFuncs[screen].bindSwapBarrierFunc(screen, drawable, 0);
|
||||
__GLXscreen *pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
|
||||
|
||||
if (pGlxScreen->swapBarrierFuncs) {
|
||||
pGlxScreen->swapBarrierFuncs->bindSwapBarrierFunc(screen, drawable, 0);
|
||||
}
|
||||
FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE);
|
||||
return True;
|
||||
|
|
@ -312,22 +215,86 @@ int __glXError(int error)
|
|||
return __glXErrorBase + error;
|
||||
}
|
||||
|
||||
__GLXclientState *
|
||||
glxGetClient(ClientPtr pClient)
|
||||
{
|
||||
return (__GLXclientState *) pClient->devPrivates[glxClientPrivateIndex].ptr;
|
||||
}
|
||||
|
||||
static void
|
||||
glxClientCallback (CallbackListPtr *list,
|
||||
pointer closure,
|
||||
pointer data)
|
||||
{
|
||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||
ClientPtr pClient = clientinfo->client;
|
||||
__GLXclientState *cl = glxGetClient(pClient);
|
||||
__GLXcontext *cx;
|
||||
int i;
|
||||
|
||||
switch (pClient->clientState) {
|
||||
case ClientStateRunning:
|
||||
/*
|
||||
** By default, assume that the client supports
|
||||
** GLX major version 1 minor version 0 protocol.
|
||||
*/
|
||||
cl->GLClientmajorVersion = 1;
|
||||
cl->GLClientminorVersion = 0;
|
||||
cl->client = pClient;
|
||||
break;
|
||||
|
||||
case ClientStateGone:
|
||||
for (i = 0; i < cl->numCurrentContexts; i++) {
|
||||
cx = cl->currentContexts[i];
|
||||
if (cx) {
|
||||
cx->isCurrent = GL_FALSE;
|
||||
if (!cx->idExists)
|
||||
__glXFreeContext(cx);
|
||||
}
|
||||
}
|
||||
|
||||
if (cl->returnBuf) xfree(cl->returnBuf);
|
||||
if (cl->largeCmdBuf) xfree(cl->largeCmdBuf);
|
||||
if (cl->currentContexts) xfree(cl->currentContexts);
|
||||
if (cl->GLClientextensions) xfree(cl->GLClientextensions);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static __GLXprovider *__glXProviderStack;
|
||||
|
||||
void GlxPushProvider(__GLXprovider *provider)
|
||||
{
|
||||
provider->next = __glXProviderStack;
|
||||
__glXProviderStack = provider;
|
||||
}
|
||||
|
||||
/*
|
||||
** Initialize the GLX extension.
|
||||
*/
|
||||
void GlxExtensionInit(void)
|
||||
{
|
||||
ExtensionEntry *extEntry;
|
||||
ScreenPtr pScreen;
|
||||
int i;
|
||||
__GLXprovider *p;
|
||||
|
||||
__glXContextRes = CreateNewResourceType((DeleteType)ContextGone);
|
||||
__glXClientRes = CreateNewResourceType((DeleteType)ClientGone);
|
||||
__glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone);
|
||||
__glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
|
||||
__glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone);
|
||||
|
||||
glxClientPrivateIndex = AllocateClientPrivateIndex ();
|
||||
if (!AllocateClientPrivate (glxClientPrivateIndex,
|
||||
sizeof (__GLXclientState)))
|
||||
return;
|
||||
if (!AddCallback (&ClientStateCallback, glxClientCallback, 0))
|
||||
return;
|
||||
|
||||
/*
|
||||
** Add extension to server extensions.
|
||||
*/
|
||||
|
|
@ -346,17 +313,17 @@ void GlxExtensionInit(void)
|
|||
|
||||
__glXErrorBase = extEntry->errorBase;
|
||||
|
||||
/*
|
||||
** Initialize table of client state. There is never a client 0.
|
||||
*/
|
||||
for (i = 1; i <= MAXCLIENTS; i++) {
|
||||
__glXClients[i] = 0;
|
||||
}
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
pScreen = screenInfo.screens[i];
|
||||
|
||||
/*
|
||||
** Initialize screen specific data.
|
||||
*/
|
||||
__glXInitScreens();
|
||||
for (p = __glXProviderStack; p != NULL; p = p->next) {
|
||||
if (p->screenProbe(pScreen) != NULL)
|
||||
LogMessage(X_INFO,
|
||||
"GLX: Initialized %s GL provider for screen %d\n",
|
||||
p->name, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
|
@ -424,11 +391,9 @@ void glxSuspendClients(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; i <= MAXCLIENTS; i++) {
|
||||
if (__glXClients[i] == NULL || !__glXClients[i]->inUse)
|
||||
continue;
|
||||
|
||||
IgnoreClient(__glXClients[i]->client);
|
||||
for (i = 1; i < currentMaxClients; i++) {
|
||||
if (glxGetClient(clients[i])->inUse)
|
||||
IgnoreClient(clients[i]);
|
||||
}
|
||||
|
||||
glxBlockClients = TRUE;
|
||||
|
|
@ -441,11 +406,9 @@ void glxResumeClients(void)
|
|||
|
||||
glxBlockClients = FALSE;
|
||||
|
||||
for (i = 1; i <= MAXCLIENTS; i++) {
|
||||
if (__glXClients[i] == NULL || !__glXClients[i]->inUse)
|
||||
continue;
|
||||
|
||||
AttendClient(__glXClients[i]->client);
|
||||
for (i = 1; i < currentMaxClients; i++) {
|
||||
if (glxGetClient(clients[i])->inUse)
|
||||
AttendClient(clients[i]);
|
||||
}
|
||||
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
|
@ -507,29 +470,9 @@ static int __glXDispatch(ClientPtr client)
|
|||
int retval;
|
||||
|
||||
opcode = stuff->glxCode;
|
||||
cl = __glXClients[client->index];
|
||||
if (!cl) {
|
||||
cl = (__GLXclientState *) xalloc(sizeof(__GLXclientState));
|
||||
__glXClients[client->index] = cl;
|
||||
if (!cl) {
|
||||
return BadAlloc;
|
||||
}
|
||||
memset(cl, 0, sizeof(__GLXclientState));
|
||||
}
|
||||
|
||||
if (!cl->inUse) {
|
||||
/*
|
||||
** This is first request from this client. Associate a resource
|
||||
** with the client so we will be notified when the client dies.
|
||||
*/
|
||||
XID xid = FakeClientID(client->index);
|
||||
if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) {
|
||||
return BadAlloc;
|
||||
}
|
||||
ResetClientState(client->index);
|
||||
cl->inUse = GL_TRUE;
|
||||
cl->client = client;
|
||||
}
|
||||
cl = glxGetClient(client);
|
||||
/* Mark it in use so we suspend it on VT switch. */
|
||||
cl->inUse = TRUE;
|
||||
|
||||
/*
|
||||
** If we're expecting a glXRenderLarge request, this better be one.
|
||||
|
|
|
|||
|
|
@ -71,24 +71,6 @@ extern void __glXClearErrorOccured(void);
|
|||
extern GLboolean __glXErrorOccured(void);
|
||||
extern void __glXResetLargeCommandStatus(__GLXclientState*);
|
||||
|
||||
extern int DoMakeCurrent( __GLXclientState *cl, GLXDrawable drawId,
|
||||
GLXDrawable readId, GLXContextID contextId, GLXContextTag tag );
|
||||
extern int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen,
|
||||
GLboolean do_swap);
|
||||
extern int DoGetFBConfigs(__GLXclientState *cl, unsigned screen,
|
||||
GLboolean do_swap);
|
||||
extern int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
||||
GLXContextID shareList, VisualID visual, GLuint screen, GLboolean isDirect);
|
||||
extern int DoCreateGLXPixmap(__GLXclientState *cl, XID fbconfigId,
|
||||
GLuint screenNum, XID pixmapId, XID glxpixmapId, CARD32 *attribs,
|
||||
CARD32 numAttribs);
|
||||
extern int DoDestroyPixmap(__GLXclientState *cl, XID glxpixmapId);
|
||||
|
||||
extern int DoQueryContext(__GLXclientState *cl, GLXContextID gcId);
|
||||
|
||||
extern int DoRender(__GLXclientState *cl, GLbyte *pc, int do_swap);
|
||||
extern int DoRenderLarge(__GLXclientState *cl, GLbyte *pc, int do_swap);
|
||||
|
||||
extern void GlxExtensionInit(void);
|
||||
|
||||
extern const char GLServerVersion[];
|
||||
|
|
@ -106,25 +88,5 @@ extern int GlxInitVisuals(
|
|||
int preferredVis
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
void * (* queryHyperpipeNetworkFunc)(int, int *, int *);
|
||||
void * (* queryHyperpipeConfigFunc)(int, int, int *, int *);
|
||||
int (* destroyHyperpipeConfigFunc)(int, int);
|
||||
void * (* hyperpipeConfigFunc)(int, int, int *, int *, void *);
|
||||
} __GLXHyperpipeExtensionFuncs;
|
||||
|
||||
extern void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs);
|
||||
|
||||
extern __GLXHyperpipeExtensionFuncs *__glXHyperpipeFuncs;
|
||||
|
||||
typedef struct {
|
||||
int (* bindSwapBarrierFunc)(int, XID, int);
|
||||
int (* queryMaxSwapBarriersFunc)(int);
|
||||
} __GLXSwapBarrierExtensionFuncs;
|
||||
|
||||
extern void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs);
|
||||
|
||||
extern __GLXSwapBarrierExtensionFuncs *__glXSwapBarrierFuncs;
|
||||
|
||||
#endif /* _glxext_h_ */
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ __glXMesaDrawableSwapBuffers(__GLXdrawable *base)
|
|||
|
||||
static __GLXdrawable *
|
||||
__glXMesaScreenCreateDrawable(__GLXscreen *screen,
|
||||
DrawablePtr pDraw,
|
||||
DrawablePtr pDraw, int type,
|
||||
XID drawId,
|
||||
__GLcontextModes *modes)
|
||||
{
|
||||
|
|
@ -131,7 +131,8 @@ __glXMesaScreenCreateDrawable(__GLXscreen *screen,
|
|||
|
||||
memset(glxPriv, 0, sizeof *glxPriv);
|
||||
|
||||
if (!__glXDrawableInit(&glxPriv->base, screen, pDraw, drawId, modes)) {
|
||||
if (!__glXDrawableInit(&glxPriv->base, screen,
|
||||
pDraw, type, drawId, modes)) {
|
||||
xfree(glxPriv);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@
|
|||
#include "glxutil.h"
|
||||
#include "glxext.h"
|
||||
|
||||
static int glxScreenPrivateIndex;
|
||||
|
||||
const char GLServerVersion[] = "1.4";
|
||||
static const char GLServerExtensions[] =
|
||||
"GL_ARB_depth_texture "
|
||||
|
|
@ -179,36 +181,25 @@ static char GLXServerExtensions[] =
|
|||
"GLX_MESA_copy_sub_buffer "
|
||||
;
|
||||
|
||||
__GLXscreen **__glXActiveScreens;
|
||||
|
||||
__GLXSwapBarrierExtensionFuncs *__glXSwapBarrierFuncs = NULL;
|
||||
static int __glXNumSwapBarrierFuncs = 0;
|
||||
__GLXHyperpipeExtensionFuncs *__glXHyperpipeFuncs = NULL;
|
||||
static int __glXNumHyperpipeFuncs = 0;
|
||||
|
||||
__GLXscreen *__glXgetActiveScreen(int num) {
|
||||
return __glXActiveScreens[num];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** This hook gets called when a window moves or changes size.
|
||||
*/
|
||||
static Bool PositionWindow(WindowPtr pWin, int x, int y)
|
||||
static Bool glxPositionWindow(WindowPtr pWin, int x, int y)
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
__GLXcontext *glxc;
|
||||
__GLXdrawable *glxPriv;
|
||||
Bool ret;
|
||||
__GLXscreen *pGlxScreen;
|
||||
|
||||
/*
|
||||
** Call wrapped position window routine
|
||||
*/
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
pScreen->PositionWindow =
|
||||
__glXActiveScreens[pScreen->myNum]->WrappedPositionWindow;
|
||||
pGlxScreen = glxGetScreen(pScreen);
|
||||
pScreen->PositionWindow = pGlxScreen->PositionWindow;
|
||||
ret = (*pScreen->PositionWindow)(pWin, x, y);
|
||||
pScreen->PositionWindow = PositionWindow;
|
||||
pScreen->PositionWindow = glxPositionWindow;
|
||||
|
||||
/*
|
||||
** Tell all contexts rendering into this window that the window size
|
||||
|
|
@ -262,111 +253,71 @@ static Bool PositionWindow(WindowPtr pWin, int x, int y)
|
|||
|
||||
void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs)
|
||||
{
|
||||
if (__glXNumHyperpipeFuncs < screen + 1) {
|
||||
__glXHyperpipeFuncs = xrealloc(__glXHyperpipeFuncs,
|
||||
(screen+1) * sizeof(__GLXHyperpipeExtensionFuncs));
|
||||
__glXNumHyperpipeFuncs = screen + 1;
|
||||
}
|
||||
__GLXscreen *pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
|
||||
|
||||
__glXHyperpipeFuncs[screen].queryHyperpipeNetworkFunc =
|
||||
*funcs->queryHyperpipeNetworkFunc;
|
||||
__glXHyperpipeFuncs[screen].queryHyperpipeConfigFunc =
|
||||
*funcs->queryHyperpipeConfigFunc;
|
||||
__glXHyperpipeFuncs[screen].destroyHyperpipeConfigFunc =
|
||||
*funcs->destroyHyperpipeConfigFunc;
|
||||
__glXHyperpipeFuncs[screen].hyperpipeConfigFunc =
|
||||
*funcs->hyperpipeConfigFunc;
|
||||
pGlxScreen->hyperpipeFuncs = funcs;
|
||||
}
|
||||
|
||||
void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs)
|
||||
{
|
||||
if (__glXNumSwapBarrierFuncs < screen + 1) {
|
||||
__glXSwapBarrierFuncs = xrealloc(__glXSwapBarrierFuncs,
|
||||
(screen+1) * sizeof(__GLXSwapBarrierExtensionFuncs));
|
||||
__glXNumSwapBarrierFuncs = screen + 1;
|
||||
__GLXscreen *pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
|
||||
|
||||
pGlxScreen->swapBarrierFuncs = funcs;
|
||||
}
|
||||
|
||||
static Bool
|
||||
glxCloseScreen (int index, ScreenPtr pScreen)
|
||||
{
|
||||
__GLXscreen *pGlxScreen = glxGetScreen(pScreen);
|
||||
|
||||
pScreen->CloseScreen = pGlxScreen->CloseScreen;
|
||||
pScreen->PositionWindow = pGlxScreen->PositionWindow;
|
||||
|
||||
pGlxScreen->destroy(pGlxScreen);
|
||||
|
||||
return pScreen->CloseScreen(index, pScreen);
|
||||
}
|
||||
|
||||
__GLXscreen *
|
||||
glxGetScreen(ScreenPtr pScreen)
|
||||
{
|
||||
return (__GLXscreen *) pScreen->devPrivates[glxScreenPrivateIndex].ptr;
|
||||
}
|
||||
|
||||
void __glXScreenInit(__GLXscreen *glxScreen, ScreenPtr pScreen)
|
||||
{
|
||||
static int glxGeneration;
|
||||
|
||||
if (glxGeneration != serverGeneration)
|
||||
{
|
||||
glxScreenPrivateIndex = AllocateScreenPrivateIndex ();
|
||||
if (glxScreenPrivateIndex == -1)
|
||||
return;
|
||||
|
||||
glxGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
__glXSwapBarrierFuncs[screen].bindSwapBarrierFunc =
|
||||
funcs->bindSwapBarrierFunc;
|
||||
__glXSwapBarrierFuncs[screen].queryMaxSwapBarriersFunc =
|
||||
funcs->queryMaxSwapBarriersFunc;
|
||||
glxScreen->pScreen = pScreen;
|
||||
glxScreen->GLextensions = xstrdup(GLServerExtensions);
|
||||
glxScreen->GLXvendor = xstrdup(GLXServerVendorName);
|
||||
glxScreen->GLXversion = xstrdup(GLXServerVersion);
|
||||
glxScreen->GLXextensions = xstrdup(GLXServerExtensions);
|
||||
|
||||
glxScreen->PositionWindow = pScreen->PositionWindow;
|
||||
pScreen->PositionWindow = glxPositionWindow;
|
||||
|
||||
glxScreen->CloseScreen = pScreen->CloseScreen;
|
||||
pScreen->CloseScreen = glxCloseScreen;
|
||||
|
||||
__glXScreenInitVisuals(glxScreen);
|
||||
|
||||
pScreen->devPrivates[glxScreenPrivateIndex].ptr = (pointer) glxScreen;
|
||||
}
|
||||
|
||||
static __GLXprovider *__glXProviderStack;
|
||||
|
||||
void GlxPushProvider(__GLXprovider *provider)
|
||||
{
|
||||
provider->next = __glXProviderStack;
|
||||
__glXProviderStack = provider;
|
||||
}
|
||||
|
||||
void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen)
|
||||
{
|
||||
screen->pScreen = pScreen;
|
||||
screen->GLextensions = xstrdup(GLServerExtensions);
|
||||
screen->GLXvendor = xstrdup(GLXServerVendorName);
|
||||
screen->GLXversion = xstrdup(GLXServerVersion);
|
||||
screen->GLXextensions = xstrdup(GLXServerExtensions);
|
||||
|
||||
screen->WrappedPositionWindow = pScreen->PositionWindow;
|
||||
pScreen->PositionWindow = PositionWindow;
|
||||
|
||||
__glXScreenInitVisuals(screen);
|
||||
}
|
||||
|
||||
void
|
||||
__glXScreenDestroy(__GLXscreen *screen)
|
||||
|
||||
void __glXScreenDestroy(__GLXscreen *screen)
|
||||
{
|
||||
xfree(screen->GLXvendor);
|
||||
xfree(screen->GLXversion);
|
||||
xfree(screen->GLXextensions);
|
||||
xfree(screen->GLextensions);
|
||||
}
|
||||
|
||||
void __glXInitScreens(void)
|
||||
{
|
||||
GLint i;
|
||||
ScreenPtr pScreen;
|
||||
__GLXprovider *p;
|
||||
size_t size;
|
||||
|
||||
/*
|
||||
** This alloc has to work or else the server might as well core dump.
|
||||
*/
|
||||
size = screenInfo.numScreens * sizeof(__GLXscreen *);
|
||||
__glXActiveScreens = xalloc(size);
|
||||
memset(__glXActiveScreens, 0, size);
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
pScreen = screenInfo.screens[i];
|
||||
|
||||
for (p = __glXProviderStack; p != NULL; p = p->next) {
|
||||
__glXActiveScreens[i] = p->screenProbe(pScreen);
|
||||
if (__glXActiveScreens[i] != NULL) {
|
||||
LogMessage(X_INFO,
|
||||
"GLX: Initialized %s GL provider for screen %d\n",
|
||||
p->name, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void __glXResetScreens(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
if (__glXActiveScreens[i])
|
||||
__glXActiveScreens[i]->destroy(__glXActiveScreens[i]);
|
||||
}
|
||||
|
||||
xfree(__glXActiveScreens);
|
||||
xfree(__glXHyperpipeFuncs);
|
||||
xfree(__glXSwapBarrierFuncs);
|
||||
__glXNumHyperpipeFuncs = 0;
|
||||
__glXNumSwapBarrierFuncs = 0;
|
||||
__glXHyperpipeFuncs = NULL;
|
||||
__glXSwapBarrierFuncs = NULL;
|
||||
__glXActiveScreens = NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,21 @@
|
|||
|
||||
#include "GL/internal/glcore.h"
|
||||
|
||||
typedef struct {
|
||||
void * (* queryHyperpipeNetworkFunc)(int, int *, int *);
|
||||
void * (* queryHyperpipeConfigFunc)(int, int, int *, int *);
|
||||
int (* destroyHyperpipeConfigFunc)(int, int);
|
||||
void * (* hyperpipeConfigFunc)(int, int, int *, int *, void *);
|
||||
} __GLXHyperpipeExtensionFuncs;
|
||||
|
||||
typedef struct {
|
||||
int (* bindSwapBarrierFunc)(int, XID, int);
|
||||
int (* queryMaxSwapBarriersFunc)(int);
|
||||
} __GLXSwapBarrierExtensionFuncs;
|
||||
|
||||
void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs);
|
||||
void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs);
|
||||
|
||||
/*
|
||||
** Screen dependent data. These methods are the interface between the DIX
|
||||
** and DDX layers of the GLX server extension. The methods provide an
|
||||
|
|
@ -57,11 +72,15 @@ struct __GLXscreen {
|
|||
|
||||
__GLXdrawable *(*createDrawable)(__GLXscreen *context,
|
||||
DrawablePtr pDraw,
|
||||
int type,
|
||||
XID drawId,
|
||||
__GLcontextModes *modes);
|
||||
int (*swapInterval) (__GLXdrawable *drawable,
|
||||
int interval);
|
||||
|
||||
__GLXHyperpipeExtensionFuncs *hyperpipeFuncs;
|
||||
__GLXSwapBarrierExtensionFuncs *swapBarrierFuncs;
|
||||
|
||||
ScreenPtr pScreen;
|
||||
|
||||
/**
|
||||
|
|
@ -79,18 +98,12 @@ struct __GLXscreen {
|
|||
char *GLXversion;
|
||||
char *GLXextensions;
|
||||
|
||||
/*
|
||||
** Things that are not statically set.
|
||||
*/
|
||||
Bool (*WrappedPositionWindow)(WindowPtr pWin, int x, int y);
|
||||
|
||||
Bool (*PositionWindow)(WindowPtr pWin, int x, int y);
|
||||
Bool (*CloseScreen)(int index, ScreenPtr pScreen);
|
||||
};
|
||||
|
||||
|
||||
void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen);
|
||||
void __glXScreenDestroy(__GLXscreen *screen);
|
||||
|
||||
void __glXInitScreens(void);
|
||||
extern void __glXResetScreens(void);
|
||||
|
||||
#endif /* !__GLX_screens_h__ */
|
||||
|
|
|
|||
|
|
@ -90,9 +90,8 @@ typedef XID GLXDrawable;
|
|||
|
||||
typedef struct __GLXclientStateRec __GLXclientState;
|
||||
|
||||
extern __GLXscreen **__glXActiveScreens;
|
||||
extern GLint __glXNumActiveScreens;
|
||||
extern __GLXscreen *__glXgetActiveScreen(int num);
|
||||
extern __GLXscreen *glxGetScreen(ScreenPtr pScreen);
|
||||
extern __GLXclientState *glxGetClient(ClientPtr pClient);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -139,18 +139,15 @@ __glXUnrefDrawable(__GLXdrawable *glxPriv)
|
|||
|
||||
GLboolean
|
||||
__glXDrawableInit(__GLXdrawable *drawable,
|
||||
__GLXscreen *screen, DrawablePtr pDraw, XID drawId,
|
||||
__GLcontextModes *modes)
|
||||
__GLXscreen *screen, DrawablePtr pDraw, int type,
|
||||
XID drawId, __GLcontextModes *modes)
|
||||
{
|
||||
drawable->type = pDraw->type;
|
||||
drawable->pDraw = pDraw;
|
||||
drawable->type = type;
|
||||
drawable->drawId = drawId;
|
||||
drawable->refCount = 1;
|
||||
drawable->modes = modes;
|
||||
|
||||
/* if not a pixmap, lookup will fail, so pGlxPixmap will be NULL */
|
||||
drawable->pGlxPixmap = (__GLXpixmap *)
|
||||
LookupIDByType(drawId, __glXPixmapRes);
|
||||
drawable->eventMask = 0;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ extern void __glXUnrefDrawable(__GLXdrawable *glxPriv);
|
|||
|
||||
extern GLboolean __glXDrawableInit(__GLXdrawable *drawable,
|
||||
__GLXscreen *screen,
|
||||
DrawablePtr pDraw, XID drawID,
|
||||
DrawablePtr pDraw, int type, XID drawID,
|
||||
__GLcontextModes *modes);
|
||||
|
||||
/* context helper routines */
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
|
||||
void GlxWrapInitVisuals(miInitVisualsProcPtr *);
|
||||
|
||||
extern Bool noGlxVisualInit;
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
struct ScreenVisualsRec {
|
||||
|
|
@ -452,14 +453,15 @@ Bool GlxInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
|
|||
/*
|
||||
* Setup the visuals supported by this particular screen.
|
||||
*/
|
||||
init_visuals(nvisualp, visualp, defaultVisp,
|
||||
*ndepthp, *depthp, *rootDepthp);
|
||||
if (!noGlxVisualInit) {
|
||||
init_visuals(nvisualp, visualp, defaultVisp,
|
||||
*ndepthp, *depthp, *rootDepthp);
|
||||
}
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -207,6 +207,8 @@ extern HIDDEN void __glXDisp_TexCoord2iv(GLbyte * pc);
|
|||
extern HIDDEN void __glXDispSwap_TexCoord2iv(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_CompressedTexImage1DARB(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_Rotated(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_Rotated(GLbyte * pc);
|
||||
extern HIDDEN int __glXDisp_ReadPixels(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN int __glXDispSwap_ReadPixels(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN void __glXDisp_EdgeFlagv(GLbyte * pc);
|
||||
|
|
@ -293,8 +295,8 @@ extern HIDDEN void __glXDisp_ClearIndex(GLbyte * pc);
|
|||
extern HIDDEN void __glXDispSwap_ClearIndex(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_LoadMatrixd(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_LoadMatrixd(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_RasterPos2dv(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_RasterPos2dv(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_PushMatrix(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_PushMatrix(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_ConvolutionParameterfv(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc);
|
||||
extern HIDDEN int __glXDisp_GetTexGendv(struct __GLXclientStateRec *, GLbyte *);
|
||||
|
|
@ -371,14 +373,16 @@ extern HIDDEN void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc);
|
|||
extern HIDDEN void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_VertexAttrib4fvARB(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc);
|
||||
extern HIDDEN int __glXDisp_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN int __glXDispSwap_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN void __glXDisp_MultiTexCoord1svARB(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_EndQueryARB(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_EndQueryARB(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_DepthMask(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_DepthMask(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_Rotated(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_Rotated(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_Color4iv(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc);
|
||||
extern HIDDEN int __glXDisp_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN int __glXDispSwap_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN void __glXDisp_StencilOp(GLbyte * pc);
|
||||
|
|
@ -619,8 +623,8 @@ extern HIDDEN int __glXDisp_PixelStorei(struct __GLXclientStateRec *, GLbyte *);
|
|||
extern HIDDEN int __glXDispSwap_PixelStorei(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN void __glXDisp_VertexAttrib4usvARB(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_Color4iv(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc);
|
||||
extern HIDDEN int __glXDisp_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN int __glXDispSwap_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN void __glXDisp_EvalCoord2dv(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_EvalCoord2dv(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_VertexAttrib3svARB(GLbyte * pc);
|
||||
|
|
@ -669,6 +673,8 @@ extern HIDDEN void __glXDisp_Lighti(GLbyte * pc);
|
|||
extern HIDDEN void __glXDispSwap_Lighti(GLbyte * pc);
|
||||
extern HIDDEN int __glXDisp_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN int __glXDisp_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN int __glXDispSwap_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
|
||||
extern HIDDEN void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc);
|
||||
extern HIDDEN int __glXDisp_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *);
|
||||
|
|
@ -751,8 +757,8 @@ extern HIDDEN void __glXDisp_PixelTransferf(GLbyte * pc);
|
|||
extern HIDDEN void __glXDispSwap_PixelTransferf(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_CopyTexImage1D(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_CopyTexImage1D(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_PushMatrix(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_PushMatrix(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_RasterPos2dv(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_RasterPos2dv(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_Fogiv(GLbyte * pc);
|
||||
extern HIDDEN void __glXDispSwap_Fogiv(GLbyte * pc);
|
||||
extern HIDDEN void __glXDisp_TexCoord1dv(GLbyte * pc);
|
||||
|
|
|
|||
|
|
@ -697,6 +697,7 @@ __glGetBooleanv_size(GLenum e)
|
|||
case GL_MATRIX_INDEX_ARRAY_SIZE_ARB:
|
||||
case GL_MATRIX_INDEX_ARRAY_TYPE_ARB:
|
||||
case GL_MATRIX_INDEX_ARRAY_STRIDE_ARB:
|
||||
case GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT:
|
||||
case GL_POINT_SPRITE_ARB:
|
||||
/* case GL_POINT_SPRITE_NV:*/
|
||||
case GL_POINT_SPRITE_R_MODE_NV:
|
||||
|
|
@ -704,8 +705,11 @@ __glGetBooleanv_size(GLenum e)
|
|||
case GL_MAX_TEXTURE_COORDS_ARB:
|
||||
case GL_MAX_TEXTURE_IMAGE_UNITS_ARB:
|
||||
case GL_DEPTH_BOUNDS_TEST_EXT:
|
||||
case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT:
|
||||
case GL_STENCIL_TEST_TWO_SIDE_EXT:
|
||||
case GL_ACTIVE_STENCIL_FACE_EXT:
|
||||
case GL_TEXTURE_BINDING_1D_ARRAY_EXT:
|
||||
case GL_TEXTURE_BINDING_2D_ARRAY_EXT:
|
||||
case GL_RASTER_POSITION_UNCLIPPED_IBM:
|
||||
return 1;
|
||||
case GL_SMOOTH_POINT_SIZE_RANGE:
|
||||
|
|
|
|||
|
|
@ -1575,9 +1575,9 @@ static const void *VendorPriv_function_table[104][2] = {
|
|||
/* [ 92] = 65540 */ {__glXDisp_GetFBConfigsSGIX, __glXDispSwap_GetFBConfigsSGIX},
|
||||
/* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX},
|
||||
/* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX},
|
||||
/* [ 95] = 65543 */ {NULL, NULL},
|
||||
/* [ 96] = 65544 */ {NULL, NULL},
|
||||
/* [ 97] = 65545 */ {NULL, NULL},
|
||||
/* [ 95] = 65543 */ {__glXDisp_CreateGLXPbufferSGIX, __glXDispSwap_CreateGLXPbufferSGIX},
|
||||
/* [ 96] = 65544 */ {__glXDisp_DestroyGLXPbufferSGIX, __glXDispSwap_DestroyGLXPbufferSGIX},
|
||||
/* [ 97] = 65545 */ {__glXDisp_ChangeDrawableAttributesSGIX, __glXDispSwap_ChangeDrawableAttributesSGIX},
|
||||
/* [ 98] = 65546 */ {__glXDisp_GetDrawableAttributesSGIX, __glXDispSwap_GetDrawableAttributesSGIX},
|
||||
/* [ 99] = 65547 */ {NULL, NULL},
|
||||
/* [ 100] = 65548 */ {NULL, NULL},
|
||||
|
|
|
|||
100
Xext/shm.c
100
Xext/shm.c
|
|
@ -62,6 +62,33 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include <X11/extensions/shmstr.h>
|
||||
#include <X11/Xfuncproto.h>
|
||||
|
||||
/* Needed for Solaris cross-zone shared memory extension */
|
||||
#ifdef HAVE_SHMCTL64
|
||||
#include <sys/ipc_impl.h>
|
||||
#define SHMSTAT(id, buf) shmctl64(id, IPC_STAT64, buf)
|
||||
#define SHMSTAT_TYPE struct shmid_ds64
|
||||
#define SHMPERM_TYPE struct ipc_perm64
|
||||
#define SHM_PERM(buf) buf.shmx_perm
|
||||
#define SHM_SEGSZ(buf) buf.shmx_segsz
|
||||
#define SHMPERM_UID(p) p->ipcx_uid
|
||||
#define SHMPERM_CUID(p) p->ipcx_cuid
|
||||
#define SHMPERM_GID(p) p->ipcx_gid
|
||||
#define SHMPERM_CGID(p) p->ipcx_cgid
|
||||
#define SHMPERM_MODE(p) p->ipcx_mode
|
||||
#define SHMPERM_ZONEID(p) p->ipcx_zoneid
|
||||
#else
|
||||
#define SHMSTAT(id, buf) shmctl(id, IPC_STAT, buf)
|
||||
#define SHMSTAT_TYPE struct shmid_ds
|
||||
#define SHMPERM_TYPE struct ipc_perm
|
||||
#define SHM_PERM(buf) buf.shm_perm
|
||||
#define SHM_SEGSZ(buf) buf.shm_segsz
|
||||
#define SHMPERM_UID(p) p->uid
|
||||
#define SHMPERM_CUID(p) p->cuid
|
||||
#define SHMPERM_GID(p) p->gid
|
||||
#define SHMPERM_CGID(p) p->cgid
|
||||
#define SHMPERM_MODE(p) p->mode
|
||||
#endif
|
||||
|
||||
#ifdef PANORAMIX
|
||||
#include "panoramiX.h"
|
||||
#include "panoramiXsrv.h"
|
||||
|
|
@ -348,32 +375,57 @@ ProcShmQueryVersion(client)
|
|||
* using the credentials from the client if available
|
||||
*/
|
||||
static int
|
||||
shm_access(ClientPtr client, struct ipc_perm *perm, int readonly)
|
||||
shm_access(ClientPtr client, SHMPERM_TYPE *perm, int readonly)
|
||||
{
|
||||
int uid, gid;
|
||||
mode_t mask;
|
||||
int uidset = 0, gidset = 0;
|
||||
LocalClientCredRec *lcc;
|
||||
|
||||
if (GetLocalClientCreds(client, &lcc) != -1) {
|
||||
|
||||
if (LocalClientCred(client, &uid, &gid) != -1) {
|
||||
if (lcc->fieldsSet & LCC_UID_SET) {
|
||||
uid = lcc->euid;
|
||||
uidset = 1;
|
||||
}
|
||||
if (lcc->fieldsSet & LCC_GID_SET) {
|
||||
gid = lcc->egid;
|
||||
gidset = 1;
|
||||
}
|
||||
|
||||
#if defined(HAVE_GETZONEID) && defined(SHMPERM_ZONEID)
|
||||
if ( ((lcc->fieldsSet & LCC_ZID_SET) == 0) || (lcc->zoneid == -1)
|
||||
|| (lcc->zoneid != SHMPERM_ZONEID(perm))) {
|
||||
uidset = 0;
|
||||
gidset = 0;
|
||||
}
|
||||
#endif
|
||||
FreeLocalClientCreds(lcc);
|
||||
|
||||
/* User id 0 always gets access */
|
||||
if (uid == 0) {
|
||||
return 0;
|
||||
}
|
||||
/* Check the owner */
|
||||
if (perm->uid == uid || perm->cuid == uid) {
|
||||
mask = S_IRUSR;
|
||||
if (!readonly) {
|
||||
mask |= S_IWUSR;
|
||||
if (uidset) {
|
||||
/* User id 0 always gets access */
|
||||
if (uid == 0) {
|
||||
return 0;
|
||||
}
|
||||
return (perm->mode & mask) == mask ? 0 : -1;
|
||||
}
|
||||
/* Check the group */
|
||||
if (perm->gid == gid || perm->cgid == gid) {
|
||||
mask = S_IRGRP;
|
||||
if (!readonly) {
|
||||
mask |= S_IWGRP;
|
||||
/* Check the owner */
|
||||
if (SHMPERM_UID(perm) == uid || SHMPERM_CUID(perm) == uid) {
|
||||
mask = S_IRUSR;
|
||||
if (!readonly) {
|
||||
mask |= S_IWUSR;
|
||||
}
|
||||
return (SHMPERM_MODE(perm) & mask) == mask ? 0 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (gidset) {
|
||||
/* Check the group */
|
||||
if (SHMPERM_GID(perm) == gid || SHMPERM_CGID(perm) == gid) {
|
||||
mask = S_IRGRP;
|
||||
if (!readonly) {
|
||||
mask |= S_IWGRP;
|
||||
}
|
||||
return (SHMPERM_MODE(perm) & mask) == mask ? 0 : -1;
|
||||
}
|
||||
return (perm->mode & mask) == mask ? 0 : -1;
|
||||
}
|
||||
}
|
||||
/* Otherwise, check everyone else */
|
||||
|
|
@ -381,14 +433,14 @@ shm_access(ClientPtr client, struct ipc_perm *perm, int readonly)
|
|||
if (!readonly) {
|
||||
mask |= S_IWOTH;
|
||||
}
|
||||
return (perm->mode & mask) == mask ? 0 : -1;
|
||||
return (SHMPERM_MODE(perm) & mask) == mask ? 0 : -1;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcShmAttach(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
struct shmid_ds buf;
|
||||
SHMSTAT_TYPE buf;
|
||||
ShmDescPtr shmdesc;
|
||||
REQUEST(xShmAttachReq);
|
||||
|
||||
|
|
@ -417,7 +469,7 @@ ProcShmAttach(client)
|
|||
shmdesc->addr = shmat(stuff->shmid, 0,
|
||||
stuff->readOnly ? SHM_RDONLY : 0);
|
||||
if ((shmdesc->addr == ((char *)-1)) ||
|
||||
shmctl(stuff->shmid, IPC_STAT, &buf))
|
||||
SHMSTAT(stuff->shmid, &buf))
|
||||
{
|
||||
xfree(shmdesc);
|
||||
return BadAccess;
|
||||
|
|
@ -427,7 +479,7 @@ ProcShmAttach(client)
|
|||
* do manual checking of access rights for the credentials
|
||||
* of the client */
|
||||
|
||||
if (shm_access(client, &(buf.shm_perm), stuff->readOnly) == -1) {
|
||||
if (shm_access(client, &(SHM_PERM(buf)), stuff->readOnly) == -1) {
|
||||
shmdt(shmdesc->addr);
|
||||
xfree(shmdesc);
|
||||
return BadAccess;
|
||||
|
|
@ -436,7 +488,7 @@ ProcShmAttach(client)
|
|||
shmdesc->shmid = stuff->shmid;
|
||||
shmdesc->refcnt = 1;
|
||||
shmdesc->writable = !stuff->readOnly;
|
||||
shmdesc->size = buf.shm_segsz;
|
||||
shmdesc->size = SHM_SEGSZ(buf);
|
||||
shmdesc->next = Shmsegs;
|
||||
Shmsegs = shmdesc;
|
||||
}
|
||||
|
|
|
|||
12
Xi/allowev.c
12
Xi/allowev.c
|
|
@ -56,13 +56,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -103,10 +100,8 @@ ProcXAllowDeviceEvents(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
|
||||
|
||||
thisdev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (thisdev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (thisdev == NULL)
|
||||
return BadDevice;
|
||||
time = ClientTimeToServerTime(stuff->time);
|
||||
|
||||
switch (stuff->mode) {
|
||||
|
|
@ -129,9 +124,8 @@ ProcXAllowDeviceEvents(ClientPtr client)
|
|||
AllowSome(client, time, thisdev, THAWED_BOTH);
|
||||
break;
|
||||
default:
|
||||
SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadValue);
|
||||
client->errorValue = stuff->mode;
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
|
|
|||
15
Xi/chgdctl.c
15
Xi/chgdctl.c
|
|
@ -56,14 +56,11 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h> /* control constants */
|
||||
#include "XIstubs.h"
|
||||
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
#include "exevents.h"
|
||||
|
|
@ -153,11 +150,8 @@ ProcXChangeDeviceControl(ClientPtr client)
|
|||
a = &dev->valuator->axes[r->first_valuator];
|
||||
for (i = 0; i < r->num_valuators; i++)
|
||||
if (*(resolution + i) < (a + i)->min_resolution ||
|
||||
*(resolution + i) > (a + i)->max_resolution) {
|
||||
SendErrorToClient(client, IReqCode,
|
||||
X_ChangeDeviceControl, 0, BadValue);
|
||||
return Success;
|
||||
}
|
||||
*(resolution + i) > (a + i)->max_resolution)
|
||||
return BadValue;
|
||||
for (i = 0; i < r->num_valuators; i++)
|
||||
(a++)->resolution = *resolution++;
|
||||
|
||||
|
|
@ -269,11 +263,8 @@ out:
|
|||
|
||||
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
|
||||
}
|
||||
else {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, ret);
|
||||
}
|
||||
|
||||
return Success;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
|||
179
Xi/chgfctl.c
179
Xi/chgfctl.c
|
|
@ -56,13 +56,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h> /* control constants */
|
||||
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -119,9 +116,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
t = defaultKeyboardControl.click;
|
||||
else if (t < 0 || t > 100) {
|
||||
client->errorValue = t;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
kctrl.click = t;
|
||||
}
|
||||
|
|
@ -132,9 +127,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
t = defaultKeyboardControl.bell;
|
||||
else if (t < 0 || t > 100) {
|
||||
client->errorValue = t;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
kctrl.bell = t;
|
||||
}
|
||||
|
|
@ -145,9 +138,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
t = defaultKeyboardControl.bell_pitch;
|
||||
else if (t < 0) {
|
||||
client->errorValue = t;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
kctrl.bell_pitch = t;
|
||||
}
|
||||
|
|
@ -158,9 +149,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
t = defaultKeyboardControl.bell_duration;
|
||||
else if (t < 0) {
|
||||
client->errorValue = t;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
kctrl.bell_duration = t;
|
||||
}
|
||||
|
|
@ -174,15 +163,10 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
key = (KeyCode) f->key;
|
||||
if (key < 8 || key > 255) {
|
||||
client->errorValue = key;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
if (!(mask & DvAutoRepeatMode)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
if (!(mask & DvAutoRepeatMode))
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
if (mask & DvAutoRepeatMode) {
|
||||
|
|
@ -210,9 +194,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
(defaultKeyboardControl.autoRepeats[inx] & kmask);
|
||||
} else {
|
||||
client->errorValue = t;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -250,9 +232,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
pctrl.num = defaultPointerControl.num;
|
||||
else if (accelNum < 0) {
|
||||
client->errorValue = accelNum;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
} else
|
||||
pctrl.num = accelNum;
|
||||
}
|
||||
|
|
@ -265,9 +245,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
pctrl.den = defaultPointerControl.den;
|
||||
else if (accelDenom <= 0) {
|
||||
client->errorValue = accelDenom;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
} else
|
||||
pctrl.den = accelDenom;
|
||||
}
|
||||
|
|
@ -280,9 +258,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
pctrl.threshold = defaultPointerControl.threshold;
|
||||
else if (threshold < 0) {
|
||||
client->errorValue = threshold;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
} else
|
||||
pctrl.threshold = threshold;
|
||||
}
|
||||
|
|
@ -341,21 +317,16 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
|
|||
}
|
||||
}
|
||||
|
||||
if (f->num_keysyms > s->ctrl.max_symbols) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
if (f->num_keysyms > s->ctrl.max_symbols)
|
||||
return BadValue;
|
||||
|
||||
sup_syms = s->ctrl.symbols_supported;
|
||||
for (i = 0; i < f->num_keysyms; i++) {
|
||||
for (j = 0; j < s->ctrl.num_symbols_supported; j++)
|
||||
if (*(syms + i) == *(sup_syms + j))
|
||||
break;
|
||||
if (j == s->ctrl.num_symbols_supported) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (j == s->ctrl.num_symbols_supported)
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
s->ctrl.num_symbols_displayed = f->num_keysyms;
|
||||
|
|
@ -393,9 +364,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
|
|||
t = defaultKeyboardControl.bell;
|
||||
else if (t < 0 || t > 100) {
|
||||
client->errorValue = t;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
bctrl.percent = t;
|
||||
}
|
||||
|
|
@ -406,9 +375,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
|
|||
t = defaultKeyboardControl.bell_pitch;
|
||||
else if (t < 0) {
|
||||
client->errorValue = t;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
bctrl.pitch = t;
|
||||
}
|
||||
|
|
@ -419,9 +386,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
|
|||
t = defaultKeyboardControl.bell_duration;
|
||||
else if (t < 0) {
|
||||
client->errorValue = t;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
bctrl.duration = t;
|
||||
}
|
||||
|
|
@ -485,38 +450,27 @@ ProcXChangeFeedbackControl(ClientPtr client)
|
|||
|
||||
len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2);
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
|
||||
switch (stuff->feedbackid) {
|
||||
case KbdFeedbackClass:
|
||||
if (len != (sizeof(xKbdFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
if (len != (sizeof(xKbdFeedbackCtl) >> 2))
|
||||
return BadLength;
|
||||
|
||||
for (k = dev->kbdfeed; k; k = k->next)
|
||||
if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeKbdFeedback(client, dev, stuff->mask, k,
|
||||
(xKbdFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id)
|
||||
return ChangeKbdFeedback(client, dev, stuff->mask, k,
|
||||
(xKbdFeedbackCtl *) & stuff[1]);
|
||||
break;
|
||||
case PtrFeedbackClass:
|
||||
if (len != (sizeof(xPtrFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
if (len != (sizeof(xPtrFeedbackCtl) >> 2))
|
||||
return BadLength;
|
||||
|
||||
for (p = dev->ptrfeed; p; p = p->next)
|
||||
if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangePtrFeedback(client, dev, stuff->mask, p,
|
||||
(xPtrFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id)
|
||||
return ChangePtrFeedback(client, dev, stuff->mask, p,
|
||||
(xPtrFeedbackCtl *) & stuff[1]);
|
||||
break;
|
||||
case StringFeedbackClass:
|
||||
{
|
||||
|
|
@ -526,63 +480,46 @@ ProcXChangeFeedbackControl(ClientPtr client)
|
|||
if (client->swapped) {
|
||||
swaps(&f->num_keysyms, n);
|
||||
}
|
||||
if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms))
|
||||
return BadLength;
|
||||
|
||||
for (s = dev->stringfeed; s; s = s->next)
|
||||
if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeStringFeedback(client, dev, stuff->mask, s,
|
||||
(xStringFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id)
|
||||
return ChangeStringFeedback(client, dev, stuff->mask, s,
|
||||
(xStringFeedbackCtl *) & stuff[1]);
|
||||
break;
|
||||
}
|
||||
case IntegerFeedbackClass:
|
||||
if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
if (len != (sizeof(xIntegerFeedbackCtl) >> 2))
|
||||
return BadLength;
|
||||
|
||||
for (i = dev->intfeed; i; i = i->next)
|
||||
if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeIntegerFeedback(client, dev, stuff->mask, i,
|
||||
(xIntegerFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id)
|
||||
return ChangeIntegerFeedback(client, dev, stuff->mask, i,
|
||||
(xIntegerFeedbackCtl *)&stuff[1]);
|
||||
break;
|
||||
case LedFeedbackClass:
|
||||
if (len != (sizeof(xLedFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
if (len != (sizeof(xLedFeedbackCtl) >> 2))
|
||||
return BadLength;
|
||||
|
||||
for (l = dev->leds; l; l = l->next)
|
||||
if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeLedFeedback(client, dev, stuff->mask, l,
|
||||
(xLedFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id)
|
||||
return ChangeLedFeedback(client, dev, stuff->mask, l,
|
||||
(xLedFeedbackCtl *) & stuff[1]);
|
||||
break;
|
||||
case BellFeedbackClass:
|
||||
if (len != (sizeof(xBellFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
if (len != (sizeof(xBellFeedbackCtl) >> 2))
|
||||
return BadLength;
|
||||
|
||||
for (b = dev->bell; b; b = b->next)
|
||||
if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeBellFeedback(client, dev, stuff->mask, b,
|
||||
(xBellFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id)
|
||||
return ChangeBellFeedback(client, dev, stuff->mask, b,
|
||||
(xBellFeedbackCtl *) & stuff[1]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
|
||||
return Success;
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,14 +56,11 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "XIstubs.h"
|
||||
#include "globals.h"
|
||||
#include "extnsionst.h"
|
||||
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
|
@ -98,10 +95,8 @@ SProcXChangeKeyboardDevice(ClientPtr client)
|
|||
int
|
||||
ProcXChangeKeyboardDevice(ClientPtr client)
|
||||
{
|
||||
REQUEST(xChangeKeyboardDeviceReq);
|
||||
/* REQUEST(xChangeKeyboardDeviceReq); */
|
||||
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
|
||||
|
||||
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
return BadDevice;
|
||||
}
|
||||
|
|
|
|||
14
Xi/chgkmap.c
14
Xi/chgkmap.c
|
|
@ -56,12 +56,9 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
|
@ -111,18 +108,13 @@ ProcXChangeDeviceKeyMapping(ClientPtr client)
|
|||
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2);
|
||||
|
||||
ret = ChangeKeyMapping(client, dev, len, DeviceMappingNotify,
|
||||
stuff->firstKeyCode, stuff->keyCodes,
|
||||
stuff->keySymsPerKeyCode, (KeySym *) & stuff[1]);
|
||||
|
||||
if (ret != Success)
|
||||
SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0, ret);
|
||||
return Success;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
36
Xi/chgprop.c
36
Xi/chgprop.c
|
|
@ -56,13 +56,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h"
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
|
||||
#include "exevents.h"
|
||||
|
|
@ -115,30 +112,22 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
|
|||
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
|
||||
|
||||
if (stuff->length != (sizeof(xChangeDeviceDontPropagateListReq) >> 2) +
|
||||
stuff->count) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
|
||||
BadLength);
|
||||
return Success;
|
||||
}
|
||||
stuff->count)
|
||||
return BadLength;
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
|
||||
if (rc != Success) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
|
||||
rc);
|
||||
return Success;
|
||||
}
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if (stuff->mode != AddToList && stuff->mode != DeleteFromList) {
|
||||
client->errorValue = stuff->window;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
|
||||
BadMode);
|
||||
return Success;
|
||||
return BadMode;
|
||||
}
|
||||
|
||||
if (CreateMaskFromList(client, (XEventClass *) & stuff[1],
|
||||
stuff->count, tmp, NULL,
|
||||
X_ChangeDeviceDontPropagateList) != Success)
|
||||
return Success;
|
||||
if ((rc = CreateMaskFromList(client, (XEventClass *) & stuff[1],
|
||||
stuff->count, tmp, NULL,
|
||||
X_ChangeDeviceDontPropagateList)) != Success)
|
||||
return rc;
|
||||
|
||||
others = wOtherInputMasks(pWin);
|
||||
if (!others && stuff->mode == DeleteFromList)
|
||||
|
|
@ -153,11 +142,8 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
|
|||
tmp[i].mask |= others->dontPropagateMask[i];
|
||||
|
||||
if (DeviceEventSuppressForWindow(pWin, client, tmp[i].mask, i) !=
|
||||
Success) {
|
||||
SendErrorToClient(client, IReqCode,
|
||||
X_ChangeDeviceDontPropagateList, 0, BadClass);
|
||||
return Success;
|
||||
}
|
||||
Success)
|
||||
return BadClass;
|
||||
}
|
||||
|
||||
return Success;
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
|
@ -65,7 +63,6 @@ SOFTWARE.
|
|||
#include "windowstr.h" /* window structure */
|
||||
#include "scrnintstr.h" /* screen structure */
|
||||
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
|
||||
#include "dixevents.h"
|
||||
|
|
@ -101,10 +98,8 @@ SProcXChangePointerDevice(ClientPtr client)
|
|||
int
|
||||
ProcXChangePointerDevice(ClientPtr client)
|
||||
{
|
||||
REQUEST(xChangePointerDeviceReq);
|
||||
/* REQUEST(xChangePointerDeviceReq); */
|
||||
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
|
||||
|
||||
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
return BadDevice;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,15 +56,12 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "scrnintstr.h" /* screen structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "XIstubs.h"
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -151,10 +148,8 @@ ProcXCloseDevice(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xCloseDeviceReq);
|
||||
|
||||
d = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (d == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (d == NULL)
|
||||
return BadDevice;
|
||||
|
||||
if (d->grab && SameClient(d->grab, client))
|
||||
(*d->DeactivateGrab) (d); /* release active grab */
|
||||
|
|
|
|||
18
Xi/devbell.c
18
Xi/devbell.c
|
|
@ -56,12 +56,9 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -108,14 +105,12 @@ ProcXDeviceBell(ClientPtr client)
|
|||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
client->errorValue = stuff->deviceid;
|
||||
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadDevice);
|
||||
return Success;
|
||||
return BadDevice;
|
||||
}
|
||||
|
||||
if (stuff->percent < -100 || stuff->percent > 100) {
|
||||
client->errorValue = stuff->percent;
|
||||
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
if (stuff->feedbackclass == KbdFeedbackClass) {
|
||||
for (k = dev->kbdfeed; k; k = k->next)
|
||||
|
|
@ -123,8 +118,7 @@ ProcXDeviceBell(ClientPtr client)
|
|||
break;
|
||||
if (!k) {
|
||||
client->errorValue = stuff->feedbackid;
|
||||
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
base = k->ctrl.bell;
|
||||
proc = k->BellProc;
|
||||
|
|
@ -136,8 +130,7 @@ ProcXDeviceBell(ClientPtr client)
|
|||
break;
|
||||
if (!b) {
|
||||
client->errorValue = stuff->feedbackid;
|
||||
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
base = b->ctrl.percent;
|
||||
proc = b->BellProc;
|
||||
|
|
@ -145,8 +138,7 @@ ProcXDeviceBell(ClientPtr client)
|
|||
class = BellFeedbackClass;
|
||||
} else {
|
||||
client->errorValue = stuff->feedbackclass;
|
||||
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
newpercent = (base * stuff->percent) / 100;
|
||||
if (stuff->percent < 0)
|
||||
|
|
|
|||
|
|
@ -73,6 +73,10 @@ SOFTWARE.
|
|||
#include "dixgrabs.h" /* CreateGrab() */
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#ifdef XKB
|
||||
#include "xkbsrv.h"
|
||||
#endif
|
||||
|
||||
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
|
||||
#define AllModifiersMask ( \
|
||||
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
|
||||
|
|
@ -942,7 +946,7 @@ SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen,
|
|||
}
|
||||
|
||||
void
|
||||
SendDeviceMappingNotify(CARD8 request,
|
||||
SendDeviceMappingNotify(ClientPtr client, CARD8 request,
|
||||
KeyCode firstKeyCode, CARD8 count, DeviceIntPtr dev)
|
||||
{
|
||||
xEvent event;
|
||||
|
|
@ -957,6 +961,11 @@ SendDeviceMappingNotify(CARD8 request,
|
|||
ev->count = count;
|
||||
}
|
||||
|
||||
#ifdef XKB
|
||||
if (request == MappingKeyboard || request == MappingModifier)
|
||||
XkbApplyMappingChange(dev, request, firstKeyCode, count, client);
|
||||
#endif
|
||||
|
||||
SendEventToAllWindows(dev, DeviceMappingNotifyMask, (xEvent *) ev, 1);
|
||||
}
|
||||
|
||||
|
|
@ -992,7 +1001,7 @@ ChangeKeyMapping(ClientPtr client,
|
|||
keysyms.map = map;
|
||||
if (!SetKeySymsMap(&k->curKeySyms, &keysyms))
|
||||
return BadAlloc;
|
||||
SendDeviceMappingNotify(MappingKeyboard, firstKeyCode, keyCodes, dev);
|
||||
SendDeviceMappingNotify(client, MappingKeyboard, firstKeyCode, keyCodes, dev);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
|
|
|
|||
13
Xi/extinit.c
13
Xi/extinit.c
|
|
@ -58,8 +58,6 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "inputstr.h"
|
||||
#include "gcstruct.h" /* pointer for extnsionst.h */
|
||||
#include "extnsionst.h" /* extension entry */
|
||||
|
|
@ -289,9 +287,7 @@ ProcIDispatch(ClientPtr client)
|
|||
return (ProcXGetDeviceControl(client));
|
||||
else if (stuff->data == X_ChangeDeviceControl)
|
||||
return (ProcXChangeDeviceControl(client));
|
||||
else {
|
||||
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
|
||||
}
|
||||
|
||||
return (BadRequest);
|
||||
}
|
||||
|
||||
|
|
@ -378,9 +374,7 @@ SProcIDispatch(ClientPtr client)
|
|||
return (SProcXGetDeviceControl(client));
|
||||
else if (stuff->data == X_ChangeDeviceControl)
|
||||
return (SProcXChangeDeviceControl(client));
|
||||
else {
|
||||
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
|
||||
}
|
||||
|
||||
return (BadRequest);
|
||||
}
|
||||
|
||||
|
|
@ -935,6 +929,8 @@ SEventIDispatch(xEvent * from, xEvent * to)
|
|||
DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
|
||||
else if (type == ChangeDeviceNotify)
|
||||
DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
|
||||
else if (type == DevicePresenceNotify)
|
||||
DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify);
|
||||
else {
|
||||
FatalError("XInputExtension: Impossible event!\n");
|
||||
}
|
||||
|
|
@ -980,6 +976,7 @@ XInputExtensionInit(void)
|
|||
EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
|
||||
EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
|
||||
EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
|
||||
} else {
|
||||
FatalError("IExtensionInit: AddExtensions failed\n");
|
||||
}
|
||||
|
|
|
|||
18
Xi/getbmap.c
18
Xi/getbmap.c
|
|
@ -56,12 +56,9 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -106,18 +103,13 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
|
|||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
|
||||
b = dev->button;
|
||||
if (b == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (b == NULL)
|
||||
return BadMatch;
|
||||
|
||||
rep.nElts = b->numButtons;
|
||||
rep.length = (rep.nElts + (4 - 1)) / 4;
|
||||
WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
|
||||
|
|
|
|||
39
Xi/getdctl.c
39
Xi/getdctl.c
|
|
@ -56,12 +56,9 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -250,10 +247,8 @@ ProcXGetDeviceControl(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetDeviceControl;
|
||||
|
|
@ -262,29 +257,20 @@ ProcXGetDeviceControl(ClientPtr client)
|
|||
|
||||
switch (stuff->control) {
|
||||
case DEVICE_RESOLUTION:
|
||||
if (!dev->valuator) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (!dev->valuator)
|
||||
return BadMatch;
|
||||
total_length = sizeof(xDeviceResolutionState) +
|
||||
(3 * sizeof(int) * dev->valuator->numAxes);
|
||||
break;
|
||||
case DEVICE_ABS_CALIB:
|
||||
if (!dev->absolute) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (!dev->absolute)
|
||||
return BadMatch;
|
||||
|
||||
total_length = sizeof(xDeviceAbsCalibCtl);
|
||||
break;
|
||||
case DEVICE_ABS_AREA:
|
||||
if (!dev->absolute) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (!dev->absolute)
|
||||
return BadMatch;
|
||||
|
||||
total_length = sizeof(xDeviceAbsAreaCtl);
|
||||
break;
|
||||
|
|
@ -295,15 +281,12 @@ ProcXGetDeviceControl(ClientPtr client)
|
|||
total_length = sizeof(xDeviceEnableCtl);
|
||||
break;
|
||||
default:
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
buf = (char *)xalloc(total_length);
|
||||
if (!buf) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadAlloc);
|
||||
return Success;
|
||||
}
|
||||
if (!buf)
|
||||
return BadAlloc;
|
||||
savbuf = buf;
|
||||
|
||||
switch (stuff->control) {
|
||||
|
|
|
|||
21
Xi/getfctl.c
21
Xi/getfctl.c
|
|
@ -56,12 +56,9 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -308,10 +305,8 @@ ProcXGetFeedbackControl(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetFeedbackControl;
|
||||
|
|
@ -345,16 +340,12 @@ ProcXGetFeedbackControl(ClientPtr client)
|
|||
total_length += sizeof(xBellFeedbackState);
|
||||
}
|
||||
|
||||
if (total_length == 0) {
|
||||
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (total_length == 0)
|
||||
return BadMatch;
|
||||
|
||||
buf = (char *)xalloc(total_length);
|
||||
if (!buf) {
|
||||
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadAlloc);
|
||||
return Success;
|
||||
}
|
||||
if (!buf)
|
||||
return BadAlloc;
|
||||
savbuf = buf;
|
||||
|
||||
for (k = dev->kbdfeed; k; k = k->next)
|
||||
|
|
|
|||
|
|
@ -56,13 +56,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "windowstr.h" /* focus struct */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -101,10 +98,8 @@ ProcXGetDeviceFocus(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xGetDeviceFocusReq);
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL || !dev->focus) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceFocus, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL || !dev->focus)
|
||||
return BadDevice;
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetDeviceFocus;
|
||||
|
|
|
|||
23
Xi/getkmap.c
23
Xi/getkmap.c
|
|
@ -56,12 +56,9 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
#include "swaprep.h"
|
||||
|
|
@ -102,29 +99,21 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq);
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (dev->key == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
if (dev->key == NULL)
|
||||
return BadMatch;
|
||||
k = &dev->key->curKeySyms;
|
||||
|
||||
if ((stuff->firstKeyCode < k->minKeyCode) ||
|
||||
(stuff->firstKeyCode > k->maxKeyCode)) {
|
||||
client->errorValue = stuff->firstKeyCode;
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1) {
|
||||
client->errorValue = stuff->count;
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue);
|
||||
return Success;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
rep.repType = X_Reply;
|
||||
|
|
|
|||
18
Xi/getmmap.c
18
Xi/getmmap.c
|
|
@ -56,12 +56,9 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h> /* Request macro */
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -102,18 +99,13 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq);
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
|
||||
kp = dev->key;
|
||||
if (kp == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (kp == NULL)
|
||||
return BadMatch;
|
||||
|
||||
maxkeys = kp->maxKeysPerModifier;
|
||||
|
||||
rep.repType = X_Reply;
|
||||
|
|
|
|||
10
Xi/getprop.c
10
Xi/getprop.c
|
|
@ -56,13 +56,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structs */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
#include "swaprep.h"
|
||||
|
|
@ -116,11 +113,8 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
|
|||
rep.count = 0;
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
|
||||
if (rc != Success) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0,
|
||||
rc);
|
||||
return Success;
|
||||
}
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if ((others = wOtherInputMasks(pWin)) != 0) {
|
||||
for (i = 0; i < EMASKSIZE; i++)
|
||||
|
|
|
|||
|
|
@ -56,13 +56,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window struct */
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
#include "swaprep.h"
|
||||
|
|
@ -118,11 +115,8 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
|
|||
rep.all_clients_count = 0;
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
|
||||
if (rc != Success) {
|
||||
SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0,
|
||||
rc);
|
||||
return Success;
|
||||
}
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if ((pOthers = wOtherInputMasks(pWin)) != 0) {
|
||||
for (others = pOthers->inputClients; others; others = others->next)
|
||||
|
|
|
|||
10
Xi/getvers.c
10
Xi/getvers.c
|
|
@ -56,12 +56,9 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -102,11 +99,8 @@ ProcXGetExtensionVersion(ClientPtr client)
|
|||
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
|
||||
|
||||
if (stuff->length != (sizeof(xGetExtensionVersionReq) +
|
||||
stuff->nbytes + 3) >> 2) {
|
||||
SendErrorToClient(client, IReqCode, X_GetExtensionVersion, 0,
|
||||
BadLength);
|
||||
return Success;
|
||||
}
|
||||
stuff->nbytes + 3) >> 2)
|
||||
return BadLength;
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetExtensionVersion;
|
||||
|
|
|
|||
49
Xi/grabdev.c
49
Xi/grabdev.c
|
|
@ -56,13 +56,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
#include "dixevents.h" /* GrabDevice */
|
||||
|
|
@ -109,7 +106,7 @@ SProcXGrabDevice(ClientPtr client)
|
|||
int
|
||||
ProcXGrabDevice(ClientPtr client)
|
||||
{
|
||||
int error;
|
||||
int rc;
|
||||
xGrabDeviceReply rep;
|
||||
DeviceIntPtr dev;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
|
|
@ -117,10 +114,8 @@ ProcXGrabDevice(ClientPtr client)
|
|||
REQUEST(xGrabDeviceReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
|
||||
|
||||
if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count) {
|
||||
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count)
|
||||
return BadLength;
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GrabDevice;
|
||||
|
|
@ -128,25 +123,22 @@ ProcXGrabDevice(ClientPtr client)
|
|||
rep.length = 0;
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
|
||||
if (CreateMaskFromList(client, (XEventClass *) & stuff[1],
|
||||
stuff->event_count, tmp, dev,
|
||||
X_GrabDevice) != Success)
|
||||
return Success;
|
||||
if ((rc = CreateMaskFromList(client, (XEventClass *) & stuff[1],
|
||||
stuff->event_count, tmp, dev,
|
||||
X_GrabDevice)) != Success)
|
||||
return rc;
|
||||
|
||||
error = GrabDevice(client, dev, stuff->this_device_mode,
|
||||
stuff->other_devices_mode, stuff->grabWindow,
|
||||
stuff->ownerEvents, stuff->time,
|
||||
tmp[stuff->deviceid].mask, &rep.status);
|
||||
rc = GrabDevice(client, dev, stuff->this_device_mode,
|
||||
stuff->other_devices_mode, stuff->grabWindow,
|
||||
stuff->ownerEvents, stuff->time,
|
||||
tmp[stuff->deviceid].mask, &rep.status);
|
||||
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if (error != Success) {
|
||||
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error);
|
||||
return Success;
|
||||
}
|
||||
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -172,15 +164,12 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
|
|||
|
||||
for (i = 0; i < count; i++, list++) {
|
||||
device = *list >> 8;
|
||||
if (device > 255) {
|
||||
SendErrorToClient(client, IReqCode, req, 0, BadClass);
|
||||
if (device > 255)
|
||||
return BadClass;
|
||||
}
|
||||
|
||||
tdev = LookupDeviceIntRec(device);
|
||||
if (tdev == NULL || (dev != NULL && tdev != dev)) {
|
||||
SendErrorToClient(client, IReqCode, req, 0, BadClass);
|
||||
if (tdev == NULL || (dev != NULL && tdev != dev))
|
||||
return BadClass;
|
||||
}
|
||||
|
||||
for (j = 0; j < ExtEventIndex; j++)
|
||||
if (EventInfo[j].type == (*list & 0xff)) {
|
||||
|
|
|
|||
|
|
@ -56,14 +56,11 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -117,28 +114,19 @@ ProcXGrabDeviceButton(ClientPtr client)
|
|||
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
|
||||
|
||||
if (stuff->length !=
|
||||
(sizeof(xGrabDeviceButtonReq) >> 2) + stuff->event_count) {
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
(sizeof(xGrabDeviceButtonReq) >> 2) + stuff->event_count)
|
||||
return BadLength;
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->grabbed_device);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
|
||||
if (stuff->modifier_device != UseXKeyboard) {
|
||||
mdev = LookupDeviceIntRec(stuff->modifier_device);
|
||||
if (mdev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (mdev->key == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (mdev == NULL)
|
||||
return BadDevice;
|
||||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else
|
||||
mdev = (DeviceIntPtr) LookupKeyboardDevice();
|
||||
|
||||
|
|
@ -147,13 +135,11 @@ ProcXGrabDeviceButton(ClientPtr client)
|
|||
if ((ret = CreateMaskFromList(client, class,
|
||||
stuff->event_count, tmp, dev,
|
||||
X_GrabDeviceButton)) != Success)
|
||||
return Success;
|
||||
return ret;
|
||||
ret = GrabButton(client, dev, stuff->this_device_mode,
|
||||
stuff->other_devices_mode, stuff->modifiers, mdev,
|
||||
stuff->button, stuff->grabWindow, stuff->ownerEvents,
|
||||
(Cursor) 0, (Window) 0, tmp[stuff->grabbed_device].mask);
|
||||
|
||||
if (ret != Success)
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, ret);
|
||||
return (Success);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,14 +56,11 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -115,27 +112,19 @@ ProcXGrabDeviceKey(ClientPtr client)
|
|||
REQUEST(xGrabDeviceKeyReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
|
||||
|
||||
if (stuff->length != (sizeof(xGrabDeviceKeyReq) >> 2) + stuff->event_count) {
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
if (stuff->length != (sizeof(xGrabDeviceKeyReq) >> 2) + stuff->event_count)
|
||||
return BadLength;
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->grabbed_device);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
|
||||
if (stuff->modifier_device != UseXKeyboard) {
|
||||
mdev = LookupDeviceIntRec(stuff->modifier_device);
|
||||
if (mdev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (mdev->key == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (mdev == NULL)
|
||||
return BadDevice;
|
||||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else
|
||||
mdev = (DeviceIntPtr) LookupKeyboardDevice();
|
||||
|
||||
|
|
@ -144,17 +133,12 @@ ProcXGrabDeviceKey(ClientPtr client)
|
|||
if ((ret = CreateMaskFromList(client, class,
|
||||
stuff->event_count, tmp, dev,
|
||||
X_GrabDeviceKey)) != Success)
|
||||
return Success;
|
||||
return ret;
|
||||
|
||||
ret = GrabKey(client, dev, stuff->this_device_mode,
|
||||
stuff->other_devices_mode, stuff->modifiers, mdev,
|
||||
stuff->key, stuff->grabWindow, stuff->ownerEvents,
|
||||
tmp[stuff->grabbed_device].mask);
|
||||
|
||||
if (ret != Success) {
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, ret);
|
||||
return Success;
|
||||
}
|
||||
|
||||
return Success;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,12 +56,9 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
|
@ -110,17 +107,11 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
v = dev->valuator;
|
||||
if (v == NULL || v->numAxes == 0) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (v == NULL || v->numAxes == 0)
|
||||
return BadMatch;
|
||||
if (dev->valuator->motionHintWindow)
|
||||
MaybeStopDeviceHint(dev, client);
|
||||
axes = v->numAxes;
|
||||
|
|
@ -145,11 +136,8 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
|
|||
size = sizeof(Time) + (axes * sizeof(INT32));
|
||||
tsize = num_events * size;
|
||||
coords = (INT32 *) ALLOCATE_LOCAL(tsize);
|
||||
if (!coords) {
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
|
||||
BadAlloc);
|
||||
return Success;
|
||||
}
|
||||
if (!coords)
|
||||
return BadAlloc;
|
||||
rep.nEvents = (v->GetMotionProc) (dev, (xTimecoord *) coords, /* XXX */
|
||||
start.milliseconds, stop.milliseconds,
|
||||
(ScreenPtr) NULL);
|
||||
|
|
|
|||
21
Xi/opendev.c
21
Xi/opendev.c
|
|
@ -56,14 +56,11 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "XIstubs.h"
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -107,26 +104,20 @@ ProcXOpenDevice(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xOpenDeviceReq);
|
||||
|
||||
if (stuff->deviceid == inputInfo.pointer->id ||
|
||||
stuff->deviceid == inputInfo.keyboard->id) {
|
||||
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
stuff->deviceid == inputInfo.keyboard->id)
|
||||
return BadDevice;
|
||||
|
||||
if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) { /* not open */
|
||||
for (dev = inputInfo.off_devices; dev; dev = dev->next)
|
||||
if (dev->id == stuff->deviceid)
|
||||
break;
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
}
|
||||
|
||||
OpenInputDevice(dev, client, &status);
|
||||
if (status != Success) {
|
||||
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, status);
|
||||
return Success;
|
||||
}
|
||||
if (status != Success)
|
||||
return status;
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_OpenDevice;
|
||||
|
|
|
|||
15
Xi/queryst.c
15
Xi/queryst.c
|
|
@ -38,13 +38,10 @@ from The Open Group.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
|
@ -100,10 +97,8 @@ ProcXQueryDeviceState(ClientPtr client)
|
|||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
|
||||
v = dev->valuator;
|
||||
if (v != NULL && v->motionHintWindow != NULL)
|
||||
|
|
@ -126,10 +121,8 @@ ProcXQueryDeviceState(ClientPtr client)
|
|||
num_classes++;
|
||||
}
|
||||
buf = (char *)xalloc(total_length);
|
||||
if (!buf) {
|
||||
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadAlloc);
|
||||
return Success;
|
||||
}
|
||||
if (!buf)
|
||||
return BadAlloc;
|
||||
savbuf = buf;
|
||||
|
||||
if (k != NULL) {
|
||||
|
|
|
|||
|
|
@ -57,13 +57,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
|
@ -164,40 +161,29 @@ ProcXSelectExtensionEvent(ClientPtr client)
|
|||
REQUEST(xSelectExtensionEventReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
|
||||
|
||||
if (stuff->length != (sizeof(xSelectExtensionEventReq) >> 2) + stuff->count) {
|
||||
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
|
||||
BadLength);
|
||||
return Success;
|
||||
}
|
||||
if (stuff->length != (sizeof(xSelectExtensionEventReq) >> 2) + stuff->count)
|
||||
return BadLength;
|
||||
|
||||
ret = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
|
||||
if (ret != Success) {
|
||||
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, ret);
|
||||
return Success;
|
||||
}
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
|
||||
if (HandleDevicePresenceMask(client, pWin, (XEventClass *) & stuff[1],
|
||||
&stuff->count) != Success) {
|
||||
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
|
||||
BadAlloc);
|
||||
return Success;
|
||||
}
|
||||
&stuff->count) != Success)
|
||||
return BadAlloc;
|
||||
|
||||
if ((ret = CreateMaskFromList(client, (XEventClass *) & stuff[1],
|
||||
stuff->count, tmp, NULL,
|
||||
X_SelectExtensionEvent)) != Success)
|
||||
return Success;
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < EMASKSIZE; i++)
|
||||
if (tmp[i].dev != NULL) {
|
||||
if ((ret =
|
||||
SelectForWindow((DeviceIntPtr) tmp[i].dev, pWin, client,
|
||||
tmp[i].mask, ExtExclusiveMasks[i],
|
||||
ExtValidMasks[i])) != Success) {
|
||||
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
|
||||
ret);
|
||||
return Success;
|
||||
}
|
||||
ExtValidMasks[i])) != Success)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return Success;
|
||||
|
|
|
|||
|
|
@ -57,13 +57,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* Window */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
|
@ -131,38 +128,29 @@ ProcXSendExtensionEvent(ClientPtr client)
|
|||
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
|
||||
|
||||
if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count +
|
||||
(stuff->num_events * (sizeof(xEvent) >> 2))) {
|
||||
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
(stuff->num_events * (sizeof(xEvent) >> 2)))
|
||||
return BadLength;
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
|
||||
/* The client's event type must be one defined by an extension. */
|
||||
|
||||
first = ((xEvent *) & stuff[1]);
|
||||
if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
|
||||
(first->u.u.type < lastEvent))) {
|
||||
(first->u.u.type < lastEvent)))
|
||||
client->errorValue = first->u.u.type;
|
||||
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadValue);
|
||||
return Success;
|
||||
}
|
||||
return BadValue;
|
||||
|
||||
list = (XEventClass *) (first + stuff->num_events);
|
||||
if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev,
|
||||
X_SendExtensionEvent)) != Success)
|
||||
return Success;
|
||||
return ret;
|
||||
|
||||
ret = (SendEvent(client, dev, stuff->destination,
|
||||
stuff->propagate, (xEvent *) & stuff[1],
|
||||
tmp[stuff->deviceid].mask, stuff->num_events));
|
||||
|
||||
if (ret != Success)
|
||||
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, ret);
|
||||
|
||||
return Success;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
26
Xi/setbmap.c
26
Xi/setbmap.c
|
|
@ -59,13 +59,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -104,11 +101,8 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
|
|||
REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq);
|
||||
|
||||
if (stuff->length != (sizeof(xSetDeviceButtonMappingReq) +
|
||||
stuff->map_length + 3) >> 2) {
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
|
||||
BadLength);
|
||||
return Success;
|
||||
}
|
||||
stuff->map_length + 3) >> 2)
|
||||
return BadLength;
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_SetDeviceButtonMapping;
|
||||
|
|
@ -117,24 +111,20 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
|
|||
rep.status = MappingSuccess;
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
|
||||
ret = SetButtonMapping(client, dev, stuff->map_length, (BYTE *) & stuff[1]);
|
||||
|
||||
if (ret == BadValue || ret == BadMatch) {
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, ret);
|
||||
return Success;
|
||||
} else {
|
||||
if (ret == BadValue || ret == BadMatch)
|
||||
return ret;
|
||||
else {
|
||||
rep.status = ret;
|
||||
WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
|
||||
}
|
||||
|
||||
if (ret != MappingBusy)
|
||||
SendDeviceMappingNotify(MappingPointer, 0, 0, dev);
|
||||
SendDeviceMappingNotify(client, MappingPointer, 0, 0, dev);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
|
|||
36
Xi/setdval.c
36
Xi/setdval.c
|
|
@ -56,13 +56,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "XIstubs.h"
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -106,24 +103,17 @@ ProcXSetDeviceValuators(ClientPtr client)
|
|||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
if (stuff->length != (sizeof(xSetDeviceValuatorsReq) >> 2) +
|
||||
stuff->num_valuators) {
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev->valuator == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
stuff->num_valuators)
|
||||
return BadLength;
|
||||
|
||||
if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes) {
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadValue);
|
||||
return Success;
|
||||
}
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
if (dev->valuator == NULL)
|
||||
return BadMatch;
|
||||
|
||||
if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes)
|
||||
return BadValue;
|
||||
|
||||
if ((dev->grab) && !SameClient(dev->grab, client))
|
||||
rep.status = AlreadyGrabbed;
|
||||
|
|
@ -133,11 +123,9 @@ ProcXSetDeviceValuators(ClientPtr client)
|
|||
stuff->num_valuators);
|
||||
|
||||
if (rep.status != Success && rep.status != AlreadyGrabbed)
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
|
||||
rep.status);
|
||||
else
|
||||
WriteReplyToClient(client, sizeof(xSetDeviceValuatorsReply), &rep);
|
||||
return rep.status;
|
||||
|
||||
WriteReplyToClient(client, sizeof(xSetDeviceValuatorsReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "windowstr.h" /* focus struct */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
|
|
@ -65,7 +63,6 @@ SOFTWARE.
|
|||
|
||||
#include "dixevents.h"
|
||||
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -106,15 +103,11 @@ ProcXSetDeviceFocus(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->device);
|
||||
if (dev == NULL || !dev->focus) {
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL || !dev->focus)
|
||||
return BadDevice;
|
||||
|
||||
ret = SetInputFocus(client, dev, stuff->focus, stuff->revertTo,
|
||||
stuff->time, TRUE);
|
||||
if (ret != Success)
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, ret);
|
||||
|
||||
return Success;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
19
Xi/setmmap.c
19
Xi/setmmap.c
|
|
@ -56,13 +56,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -103,11 +100,8 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
|
|||
REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_SetDeviceModifierMapping;
|
||||
|
|
@ -122,14 +116,11 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
|
|||
if (ret == MappingSuccess || ret == MappingBusy || ret == MappingFailed) {
|
||||
rep.success = ret;
|
||||
if (ret == MappingSuccess)
|
||||
SendDeviceMappingNotify(MappingModifier, 0, 0, dev);
|
||||
SendDeviceMappingNotify(client, MappingModifier, 0, 0, dev);
|
||||
WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),
|
||||
&rep);
|
||||
} else {
|
||||
if (ret == -1)
|
||||
ret = BadValue;
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0, ret);
|
||||
}
|
||||
} else if (ret == -1)
|
||||
return BadValue;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
|
|||
21
Xi/setmode.c
21
Xi/setmode.c
|
|
@ -56,13 +56,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "XIstubs.h"
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -105,14 +102,10 @@ ProcXSetDeviceMode(ClientPtr client)
|
|||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev->valuator == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
if (dev->valuator == NULL)
|
||||
return BadMatch;
|
||||
if ((dev->grab) && !SameClient(dev->grab, client))
|
||||
rep.status = AlreadyGrabbed;
|
||||
else
|
||||
|
|
@ -120,10 +113,8 @@ ProcXSetDeviceMode(ClientPtr client)
|
|||
|
||||
if (rep.status == Success)
|
||||
dev->valuator->mode = stuff->mode;
|
||||
else if (rep.status != AlreadyGrabbed) {
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, rep.status);
|
||||
return Success;
|
||||
}
|
||||
else if (rep.status != AlreadyGrabbed)
|
||||
return rep.status;
|
||||
|
||||
WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep);
|
||||
return Success;
|
||||
|
|
|
|||
|
|
@ -56,12 +56,9 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
|
||||
|
|
@ -102,10 +99,8 @@ ProcXUngrabDevice(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xUngrabDeviceReq);
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDevice, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
grab = dev->grab;
|
||||
|
||||
time = ClientTimeToServerTime(stuff->time);
|
||||
|
|
|
|||
|
|
@ -56,13 +56,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
#include "dixgrabs.h"
|
||||
|
|
@ -111,41 +108,27 @@ ProcXUngrabDeviceButton(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->grabbed_device);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev->button == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
if (dev->button == NULL)
|
||||
return BadMatch;
|
||||
|
||||
if (stuff->modifier_device != UseXKeyboard) {
|
||||
mdev = LookupDeviceIntRec(stuff->modifier_device);
|
||||
if (mdev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (mdev->key == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (mdev == NULL)
|
||||
return BadDevice;
|
||||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else
|
||||
mdev = (DeviceIntPtr) LookupKeyboardDevice();
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
|
||||
if (rc != Success) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, rc);
|
||||
return Success;
|
||||
}
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if ((stuff->modifiers != AnyModifier) &&
|
||||
(stuff->modifiers & ~AllModifiersMask)) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadValue);
|
||||
return Success;
|
||||
}
|
||||
(stuff->modifiers & ~AllModifiersMask))
|
||||
return BadValue;
|
||||
|
||||
temporaryGrab.resource = client->clientAsMask;
|
||||
temporaryGrab.device = dev;
|
||||
|
|
|
|||
|
|
@ -56,13 +56,10 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exglobals.h"
|
||||
#include "dixgrabs.h"
|
||||
|
|
@ -111,45 +108,32 @@ ProcXUngrabDeviceKey(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
|
||||
|
||||
dev = LookupDeviceIntRec(stuff->grabbed_device);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev->key == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
if (dev->key == NULL)
|
||||
return BadMatch;
|
||||
|
||||
if (stuff->modifier_device != UseXKeyboard) {
|
||||
mdev = LookupDeviceIntRec(stuff->modifier_device);
|
||||
if (mdev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (mdev->key == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (mdev == NULL)
|
||||
return BadDevice;
|
||||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else
|
||||
mdev = (DeviceIntPtr) LookupKeyboardDevice();
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
|
||||
if (rc != Success) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, rc);
|
||||
return Success;
|
||||
}
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if (((stuff->key > dev->key->curKeySyms.maxKeyCode) ||
|
||||
(stuff->key < dev->key->curKeySyms.minKeyCode))
|
||||
&& (stuff->key != AnyKey)) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue);
|
||||
return Success;
|
||||
}
|
||||
&& (stuff->key != AnyKey))
|
||||
return BadValue;
|
||||
|
||||
if ((stuff->modifiers != AnyModifier) &&
|
||||
(stuff->modifiers & ~AllModifiersMask)) {
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue);
|
||||
return Success;
|
||||
}
|
||||
(stuff->modifiers & ~AllModifiersMask))
|
||||
return BadValue;
|
||||
|
||||
temporaryGrab.resource = client->clientAsMask;
|
||||
temporaryGrab.device = dev;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,8 @@ teardown(void)
|
|||
dbus_connection_unref(bus_info.connection);
|
||||
|
||||
RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, &bus_info);
|
||||
RemoveGeneralSocket(bus_info.fd);
|
||||
if (bus_info.fd != -1)
|
||||
RemoveGeneralSocket(bus_info.fd);
|
||||
bus_info.fd = -1;
|
||||
bus_info.connection = NULL;
|
||||
|
||||
|
|
|
|||
20
configure.ac
20
configure.ac
|
|
@ -179,7 +179,7 @@ dnl Checks for library functions.
|
|||
AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
|
||||
strtol getopt getopt_long vsnprintf walkcontext backtrace \
|
||||
getisax])
|
||||
getisax getzoneid shmctl64])
|
||||
AC_FUNC_ALLOCA
|
||||
dnl Old HAS_* names used in os/*.c.
|
||||
AC_CHECK_FUNC([getdtablesize],
|
||||
|
|
@ -290,6 +290,7 @@ case $host_cpu in
|
|||
alpha*)
|
||||
ALPHA_VIDEO=yes
|
||||
case $host_os in
|
||||
*freebsd*) SYS_LIBS=-lio ;;
|
||||
*netbsd*) AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
|
||||
esac
|
||||
;;
|
||||
|
|
@ -723,6 +724,7 @@ if test "x$XV" = xyes; then
|
|||
AC_DEFINE(XV, 1, [Support Xv extension])
|
||||
AC_DEFINE(XvExtension, 1, [Build Xv extension])
|
||||
REQUIRED_MODULES="$REQUIRED_MODULES videoproto"
|
||||
PKG_CHECK_MODULES(XV, [xv >= 0.22])
|
||||
else
|
||||
XVMC=no
|
||||
fi
|
||||
|
|
@ -782,7 +784,7 @@ fi
|
|||
|
||||
if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then
|
||||
PKG_CHECK_MODULES([XLIB], [x11])
|
||||
PKG_CHECK_MODULES([GL], [glproto >= 1.4.8])
|
||||
PKG_CHECK_MODULES([GL], [glproto >= 1.4.9])
|
||||
AC_SUBST(XLIB_CFLAGS)
|
||||
AC_DEFINE(GLXEXT, 1, [Build GLX extension])
|
||||
GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la'
|
||||
|
|
@ -1443,6 +1445,7 @@ dnl has it in libc), or if libdl is needed to get it.
|
|||
case $host_os in
|
||||
darwin*) ;;
|
||||
*bsd*) ;;
|
||||
linux*) ;;
|
||||
*) xorg_bus_ix86pci=yes ;;
|
||||
esac
|
||||
;;
|
||||
|
|
@ -1461,7 +1464,7 @@ dnl has it in libc), or if libdl is needed to get it.
|
|||
;;
|
||||
x86_64*|amd64*)
|
||||
case $host_os in
|
||||
darwin*|*bsd*)
|
||||
darwin*|*bsd*|linux*)
|
||||
;;
|
||||
*)
|
||||
xorg_bus_ix86pci="yes"
|
||||
|
|
@ -1856,6 +1859,13 @@ if test "$KDRIVE" = yes; then
|
|||
if test "x$XEPHYR" = xauto; then
|
||||
XEPHYR=$xephyr
|
||||
fi
|
||||
XEPHYR_DRI=no
|
||||
if test x$XEPHYR = xyes -a x$DRI = xyes; then
|
||||
XEPHYR_DRI=yes
|
||||
fi
|
||||
if test x$XEPHYR_DRI = xyes ; then
|
||||
AC_DEFINE(XEPHYR_DRI,1,[enable DRI extension in xephyr])
|
||||
fi
|
||||
|
||||
# Xephyr needs nanosleep() which is in librt on Solaris
|
||||
AC_CHECK_FUNC([nanosleep], [],
|
||||
|
|
@ -1875,9 +1885,9 @@ if test "$KDRIVE" = yes; then
|
|||
KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
|
||||
KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
|
||||
|
||||
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
|
||||
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS $XV_CFLAGS"
|
||||
|
||||
KDRIVE_PURE_LIBS="$FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB"
|
||||
KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $XV_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
|
||||
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
|
||||
case $host_os in
|
||||
*linux*)
|
||||
|
|
|
|||
|
|
@ -1208,10 +1208,9 @@ SendMappingNotify(unsigned request, unsigned firstKeyCode, unsigned count,
|
|||
}
|
||||
#ifdef XKB
|
||||
if (!noXkbExtension &&
|
||||
((request == MappingKeyboard) || (request == MappingModifier))) {
|
||||
XkbApplyMappingChange(inputInfo.keyboard,request,firstKeyCode,count,
|
||||
client);
|
||||
}
|
||||
((request == MappingKeyboard) || (request == MappingModifier)))
|
||||
XkbApplyMappingChange(inputInfo.keyboard, request, firstKeyCode, count,
|
||||
client);
|
||||
#endif
|
||||
|
||||
/* 0 is the server client */
|
||||
|
|
@ -1359,6 +1358,7 @@ int
|
|||
ProcSetModifierMapping(ClientPtr client)
|
||||
{
|
||||
xSetModifierMappingReply rep;
|
||||
DeviceIntPtr dev;
|
||||
REQUEST(xSetModifierMappingReq);
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq);
|
||||
|
|
@ -1374,8 +1374,10 @@ ProcSetModifierMapping(ClientPtr client)
|
|||
rep.success = DoSetModifierMapping(client, (KeyCode *)&stuff[1],
|
||||
stuff->numKeyPerModifier);
|
||||
|
||||
/* FIXME: Send mapping notifies for all the extended devices as well. */
|
||||
SendMappingNotify(MappingModifier, 0, 0, client);
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||
if (dev->key && dev->coreEvents)
|
||||
SendDeviceMappingNotify(client, MappingModifier, 0, 0, dev);
|
||||
WriteReplyToClient(client, sizeof(xSetModifierMappingReply), &rep);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
|
@ -1438,16 +1440,19 @@ ProcChangeKeyboardMapping(ClientPtr client)
|
|||
keysyms.maxKeyCode = stuff->firstKeyCode + stuff->keyCodes - 1;
|
||||
keysyms.mapWidth = stuff->keySymsPerKeyCode;
|
||||
keysyms.map = (KeySym *)&stuff[1];
|
||||
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
|
||||
if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
|
||||
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
||||
if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key)
|
||||
if (!SetKeySymsMap(&pDev->key->curKeySyms, &keysyms))
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: Send mapping notifies for all the extended devices as well. */
|
||||
SendMappingNotify(MappingKeyboard, stuff->firstKeyCode, stuff->keyCodes,
|
||||
client);
|
||||
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
||||
if (pDev->key && pDev->coreEvents)
|
||||
SendDeviceMappingNotify(client, MappingKeyboard,
|
||||
stuff->firstKeyCode, stuff->keyCodes,
|
||||
pDev);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
|
|
|
|||
55
dix/events.c
55
dix/events.c
|
|
@ -2352,6 +2352,61 @@ DefineInitialRootWindow(WindowPtr win)
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the mouse sprite info when the server switches from a pScreen to another.
|
||||
* Otherwise, the pScreen of the mouse sprite is never updated when we switch
|
||||
* from a pScreen to another. Never updating the pScreen of the mouse sprite
|
||||
* implies that windows that are in pScreen whose pScreen->myNum >0 will never
|
||||
* get pointer events. This is because in CheckMotion(), sprite.hotPhys.pScreen
|
||||
* always points to the first pScreen it has been set by
|
||||
* DefineInitialRootWindow().
|
||||
*
|
||||
* Calling this function is useful for use cases where the server
|
||||
* has more than one pScreen.
|
||||
* This function is similar to DefineInitialRootWindow() but it does not
|
||||
* reset the mouse pointer position.
|
||||
* @param win must be the new pScreen we are switching to.
|
||||
*/
|
||||
void
|
||||
UpdateSpriteForScreen(ScreenPtr pScreen)
|
||||
{
|
||||
WindowPtr win = NULL;
|
||||
if (!pScreen)
|
||||
return ;
|
||||
win = WindowTable[pScreen->myNum];
|
||||
|
||||
sprite.hotPhys.pScreen = pScreen;
|
||||
sprite.hot = sprite.hotPhys;
|
||||
sprite.hotLimits.x2 = pScreen->width;
|
||||
sprite.hotLimits.y2 = pScreen->height;
|
||||
#ifdef XEVIE
|
||||
xeviewin =
|
||||
#endif
|
||||
sprite.win = win;
|
||||
sprite.current = wCursor (win);
|
||||
sprite.current->refcnt++;
|
||||
spriteTraceGood = 1;
|
||||
ROOT = win;
|
||||
(*pScreen->CursorLimits) (pScreen,
|
||||
sprite.current,
|
||||
&sprite.hotLimits,
|
||||
&sprite.physLimits);
|
||||
sprite.confined = FALSE;
|
||||
(*pScreen->ConstrainCursor) (pScreen, &sprite.physLimits);
|
||||
(*pScreen->DisplayCursor) (pScreen, sprite.current);
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if(!noPanoramiXExtension) {
|
||||
sprite.hotLimits.x1 = -panoramiXdataPtr[0].x;
|
||||
sprite.hotLimits.y1 = -panoramiXdataPtr[0].y;
|
||||
sprite.hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x;
|
||||
sprite.hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y;
|
||||
sprite.physLimits = sprite.hotLimits;
|
||||
sprite.screen = pScreen;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* This does not take any shortcuts, and even ignores its argument, since
|
||||
* it does not happen very often, and one has to walk up the tree since
|
||||
|
|
|
|||
|
|
@ -184,6 +184,8 @@ _X_EXPORT Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
|
|||
char *name;
|
||||
char **aliases;
|
||||
|
||||
if (!ext)
|
||||
return FALSE ;
|
||||
aliases = (char **)xrealloc(ext->aliases,
|
||||
(ext->num_aliases + 1) * sizeof(char *));
|
||||
if (!aliases)
|
||||
|
|
|
|||
|
|
@ -402,6 +402,7 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
|
|||
if (!events)
|
||||
return 0;
|
||||
|
||||
/* DO NOT WANT */
|
||||
if (type != KeyPress && type != KeyRelease)
|
||||
return 0;
|
||||
|
||||
|
|
@ -409,6 +410,9 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
|
|||
(pDev->coreEvents && !inputInfo.keyboard->key))
|
||||
return 0;
|
||||
|
||||
if (key_code < 8 || key_code > 255)
|
||||
return 0;
|
||||
|
||||
if (pDev->coreEvents)
|
||||
numEvents = 2;
|
||||
else
|
||||
|
|
|
|||
227
exa/exa.c
227
exa/exa.c
|
|
@ -74,6 +74,14 @@ exaGetPixmapOffset(PixmapPtr pPix)
|
|||
(unsigned long)pExaScr->info->memoryBase);
|
||||
}
|
||||
|
||||
void *
|
||||
exaGetPixmapDriverPrivate(PixmapPtr pPix)
|
||||
{
|
||||
ExaPixmapPriv(pPix);
|
||||
|
||||
return pExaPixmap->driverPriv;
|
||||
}
|
||||
|
||||
/**
|
||||
* exaGetPixmapPitch() returns the pitch (in bytes) of the given pixmap.
|
||||
*
|
||||
|
|
@ -175,9 +183,18 @@ exaPixmapDirty (PixmapPtr pPix, int x1, int y1, int x2, int y2)
|
|||
static Bool
|
||||
exaDestroyPixmap (PixmapPtr pPixmap)
|
||||
{
|
||||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
||||
ExaScreenPriv(pScreen);
|
||||
|
||||
if (pPixmap->refcnt == 1)
|
||||
{
|
||||
ExaPixmapPriv (pPixmap);
|
||||
|
||||
if (pExaPixmap->driverPriv) {
|
||||
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
|
||||
pExaPixmap->driverPriv = NULL;
|
||||
}
|
||||
|
||||
if (pExaPixmap->area)
|
||||
{
|
||||
DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n",
|
||||
|
|
@ -221,46 +238,87 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
|
|||
{
|
||||
PixmapPtr pPixmap;
|
||||
ExaPixmapPrivPtr pExaPixmap;
|
||||
int driver_alloc = 0;
|
||||
int bpp;
|
||||
ExaScreenPriv(pScreen);
|
||||
|
||||
if (w > 32767 || h > 32767)
|
||||
return NullPixmap;
|
||||
|
||||
pPixmap = fbCreatePixmap (pScreen, w, h, depth);
|
||||
if (!pExaScr->info->CreatePixmap) {
|
||||
pPixmap = fbCreatePixmap (pScreen, w, h, depth);
|
||||
} else {
|
||||
driver_alloc = 1;
|
||||
pPixmap = fbCreatePixmap(pScreen, 0, 0, depth);
|
||||
}
|
||||
|
||||
if (!pPixmap)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
pExaPixmap = ExaGetPixmapPriv(pPixmap);
|
||||
|
||||
bpp = pPixmap->drawable.bitsPerPixel;
|
||||
|
||||
/* Glyphs have w/h equal to zero, and may not be migrated. See exaGlyphs. */
|
||||
if (!w || !h)
|
||||
pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
|
||||
else
|
||||
pExaPixmap->score = EXA_PIXMAP_SCORE_INIT;
|
||||
if (driver_alloc) {
|
||||
size_t paddedWidth, datasize;
|
||||
void *driver_priv;
|
||||
|
||||
pExaPixmap->area = NULL;
|
||||
paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
|
||||
if (paddedWidth / 4 > 32767 || h > 32767)
|
||||
return NullPixmap;
|
||||
|
||||
pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
|
||||
pExaPixmap->sys_pitch = pPixmap->devKind;
|
||||
if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
|
||||
pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
|
||||
else
|
||||
pExaPixmap->fb_pitch = w * bpp / 8;
|
||||
pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
|
||||
pExaScr->info->pixmapPitchAlign);
|
||||
if (paddedWidth < pExaPixmap->fb_pitch)
|
||||
paddedWidth = pExaPixmap->fb_pitch;
|
||||
|
||||
pPixmap->devPrivate.ptr = NULL;
|
||||
pExaPixmap->offscreen = FALSE;
|
||||
datasize = h * paddedWidth;
|
||||
|
||||
pExaPixmap->fb_ptr = NULL;
|
||||
if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
|
||||
pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
|
||||
else
|
||||
pExaPixmap->fb_pitch = w * bpp / 8;
|
||||
pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
|
||||
pExaScr->info->pixmapPitchAlign);
|
||||
pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
|
||||
driver_priv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
|
||||
if (!driver_priv) {
|
||||
fbDestroyPixmap(pPixmap);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pExaPixmap->fb_pitch > 131071) {
|
||||
fbDestroyPixmap(pPixmap);
|
||||
return NULL;
|
||||
(*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
|
||||
paddedWidth, NULL);
|
||||
pExaPixmap->driverPriv = driver_priv;
|
||||
pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
|
||||
pExaPixmap->fb_ptr = NULL;
|
||||
} else {
|
||||
pExaPixmap->driverPriv = NULL;
|
||||
/* Glyphs have w/h equal to zero, and may not be migrated. See exaGlyphs. */
|
||||
if (!w || !h)
|
||||
pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
|
||||
else
|
||||
pExaPixmap->score = EXA_PIXMAP_SCORE_INIT;
|
||||
|
||||
pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
|
||||
pExaPixmap->sys_pitch = pPixmap->devKind;
|
||||
|
||||
pPixmap->devPrivate.ptr = NULL;
|
||||
pExaPixmap->offscreen = FALSE;
|
||||
|
||||
pExaPixmap->fb_ptr = NULL;
|
||||
if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
|
||||
pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
|
||||
else
|
||||
pExaPixmap->fb_pitch = w * bpp / 8;
|
||||
pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
|
||||
pExaScr->info->pixmapPitchAlign);
|
||||
pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
|
||||
|
||||
if (pExaPixmap->fb_pitch > 131071) {
|
||||
fbDestroyPixmap(pPixmap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
pExaPixmap->area = NULL;
|
||||
|
||||
/* Set up damage tracking */
|
||||
pExaPixmap->pDamage = DamageCreate (NULL, NULL, DamageReportNone, TRUE,
|
||||
|
|
@ -278,6 +336,26 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
|
|||
REGION_NULL(pScreen, &pExaPixmap->validSys);
|
||||
REGION_NULL(pScreen, &pExaPixmap->validFB);
|
||||
|
||||
/* Check whether this pixmap can be used for acceleration. */
|
||||
pExaPixmap->accel_blocked = 0;
|
||||
|
||||
if (pExaScr->info->maxPitchPixels) {
|
||||
int max_pitch = pExaScr->info->maxPitchPixels * (bpp + 7) / 8;
|
||||
|
||||
if (pExaPixmap->fb_pitch > max_pitch)
|
||||
pExaPixmap->accel_blocked |= EXA_RANGE_PITCH;
|
||||
}
|
||||
|
||||
if (pExaScr->info->maxPitchBytes &&
|
||||
pExaPixmap->fb_pitch > pExaScr->info->maxPitchBytes)
|
||||
pExaPixmap->accel_blocked |= EXA_RANGE_PITCH;
|
||||
|
||||
if (w > pExaScr->info->maxX)
|
||||
pExaPixmap->accel_blocked |= EXA_RANGE_WIDTH;
|
||||
|
||||
if (h > pExaScr->info->maxY)
|
||||
pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT;
|
||||
|
||||
return pPixmap;
|
||||
}
|
||||
|
||||
|
|
@ -287,6 +365,7 @@ exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
|
|||
{
|
||||
ExaScreenPrivPtr pExaScr;
|
||||
ExaPixmapPrivPtr pExaPixmap;
|
||||
Bool ret;
|
||||
|
||||
if (!pPixmap)
|
||||
return FALSE;
|
||||
|
|
@ -298,6 +377,12 @@ exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
|
|||
|
||||
pExaScr = ExaGetScreenPriv(pPixmap->drawable.pScreen);
|
||||
|
||||
if (pExaScr->info->ModifyPixmapHeader) {
|
||||
ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
|
||||
bitsPerPixel, devKind, pPixData);
|
||||
if (ret == TRUE)
|
||||
return ret;
|
||||
}
|
||||
return pExaScr->SavedModifyPixmapHeader(pPixmap, width, height, depth,
|
||||
bitsPerPixel, devKind, pPixData);
|
||||
}
|
||||
|
|
@ -325,7 +410,7 @@ exaPixmapIsOffscreen(PixmapPtr p)
|
|||
|
||||
save_ptr = p->devPrivate.ptr;
|
||||
|
||||
if (!save_ptr && pExaPixmap)
|
||||
if (!save_ptr && pExaPixmap && !(pExaScr->info->flags & EXA_HANDLES_PIXMAPS))
|
||||
p->devPrivate.ptr = ExaGetPixmapAddress(p);
|
||||
|
||||
if (pExaScr->info->PixmapIsOffscreen)
|
||||
|
|
@ -375,7 +460,7 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
|
|||
Bool offscreen = exaPixmapIsOffscreen(pPixmap);
|
||||
|
||||
/* Unhide pixmap pointer */
|
||||
if (pPixmap->devPrivate.ptr == NULL) {
|
||||
if (pPixmap->devPrivate.ptr == NULL && !(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
|
||||
pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
|
||||
}
|
||||
|
||||
|
|
@ -436,8 +521,7 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
|
|||
ExaPixmapPriv (pPixmap);
|
||||
|
||||
/* Rehide pixmap pointer if we're doing that. */
|
||||
if (pExaPixmap)
|
||||
{
|
||||
if (pExaPixmap && !(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
|
||||
pPixmap->devPrivate.ptr = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -660,22 +744,35 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
if (!pScreenInfo)
|
||||
return FALSE;
|
||||
|
||||
if (!pScreenInfo->memoryBase) {
|
||||
LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memoryBase must be "
|
||||
"non-zero\n", pScreen->myNum);
|
||||
if (pScreenInfo->exa_major != EXA_VERSION_MAJOR ||
|
||||
pScreenInfo->exa_minor > EXA_VERSION_MINOR)
|
||||
{
|
||||
LogMessage(X_ERROR, "EXA(%d): driver's EXA version requirements "
|
||||
"(%d.%d) are incompatible with EXA version (%d.%d)\n",
|
||||
pScreen->myNum,
|
||||
pScreenInfo->exa_major, pScreenInfo->exa_minor,
|
||||
EXA_VERSION_MAJOR, EXA_VERSION_MINOR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!pScreenInfo->memorySize) {
|
||||
LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memorySize must be "
|
||||
"non-zero\n", pScreen->myNum);
|
||||
return FALSE;
|
||||
}
|
||||
if (!pScreenInfo->CreatePixmap) {
|
||||
if (!pScreenInfo->memoryBase) {
|
||||
LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memoryBase "
|
||||
"must be non-zero\n", pScreen->myNum);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pScreenInfo->offScreenBase > pScreenInfo->memorySize) {
|
||||
LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::offScreenBase must be <= "
|
||||
"ExaDriverRec::memorySize\n", pScreen->myNum);
|
||||
return FALSE;
|
||||
if (!pScreenInfo->memorySize) {
|
||||
LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memorySize must be "
|
||||
"non-zero\n", pScreen->myNum);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pScreenInfo->offScreenBase > pScreenInfo->memorySize) {
|
||||
LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::offScreenBase must "
|
||||
"be <= ExaDriverRec::memorySize\n", pScreen->myNum);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pScreenInfo->PrepareSolid) {
|
||||
|
|
@ -696,15 +793,18 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (pScreenInfo->exa_major != EXA_VERSION_MAJOR ||
|
||||
pScreenInfo->exa_minor > EXA_VERSION_MINOR)
|
||||
/* If the driver doesn't set any max pitch values, we'll just assume
|
||||
* that there's a limitation by pixels, and that it's the same as
|
||||
* maxX.
|
||||
*
|
||||
* We want maxPitchPixels or maxPitchBytes to be set so we can check
|
||||
* pixmaps against the max pitch in exaCreatePixmap() -- it matters
|
||||
* whether a pixmap is rejected because of its pitch or
|
||||
* because of its width.
|
||||
*/
|
||||
if (!pScreenInfo->maxPitchPixels && !pScreenInfo->maxPitchBytes)
|
||||
{
|
||||
LogMessage(X_ERROR, "EXA(%d): driver's EXA version requirements "
|
||||
"(%d.%d) are incompatible with EXA version (%d.%d)\n",
|
||||
pScreen->myNum,
|
||||
pScreenInfo->exa_major, pScreenInfo->exa_minor,
|
||||
EXA_VERSION_MAJOR, EXA_VERSION_MINOR);
|
||||
return FALSE;
|
||||
pScreenInfo->maxPitchPixels = pScreenInfo->maxX;
|
||||
}
|
||||
|
||||
#ifdef RENDER
|
||||
|
|
@ -783,8 +883,7 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
/*
|
||||
* Hookup offscreen pixmaps
|
||||
*/
|
||||
if ((pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) &&
|
||||
pExaScr->info->offScreenBase < pExaScr->info->memorySize)
|
||||
if (pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS)
|
||||
{
|
||||
if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex,
|
||||
sizeof (ExaPixmapPrivRec))) {
|
||||
|
|
@ -801,9 +900,15 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
|
||||
pExaScr->SavedModifyPixmapHeader = pScreen->ModifyPixmapHeader;
|
||||
pScreen->ModifyPixmapHeader = exaModifyPixmapHeader;
|
||||
LogMessage(X_INFO, "EXA(%d): Offscreen pixmap area of %d bytes\n",
|
||||
pScreen->myNum,
|
||||
pExaScr->info->memorySize - pExaScr->info->offScreenBase);
|
||||
if (!pExaScr->info->CreatePixmap) {
|
||||
LogMessage(X_INFO, "EXA(%d): Offscreen pixmap area of %lu bytes\n",
|
||||
pScreen->myNum,
|
||||
pExaScr->info->memorySize - pExaScr->info->offScreenBase);
|
||||
} else {
|
||||
LogMessage(X_INFO, "EXA(%d): Driver allocated offscreen pixmaps\n",
|
||||
pScreen->myNum);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -812,14 +917,16 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->offScreenBase,
|
||||
pExaScr->info->memorySize));
|
||||
if (pExaScr->info->offScreenBase < pExaScr->info->memorySize) {
|
||||
if (!exaOffscreenInit (pScreen)) {
|
||||
LogMessage(X_WARNING, "EXA(%d): Offscreen pixmap setup failed\n",
|
||||
pScreen->myNum);
|
||||
return FALSE;
|
||||
}
|
||||
if (!pExaScr->info->CreatePixmap) {
|
||||
DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->offScreenBase,
|
||||
pExaScr->info->memorySize));
|
||||
if (pExaScr->info->offScreenBase < pExaScr->info->memorySize) {
|
||||
if (!exaOffscreenInit (pScreen)) {
|
||||
LogMessage(X_WARNING, "EXA(%d): Offscreen pixmap setup failed\n",
|
||||
pScreen->myNum);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LogMessage(X_INFO, "EXA(%d): Driver registered support for the following"
|
||||
|
|
|
|||
50
exa/exa.h
50
exa/exa.h
|
|
@ -39,7 +39,7 @@
|
|||
#include "fb.h"
|
||||
|
||||
#define EXA_VERSION_MAJOR 2
|
||||
#define EXA_VERSION_MINOR 2
|
||||
#define EXA_VERSION_MINOR 4
|
||||
#define EXA_VERSION_RELEASE 0
|
||||
|
||||
typedef struct _ExaOffscreenArea ExaOffscreenArea;
|
||||
|
|
@ -671,6 +671,44 @@ typedef struct _ExaDriver {
|
|||
*/
|
||||
#define EXA_PREPARE_MASK 2
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* maxPitchPixels controls the pitch limitation for rendering from
|
||||
* the card.
|
||||
* The driver should never receive a request for rendering a pixmap
|
||||
* that has a pitch (in pixels) beyond maxPitchPixels.
|
||||
*
|
||||
* Setting this field is optional -- if your hardware doesn't have
|
||||
* a pitch limitation in pixels, don't set this. If neither this value
|
||||
* nor maxPitchBytes is set, then maxPitchPixels is set to maxX.
|
||||
* If set, it must not be smaller than maxX.
|
||||
*
|
||||
* @sa maxPitchBytes
|
||||
*/
|
||||
int maxPitchPixels;
|
||||
|
||||
/**
|
||||
* maxPitchBytes controls the pitch limitation for rendering from
|
||||
* the card.
|
||||
* The driver should never receive a request for rendering a pixmap
|
||||
* that has a pitch (in bytes) beyond maxPitchBytes.
|
||||
*
|
||||
* Setting this field is optional -- if your hardware doesn't have
|
||||
* a pitch limitation in bytes, don't set this.
|
||||
* If set, it must not be smaller than maxX * 4.
|
||||
* There's no default value for maxPitchBytes.
|
||||
*
|
||||
* @sa maxPitchPixels
|
||||
*/
|
||||
int maxPitchBytes;
|
||||
|
||||
/* Hooks to allow driver to its own pixmap memory management */
|
||||
void *(*CreatePixmap)(ScreenPtr pScreen, int size, int align);
|
||||
void (*DestroyPixmap)(ScreenPtr pScreen, void *driverPriv);
|
||||
Bool (*ModifyPixmapHeader)(PixmapPtr pPixmap, int width, int height,
|
||||
int depth, int bitsPerPixel, int devKind,
|
||||
pointer pPixData);
|
||||
|
||||
/** @} */
|
||||
} ExaDriverRec, *ExaDriverPtr;
|
||||
|
||||
|
|
@ -695,6 +733,13 @@ typedef struct _ExaDriver {
|
|||
* (right-to-left, bottom-to-top).
|
||||
*/
|
||||
#define EXA_TWO_BITBLT_DIRECTIONS (1 << 2)
|
||||
|
||||
/**
|
||||
* EXA_HANDLES_PIXMAPS indicates to EXA that the driver can handle
|
||||
* all pixmap addressing and migration.
|
||||
*/
|
||||
#define EXA_HANDLES_PIXMAPS (1 << 3)
|
||||
|
||||
/** @} */
|
||||
|
||||
ExaDriverPtr
|
||||
|
|
@ -742,6 +787,9 @@ exaMoveInPixmap (PixmapPtr pPixmap);
|
|||
void
|
||||
exaMoveOutPixmap (PixmapPtr pPixmap);
|
||||
|
||||
void *
|
||||
exaGetPixmapDriverPrivate(PixmapPtr p);
|
||||
|
||||
/**
|
||||
* Returns TRUE if the given planemask covers all the significant bits in the
|
||||
* pixel values for pDrawable.
|
||||
|
|
|
|||
126
exa/exa_accel.c
126
exa/exa_accel.c
|
|
@ -43,7 +43,8 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
|
|||
ScreenPtr pScreen = pDrawable->pScreen;
|
||||
ExaScreenPriv (pScreen);
|
||||
RegionPtr pClip = fbGetCompositeClip(pGC);
|
||||
PixmapPtr pPixmap;
|
||||
PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
|
||||
ExaPixmapPriv (pPixmap);
|
||||
BoxPtr pextent, pbox;
|
||||
int nbox;
|
||||
int extentX1, extentX2, extentY1, extentY2;
|
||||
|
|
@ -54,13 +55,12 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
|
|||
|
||||
pixmaps[0].as_dst = TRUE;
|
||||
pixmaps[0].as_src = FALSE;
|
||||
pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable);
|
||||
pixmaps[0].pPix = pPixmap;
|
||||
pixmaps[0].pReg = NULL;
|
||||
|
||||
if (pExaScr->swappedOut ||
|
||||
pGC->fillStyle != FillSolid ||
|
||||
pPixmap->drawable.width > pExaScr->info->maxX ||
|
||||
pPixmap->drawable.height > pExaScr->info->maxY)
|
||||
pExaPixmap->accel_blocked)
|
||||
{
|
||||
ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
|
||||
return;
|
||||
|
|
@ -480,6 +480,7 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
|
|||
{
|
||||
ExaScreenPriv (pDstDrawable->pScreen);
|
||||
PixmapPtr pSrcPixmap, pDstPixmap;
|
||||
ExaPixmapPrivPtr pSrcExaPixmap, pDstExaPixmap;
|
||||
int src_off_x, src_off_y;
|
||||
int dst_off_x, dst_off_y;
|
||||
ExaMigrationRec pixmaps[2];
|
||||
|
|
@ -507,14 +508,6 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
|
|||
|
||||
region = RECTS_TO_REGION(pScreen, nbox, rects, CT_YXBANDED);
|
||||
DEALLOCATE_LOCAL(rects);
|
||||
|
||||
if (region) {
|
||||
src_off_x -= dst_off_x;
|
||||
src_off_y -= dst_off_y;
|
||||
dst_off_x = dst_off_y = 0;
|
||||
pbox = REGION_RECTS(region);
|
||||
nbox = REGION_NUM_RECTS(region);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -527,14 +520,14 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
|
|||
pixmaps[1].pPix = pSrcPixmap;
|
||||
pixmaps[1].pReg = NULL;
|
||||
|
||||
/* 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
|
||||
* adjusted so that the drawing happened within limits.
|
||||
pSrcExaPixmap = ExaGetPixmapPriv (pSrcPixmap);
|
||||
pDstExaPixmap = ExaGetPixmapPriv (pDstPixmap);
|
||||
|
||||
/* Check whether the accelerator can use this pixmap.
|
||||
* FIXME: If it cannot, use temporary pixmaps so that the drawing
|
||||
* happens within limits.
|
||||
*/
|
||||
if (pSrcPixmap->drawable.width > pExaScr->info->maxX ||
|
||||
pSrcPixmap->drawable.height > pExaScr->info->maxY ||
|
||||
pDstPixmap->drawable.width > pExaScr->info->maxX ||
|
||||
pDstPixmap->drawable.height > pExaScr->info->maxY)
|
||||
if (pSrcExaPixmap->accel_blocked || pDstExaPixmap->accel_blocked)
|
||||
{
|
||||
goto fallback;
|
||||
} else {
|
||||
|
|
@ -760,6 +753,7 @@ exaPolyFillRect(DrawablePtr pDrawable,
|
|||
ExaScreenPriv (pDrawable->pScreen);
|
||||
RegionPtr pClip = fbGetCompositeClip(pGC);
|
||||
PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
|
||||
ExaPixmapPriv (pPixmap);
|
||||
register BoxPtr pbox;
|
||||
BoxPtr pextent;
|
||||
int extentX1, extentX2, extentY1, extentY2;
|
||||
|
|
@ -786,9 +780,7 @@ exaPolyFillRect(DrawablePtr pDrawable,
|
|||
|
||||
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
|
||||
|
||||
if (pExaScr->swappedOut ||
|
||||
pPixmap->drawable.width > pExaScr->info->maxX ||
|
||||
pPixmap->drawable.height > pExaScr->info->maxY)
|
||||
if (pExaScr->swappedOut || pExaPixmap->accel_blocked)
|
||||
{
|
||||
goto fallback;
|
||||
}
|
||||
|
|
@ -1102,28 +1094,29 @@ exaFillRegionSolid (DrawablePtr pDrawable,
|
|||
CARD32 alu)
|
||||
{
|
||||
ExaScreenPriv(pDrawable->pScreen);
|
||||
PixmapPtr pPixmap;
|
||||
PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
|
||||
ExaPixmapPriv (pPixmap);
|
||||
int xoff, yoff;
|
||||
ExaMigrationRec pixmaps[1];
|
||||
Bool ret = FALSE;
|
||||
|
||||
pixmaps[0].as_dst = TRUE;
|
||||
pixmaps[0].as_src = FALSE;
|
||||
pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable);
|
||||
pixmaps[0].pPix = pPixmap;
|
||||
pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillSolid,
|
||||
alu) ? NULL : pRegion;
|
||||
|
||||
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
|
||||
REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
|
||||
|
||||
if (pPixmap->drawable.width > pExaScr->info->maxX ||
|
||||
pPixmap->drawable.height > pExaScr->info->maxY)
|
||||
if (pExaPixmap->accel_blocked)
|
||||
{
|
||||
goto fallback;
|
||||
goto out;
|
||||
} else {
|
||||
exaDoMigration (pixmaps, 1, TRUE);
|
||||
}
|
||||
|
||||
if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) &&
|
||||
if (exaPixmapIsOffscreen (pPixmap) &&
|
||||
(*pExaScr->info->PrepareSolid) (pPixmap, alu, planemask, pixel))
|
||||
{
|
||||
int nbox;
|
||||
|
|
@ -1141,7 +1134,8 @@ exaFillRegionSolid (DrawablePtr pDrawable,
|
|||
(*pExaScr->info->DoneSolid) (pPixmap);
|
||||
exaMarkSync(pDrawable->pScreen);
|
||||
|
||||
if (pDrawable->width == 1 && pDrawable->height == 1 &&
|
||||
if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS) &&
|
||||
pDrawable->width == 1 && pDrawable->height == 1 &&
|
||||
pDrawable->bitsPerPixel != 24) {
|
||||
ExaPixmapPriv(pPixmap);
|
||||
|
||||
|
|
@ -1160,24 +1154,13 @@ exaFillRegionSolid (DrawablePtr pDrawable,
|
|||
pRegion);
|
||||
}
|
||||
|
||||
REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
|
||||
return TRUE;
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
fallback:
|
||||
if (alu != GXcopy || !EXA_PM_IS_SOLID(pDrawable, planemask)) {
|
||||
REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
|
||||
return FALSE;
|
||||
}
|
||||
EXA_FALLBACK(("to %p (%c)\n", pDrawable,
|
||||
exaDrawableLocation(pDrawable)));
|
||||
exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pixmaps[0].pReg);
|
||||
out:
|
||||
REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
|
||||
fbFillRegionSolid (pDrawable, pRegion, 0,
|
||||
fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
|
||||
exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
|
||||
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Try to do an accelerated tile of the pTile into pRegion of pDrawable.
|
||||
|
|
@ -1193,11 +1176,14 @@ exaFillRegionTiled (DrawablePtr pDrawable,
|
|||
{
|
||||
ExaScreenPriv(pDrawable->pScreen);
|
||||
PixmapPtr pPixmap;
|
||||
int xoff, yoff, tileXoff, tileYoff;
|
||||
ExaPixmapPrivPtr pExaPixmap;
|
||||
ExaPixmapPrivPtr pTileExaPixmap = ExaGetPixmapPriv(pTile);
|
||||
int xoff, yoff;
|
||||
int tileWidth, tileHeight;
|
||||
ExaMigrationRec pixmaps[2];
|
||||
int nbox = REGION_NUM_RECTS (pRegion);
|
||||
BoxPtr pBox = REGION_RECTS (pRegion);
|
||||
Bool ret = FALSE;
|
||||
|
||||
tileWidth = pTile->drawable.width;
|
||||
tileHeight = pTile->drawable.height;
|
||||
|
|
@ -1223,27 +1209,21 @@ exaFillRegionTiled (DrawablePtr pDrawable,
|
|||
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
|
||||
REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
|
||||
|
||||
if (pPixmap->drawable.width > pExaScr->info->maxX ||
|
||||
pPixmap->drawable.height > pExaScr->info->maxY ||
|
||||
tileWidth > pExaScr->info->maxX ||
|
||||
tileHeight > pExaScr->info->maxY)
|
||||
pExaPixmap = ExaGetPixmapPriv (pPixmap);
|
||||
|
||||
if (pExaPixmap->accel_blocked || pTileExaPixmap->accel_blocked)
|
||||
{
|
||||
goto fallback;
|
||||
goto out;
|
||||
} else {
|
||||
exaDoMigration (pixmaps, 2, TRUE);
|
||||
}
|
||||
|
||||
pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
|
||||
|
||||
if (!pPixmap)
|
||||
goto fallback;
|
||||
if (!pPixmap || !exaPixmapIsOffscreen(pTile))
|
||||
goto out;
|
||||
|
||||
if (!exaPixmapIsOffscreen(pTile))
|
||||
goto fallback;
|
||||
|
||||
if ((*pExaScr->info->PrepareCopy) (exaGetOffscreenPixmap((DrawablePtr)pTile,
|
||||
&tileXoff, &tileYoff),
|
||||
pPixmap, 0, 0, alu, planemask))
|
||||
if ((*pExaScr->info->PrepareCopy) (pTile, pPixmap, 1, 1, alu, planemask))
|
||||
{
|
||||
while (nbox--)
|
||||
{
|
||||
|
|
@ -1251,7 +1231,8 @@ exaFillRegionTiled (DrawablePtr pDrawable,
|
|||
int dstY = pBox->y1;
|
||||
int tileY;
|
||||
|
||||
tileY = (dstY - yoff - pDrawable->y - pPatOrg->y) % tileHeight;
|
||||
modulus(dstY - yoff - pDrawable->y - pPatOrg->y, tileHeight, tileY);
|
||||
|
||||
while (height > 0) {
|
||||
int width = pBox->x2 - pBox->x1;
|
||||
int dstX = pBox->x1;
|
||||
|
|
@ -1262,16 +1243,17 @@ exaFillRegionTiled (DrawablePtr pDrawable,
|
|||
h = height;
|
||||
height -= h;
|
||||
|
||||
tileX = (dstX - xoff - pDrawable->x - pPatOrg->x) % tileWidth;
|
||||
modulus(dstX - xoff - pDrawable->x - pPatOrg->x, tileWidth,
|
||||
tileX);
|
||||
|
||||
while (width > 0) {
|
||||
int w = tileWidth - tileX;
|
||||
if (w > width)
|
||||
w = width;
|
||||
width -= w;
|
||||
|
||||
(*pExaScr->info->Copy) (pPixmap,
|
||||
tileX + tileXoff, tileY + tileYoff,
|
||||
dstX, dstY, w, h);
|
||||
(*pExaScr->info->Copy) (pPixmap, tileX, tileY, dstX, dstY,
|
||||
w, h);
|
||||
dstX += w;
|
||||
tileX = 0;
|
||||
}
|
||||
|
|
@ -1282,26 +1264,14 @@ exaFillRegionTiled (DrawablePtr pDrawable,
|
|||
}
|
||||
(*pExaScr->info->DoneCopy) (pPixmap);
|
||||
exaMarkSync(pDrawable->pScreen);
|
||||
REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
|
||||
return TRUE;
|
||||
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
fallback:
|
||||
if (alu != GXcopy || !EXA_PM_IS_SOLID(pDrawable, planemask)) {
|
||||
REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
|
||||
return FALSE;
|
||||
}
|
||||
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pTile, pDrawable,
|
||||
exaDrawableLocation(&pTile->drawable),
|
||||
exaDrawableLocation(pDrawable)));
|
||||
exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pixmaps[0].pReg);
|
||||
out:
|
||||
REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
|
||||
exaPrepareAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC);
|
||||
fbFillRegionTiled (pDrawable, pRegion, pTile);
|
||||
exaFinishAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC);
|
||||
exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
|
||||
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -553,6 +553,9 @@ exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
|
|||
ExaScreenPriv(pScreen);
|
||||
int i, j;
|
||||
|
||||
if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS)
|
||||
return;
|
||||
|
||||
/* If this debugging flag is set, check each pixmap for whether it is marked
|
||||
* as clean, and if so, actually check if that's the case. This should help
|
||||
* catch issues with failing to mark a drawable as dirty. While it will
|
||||
|
|
|
|||
|
|
@ -154,6 +154,10 @@ extern int exaPixmapPrivateIndex;
|
|||
#define ExaSetPixmapPriv(p,a) ((p)->devPrivates[exaPixmapPrivateIndex].ptr = (pointer) (a))
|
||||
#define ExaPixmapPriv(p) ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p)
|
||||
|
||||
#define EXA_RANGE_PITCH (1 << 0)
|
||||
#define EXA_RANGE_WIDTH (1 << 1)
|
||||
#define EXA_RANGE_HEIGHT (1 << 2)
|
||||
|
||||
typedef struct {
|
||||
ExaOffscreenArea *area;
|
||||
int score; /**< score for the move-in vs move-out heuristic */
|
||||
|
|
@ -166,6 +170,17 @@ typedef struct {
|
|||
int fb_pitch; /**< pitch of pixmap in framebuffer memory */
|
||||
unsigned int fb_size; /**< size of pixmap in framebuffer memory */
|
||||
|
||||
/**
|
||||
* Holds information about whether this pixmap can be used for
|
||||
* acceleration (== 0) or not (> 0).
|
||||
*
|
||||
* Contains a OR'ed combination of the following values:
|
||||
* EXA_RANGE_PITCH - set if the pixmap's pitch is out of range
|
||||
* EXA_RANGE_WIDTH - set if the pixmap's width is out of range
|
||||
* EXA_RANGE_HEIGHT - set if the pixmap's height is out of range
|
||||
*/
|
||||
unsigned int accel_blocked;
|
||||
|
||||
/**
|
||||
* The damage record contains the areas of the pixmap's current location
|
||||
* (framebuffer or system) that have been damaged compared to the other
|
||||
|
|
@ -177,6 +192,10 @@ typedef struct {
|
|||
* damage, which may be overreported) of a pixmap's system and FB copies.
|
||||
*/
|
||||
RegionRec validSys, validFB;
|
||||
/**
|
||||
* Driver private storage per EXA pixmap
|
||||
*/
|
||||
void *driverPriv;
|
||||
} ExaPixmapPrivRec, *ExaPixmapPrivPtr;
|
||||
|
||||
typedef struct _ExaMigrationRec {
|
||||
|
|
|
|||
|
|
@ -336,24 +336,28 @@ exaTryDriverComposite(CARD8 op,
|
|||
int nbox;
|
||||
int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
|
||||
PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
|
||||
ExaPixmapPrivPtr pSrcExaPix, pMaskExaPix = NULL, pDstExaPix;
|
||||
struct _Pixmap scratch;
|
||||
ExaMigrationRec pixmaps[3];
|
||||
|
||||
pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable);
|
||||
pDstPix = exaGetDrawablePixmap(pDst->pDrawable);
|
||||
if (pMask)
|
||||
pMaskPix = exaGetDrawablePixmap(pMask->pDrawable);
|
||||
pSrcExaPix = ExaGetPixmapPriv(pSrcPix);
|
||||
|
||||
/* Bail if we might exceed coord limits by rendering from/to these. We
|
||||
* should really be making some scratch pixmaps with offsets and coords
|
||||
* adjusted to deal with this, but it hasn't been done yet.
|
||||
pDstPix = exaGetDrawablePixmap(pDst->pDrawable);
|
||||
pDstExaPix = ExaGetPixmapPriv(pDstPix);
|
||||
|
||||
if (pMask) {
|
||||
pMaskPix = exaGetDrawablePixmap(pMask->pDrawable);
|
||||
pMaskExaPix = ExaGetPixmapPriv(pMaskPix);
|
||||
}
|
||||
|
||||
/* Check whether the accelerator can use these pixmaps.
|
||||
* FIXME: If it cannot, use temporary pixmaps so that the drawing
|
||||
* happens within limits.
|
||||
*/
|
||||
if (pSrcPix->drawable.width > pExaScr->info->maxX ||
|
||||
pSrcPix->drawable.height > pExaScr->info->maxY ||
|
||||
pDstPix->drawable.width > pExaScr->info->maxX ||
|
||||
pDstPix->drawable.height > pExaScr->info->maxY ||
|
||||
(pMask && (pMaskPix->drawable.width > pExaScr->info->maxX ||
|
||||
pMaskPix->drawable.height > pExaScr->info->maxY)))
|
||||
if (pSrcExaPix->accel_blocked ||
|
||||
pDstExaPix->accel_blocked ||
|
||||
(pMask && (pMaskExaPix->accel_blocked)))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -380,7 +384,6 @@ exaTryDriverComposite(CARD8 op,
|
|||
width, height))
|
||||
return 1;
|
||||
|
||||
pDstPix = exaGetDrawablePixmap (pDst->pDrawable);
|
||||
exaGetDrawableDeltas (pDst->pDrawable, pDstPix, &dst_off_x, &dst_off_y);
|
||||
|
||||
REGION_TRANSLATE(pScreen, ®ion, dst_off_x, dst_off_y);
|
||||
|
|
@ -391,12 +394,12 @@ exaTryDriverComposite(CARD8 op,
|
|||
pixmaps[0].pReg = pixmaps[0].as_src ? NULL : ®ion;
|
||||
pixmaps[1].as_dst = FALSE;
|
||||
pixmaps[1].as_src = TRUE;
|
||||
pixmaps[1].pPix = exaGetDrawablePixmap (pSrc->pDrawable);
|
||||
pixmaps[1].pPix = pSrcPix;
|
||||
pixmaps[1].pReg = NULL;
|
||||
if (pMask) {
|
||||
pixmaps[2].as_dst = FALSE;
|
||||
pixmaps[2].as_src = TRUE;
|
||||
pixmaps[2].pPix = exaGetDrawablePixmap (pMask->pDrawable);
|
||||
pixmaps[2].pPix = pMaskPix;
|
||||
pixmaps[2].pReg = NULL;
|
||||
exaDoMigration(pixmaps, 3, TRUE);
|
||||
} else {
|
||||
|
|
|
|||
37
fb/fbarc.c
37
fb/fbarc.c
|
|
@ -71,9 +71,13 @@ fbPolyArc (DrawablePtr pDrawable,
|
|||
BoxRec box;
|
||||
int x2, y2;
|
||||
RegionPtr cclip;
|
||||
int wrapped = 0;
|
||||
|
||||
cclip = fbGetCompositeClip (pGC);
|
||||
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
wrapped = 1;
|
||||
#endif
|
||||
while (narcs--)
|
||||
{
|
||||
if (miCanZeroArc (parcs))
|
||||
|
|
@ -96,18 +100,43 @@ fbPolyArc (DrawablePtr pDrawable,
|
|||
y2 = box.y1 + (int)parcs->height + 1;
|
||||
box.y2 = y2;
|
||||
if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
|
||||
(RECT_IN_REGION(pDrawable->pScreen, cclip, &box) == rgnIN) )
|
||||
(RECT_IN_REGION(pDrawable->pScreen, cclip, &box) == rgnIN) ) {
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
if (!wrapped) {
|
||||
fbPrepareAccess (pDrawable);
|
||||
wrapped = 1;
|
||||
}
|
||||
#endif
|
||||
(*arc) (dst, dstStride, dstBpp,
|
||||
parcs, pDrawable->x + dstXoff, pDrawable->y + dstYoff,
|
||||
pPriv->and, pPriv->xor);
|
||||
else
|
||||
} else {
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
if (wrapped) {
|
||||
fbFinishAccess (pDrawable);
|
||||
wrapped = 0;
|
||||
}
|
||||
#endif
|
||||
miZeroPolyArc(pDrawable, pGC, 1, parcs);
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
if (wrapped) {
|
||||
fbFinishAccess (pDrawable);
|
||||
wrapped = 0;
|
||||
}
|
||||
#endif
|
||||
miPolyArc(pDrawable, pGC, 1, parcs);
|
||||
}
|
||||
parcs++;
|
||||
}
|
||||
fbFinishAccess (pDrawable);
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
if (wrapped) {
|
||||
fbFinishAccess (pDrawable);
|
||||
wrapped = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -103,6 +103,14 @@ fbSetVisualTypes (int depth, int visuals, int bitsPerRGB)
|
|||
return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
|
||||
}
|
||||
|
||||
Bool
|
||||
fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
|
||||
Pixel redMask, Pixel greenMask, Pixel blueMask)
|
||||
{
|
||||
return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB, -1,
|
||||
redMask, greenMask, blueMask);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a list of formats for a screen, create a list
|
||||
* of visuals and depths for the screen which coorespond to
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ endif
|
|||
install-data-hook: $(XQUARTZ_HOOK) $(XDARWINAPP_HOOK)
|
||||
|
||||
xquartz-install-hook::
|
||||
cd apple && xcodebuild install
|
||||
cd apple && xcodebuild install CFLAGS="$(XSERVERCFLAGS_CFLAGS)" LDFLAGS="$(XSERVERCFLAGS_LIBS)"
|
||||
|
||||
xdarwinapp-install hook:
|
||||
mv $(DESTDIR)$(macosdir)/XDarwinApp $(DESTDIR)$(macosdir)/XDarwin
|
||||
|
|
|
|||
|
|
@ -4,42 +4,6 @@
|
|||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>x11app</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>X11.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>X11 Application</string>
|
||||
<key>CFBundleTypeOSTypes</key>
|
||||
<array>
|
||||
<string>****</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>LSIsAppleDefaultForType</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>tool</string>
|
||||
<string>*</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>UNIX Application</string>
|
||||
<key>CFBundleTypeOSTypes</key>
|
||||
<array>
|
||||
<string>****</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>X11</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
|
|
@ -57,7 +21,7 @@
|
|||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<string>x11a</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ extern void X11ApplicationMain (int argc, const char *argv[],
|
|||
extern int X11EnableKeyEquivalents;
|
||||
extern int quartzHasRoot, quartzEnableRootless;
|
||||
|
||||
#define APP_PREFS "com.apple.x11"
|
||||
#define APP_PREFS "org.x.x11"
|
||||
|
||||
#define PREFS_APPSMENU "apps_menu"
|
||||
#define PREFS_FAKEBUTTONS "enable_fake_buttons"
|
||||
|
|
|
|||
|
|
@ -41,13 +41,11 @@
|
|||
# include "micmap.h"
|
||||
#undef BOOL
|
||||
|
||||
//#include "xf86Version.h"
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define DEFAULTS_FILE "/etc/X11/xserver/Xquartz.plist"
|
||||
#define DEFAULTS_FILE "/usr/X11/lib/X11xserver/Xquartz.plist"
|
||||
|
||||
int X11EnableKeyEquivalents = TRUE;
|
||||
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
|
||||
|
|
@ -275,9 +273,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
|||
_appFlags._active = YES;
|
||||
|
||||
[self activateX:YES];
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
if ([e data2] & 0x10) QuartzMessageServerThread (kXDarwinBringAllToFront, 0);
|
||||
#endif
|
||||
if ([e data2] & 0x10) X11ApplicationSetFrontProcess();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,14 +38,12 @@
|
|||
|
||||
/* ouch! */
|
||||
#define BOOL X_BOOL
|
||||
//# include "Xproto.h"
|
||||
#include "opaque.h"
|
||||
# include "darwin.h"
|
||||
# include "../quartz/quartz.h"
|
||||
# define _APPLEWM_SERVER_
|
||||
# include "X11/extensions/applewm.h"
|
||||
# include "../quartz/applewmExt.h"
|
||||
//# include "X.h"
|
||||
#undef BOOL
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -301,6 +299,7 @@
|
|||
int child1, child2 = 0;
|
||||
int status;
|
||||
|
||||
/* this old code doesn't work with csh ...
|
||||
shell = getenv("SHELL");
|
||||
if (shell == NULL) shell = "/bin/bash";
|
||||
|
||||
|
|
@ -308,8 +307,14 @@
|
|||
argv[1] = "-l";
|
||||
argv[2] = "-c";
|
||||
argv[3] = command;
|
||||
argv[4] = NULL;
|
||||
|
||||
argv[4] = NULL;
|
||||
... but the new code doesn't work with spaces in a command :(
|
||||
*/
|
||||
|
||||
argv[0] = "/usr/bin/login";
|
||||
argv[1] = "-fp";
|
||||
argv[2] = getlogin();
|
||||
|
||||
/* Do the fork-twice trick to avoid having to reap zombies */
|
||||
|
||||
child1 = fork();
|
||||
|
|
@ -655,7 +660,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
|
|||
|
||||
- (IBAction) x11_help:sender
|
||||
{
|
||||
AHLookupAnchor (CFSTR ("Mac Help"), CFSTR ("mchlp2276"));
|
||||
AHLookupAnchor ((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR ("mchlp2276"));
|
||||
}
|
||||
|
||||
- (BOOL) validateMenuItem:(NSMenuItem *)item
|
||||
|
|
|
|||
|
|
@ -70,14 +70,16 @@
|
|||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xauth.h>
|
||||
|
||||
#ifdef USE_XCB
|
||||
#include <xcb/xcb.h>
|
||||
#endif
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <SystemConfiguration/SystemConfiguration.h>
|
||||
|
||||
#define X_SERVER "/usr/X11/bin/Xquartz"
|
||||
#define XTERM_PATH "/usr/X11/bin/xterm"
|
||||
#define WM_PATH "/usr/X11/bin/quartz-wm"
|
||||
#define DEFAULT_XINITRC "/etc/X11/xinit/xinitrc"
|
||||
#define WM_PATH "/usr/bin/quartz-wm"
|
||||
#define DEFAULT_XINITRC "/usr/X11/lib/X11/xinit/xinitrc"
|
||||
#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin"
|
||||
|
||||
/* what xinit does */
|
||||
|
|
@ -595,37 +597,25 @@ static Boolean
|
|||
display_exists_p (int number)
|
||||
{
|
||||
char buf[64];
|
||||
void *conn;
|
||||
char *fullname = NULL;
|
||||
int idisplay, iscreen;
|
||||
char *conn_auth_name, *conn_auth_data;
|
||||
int conn_auth_namelen, conn_auth_datalen;
|
||||
#ifdef USE_XTRANS_INTERNALS
|
||||
extern void *_X11TransConnectDisplay ();
|
||||
extern void _XDisconnectDisplay ();
|
||||
#endif
|
||||
#ifdef USE_XCB
|
||||
xcb_connection_t *conn;
|
||||
#endif
|
||||
|
||||
/* Since connecting to the display waits for a few seconds if the
|
||||
display doesn't exist, check for trivial non-existence - if the
|
||||
socket in /tmp exists or not.. (note: if the socket exists, the
|
||||
server may still not, so we need to try to connect in that case..) */
|
||||
|
||||
sprintf (buf, "/tmp/.X11-unix/X%d", number);
|
||||
if (access (buf, F_OK) != 0)
|
||||
return FALSE;
|
||||
#ifdef USE_XTRANS_INTERNALS
|
||||
/* This is a private function that we shouldn't really be calling,
|
||||
but it's the best way to see if the server exists (without
|
||||
needing to hold the necessary authentication to use it) */
|
||||
|
||||
if (access (buf, F_OK) != 0) return FALSE;
|
||||
|
||||
#ifdef USE_XCB
|
||||
sprintf (buf, ":%d", number);
|
||||
conn = _X11TransConnectDisplay (buf, &fullname, &idisplay, &iscreen,
|
||||
&conn_auth_name, &conn_auth_namelen,
|
||||
&conn_auth_data, &conn_auth_datalen);
|
||||
if (conn == NULL)
|
||||
return FALSE;
|
||||
|
||||
_XDisconnectDisplay (conn);
|
||||
conn = xcb_connect(buf, NULL);
|
||||
if (conn == NULL) return FALSE;
|
||||
xcb_disconnect(conn);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
Code to build a keymap using the Carbon Keyboard Layout API,
|
||||
which is supported on Mac OS X 10.2 and newer.
|
||||
|
||||
Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
|
||||
Copyright (c) 2003, 2007 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
|
|
@ -214,35 +214,45 @@ Bool
|
|||
DarwinModeReadSystemKeymap (darwinKeyboardInfo *info)
|
||||
{
|
||||
KeyboardLayoutRef key_layout;
|
||||
const void *chr_data;
|
||||
const void *chr_data = NULL;
|
||||
int num_keycodes = NUM_KEYCODES;
|
||||
UInt32 keyboard_type = 0;
|
||||
int is_uchr, i, j;
|
||||
OSStatus err;
|
||||
KeySym *k;
|
||||
|
||||
KLGetCurrentKeyboardLayout (&key_layout);
|
||||
KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data);
|
||||
|
||||
TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource();
|
||||
if (currentKeyLayoutRef)
|
||||
{
|
||||
CFDataRef currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData);
|
||||
if (currentKeyLayoutDataRef)
|
||||
chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef);
|
||||
}
|
||||
|
||||
if (chr_data != NULL)
|
||||
{
|
||||
is_uchr = 1;
|
||||
keyboard_type = LMGetKbdType ();
|
||||
KLGetCurrentKeyboardLayout (&key_layout);
|
||||
KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data);
|
||||
|
||||
if (chr_data != NULL)
|
||||
{
|
||||
is_uchr = 1;
|
||||
keyboard_type = LMGetKbdType ();
|
||||
}
|
||||
else
|
||||
{
|
||||
KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data);
|
||||
|
||||
if (chr_data == NULL)
|
||||
{
|
||||
ErrorF ( "Couldn't get uchr or kchr resource\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
is_uchr = 0;
|
||||
num_keycodes = 128;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data);
|
||||
|
||||
if (chr_data == NULL)
|
||||
{
|
||||
ErrorF ( "Couldn't get uchr or kchr resource\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
is_uchr = 0;
|
||||
num_keycodes = 128;
|
||||
}
|
||||
|
||||
|
||||
/* Scan the keycode range for the Unicode character that each
|
||||
key produces in the four shift states. Then convert that to
|
||||
|
|
@ -367,6 +377,8 @@ DarwinModeReadSystemKeymap (darwinKeyboardInfo *info)
|
|||
}
|
||||
}
|
||||
|
||||
if(currentKeyLayoutRef) CFRelease(currentKeyLayoutRef);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
517
hw/kdrive/ephyr/GL/internal/dri_interface.h
Normal file
517
hw/kdrive/ephyr/GL/internal/dri_interface.h
Normal file
|
|
@ -0,0 +1,517 @@
|
|||
/*
|
||||
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* (C) Copyright IBM Corporation 2004
|
||||
* 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
|
||||
* on 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 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 dri_interface.h
|
||||
*
|
||||
* This file contains all the types and functions that define the interface
|
||||
* between a DRI driver and driver loader. Currently, the most common driver
|
||||
* loader is the XFree86 libGL.so. However, other loaders do exist, and in
|
||||
* the future the server-side libglx.a will also be a loader.
|
||||
*
|
||||
* \author Kevin E. Martin <kevin@precisioninsight.com>
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#ifndef DRI_INTERFACE_H
|
||||
#define DRI_INTERFACE_H
|
||||
|
||||
#include <GL/internal/glcore.h>
|
||||
#include <drm.h>
|
||||
|
||||
/**
|
||||
* \name DRI interface structures
|
||||
*
|
||||
* The following structures define the interface between the GLX client
|
||||
* side library and the DRI (direct rendering infrastructure).
|
||||
*/
|
||||
/*@{*/
|
||||
typedef struct __DRIdisplayRec __DRIdisplay;
|
||||
typedef struct __DRIscreenRec __DRIscreen;
|
||||
typedef struct __DRIcontextRec __DRIcontext;
|
||||
typedef struct __DRIdrawableRec __DRIdrawable;
|
||||
typedef struct __DRIdriverRec __DRIdriver;
|
||||
typedef struct __DRIframebufferRec __DRIframebuffer;
|
||||
typedef struct __DRIversionRec __DRIversion;
|
||||
typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods;
|
||||
typedef unsigned long __DRIid;
|
||||
typedef void __DRInativeDisplay;
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* \name Functions provided by the driver loader.
|
||||
*/
|
||||
/*@{*/
|
||||
/**
|
||||
* Type of a pointer to \c glXGetScreenDriver, as returned by
|
||||
* \c glXGetProcAddress. This function is used to get the name of the DRI
|
||||
* driver for the specified screen of the specified display. The driver
|
||||
* name is typically used with \c glXGetDriverConfig.
|
||||
*
|
||||
* \sa glXGetScreenDriver, glXGetProcAddress, glXGetDriverConfig
|
||||
*/
|
||||
typedef const char * (* PFNGLXGETSCREENDRIVERPROC) (__DRInativeDisplay *dpy, int scrNum);
|
||||
|
||||
/**
|
||||
* Type of a pointer to \c glXGetDriverConfig, as returned by
|
||||
* \c glXGetProcAddress. This function is used to get the XML document
|
||||
* describing the configuration options available for the specified driver.
|
||||
*
|
||||
* \sa glXGetDriverConfig, glXGetProcAddress, glXGetScreenDriver
|
||||
*/
|
||||
typedef const char * (* PFNGLXGETDRIVERCONFIGPROC) (const char *driverName);
|
||||
|
||||
/**
|
||||
* Type of a pointer to \c glxEnableExtension, as returned by
|
||||
* \c __DRIinterfaceMethods::getProcAddress. This function is used to enable
|
||||
* a GLX extension on the specified screen.
|
||||
*/
|
||||
typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) ( void *psc, const char * name );
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* \name Functions and data provided by the driver.
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
typedef void *(CREATENEWSCREENFUNC)(__DRInativeDisplay *dpy, int scrn,
|
||||
__DRIscreen *psc, const __GLcontextModes * modes,
|
||||
const __DRIversion * ddx_version, const __DRIversion * dri_version,
|
||||
const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer,
|
||||
void * pSAREA, int fd, int internal_api_version,
|
||||
const __DRIinterfaceMethods * interface,
|
||||
__GLcontextModes ** driver_modes);
|
||||
typedef CREATENEWSCREENFUNC* PFNCREATENEWSCREENFUNC;
|
||||
extern CREATENEWSCREENFUNC __driCreateNewScreen_20050727;
|
||||
|
||||
|
||||
/**
|
||||
* XML document describing the configuration options supported by the
|
||||
* driver.
|
||||
*/
|
||||
extern const char __driConfigOptions[];
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* Stored version of some component (i.e., server-side DRI module, kernel-side
|
||||
* DRM, etc.).
|
||||
*
|
||||
* \todo
|
||||
* There are several data structures that explicitly store a major version,
|
||||
* minor version, and patch level. These structures should be modified to
|
||||
* have a \c __DRIversionRec instead.
|
||||
*/
|
||||
struct __DRIversionRec {
|
||||
int major; /**< Major version number. */
|
||||
int minor; /**< Minor version number. */
|
||||
int patch; /**< Patch-level. */
|
||||
};
|
||||
|
||||
|
||||
typedef void (*__DRIfuncPtr)(void);
|
||||
|
||||
struct __DRIinterfaceMethodsRec {
|
||||
/**
|
||||
* Get pointer to named function.
|
||||
*/
|
||||
__DRIfuncPtr (*getProcAddress)( const char * proc_name );
|
||||
|
||||
/**
|
||||
* Create a list of \c __GLcontextModes structures.
|
||||
*/
|
||||
__GLcontextModes * (*createContextModes)(unsigned count,
|
||||
size_t minimum_bytes_per_struct);
|
||||
|
||||
/**
|
||||
* Destroy a list of \c __GLcontextModes structures.
|
||||
*
|
||||
* \todo
|
||||
* Determine if the drivers actually need to call this.
|
||||
*/
|
||||
void (*destroyContextModes)( __GLcontextModes * modes );
|
||||
|
||||
/**
|
||||
* Get the \c __DRIscreen for a given display and screen number.
|
||||
*/
|
||||
__DRIscreen *(*getScreen)(__DRInativeDisplay *dpy, int screenNum);
|
||||
|
||||
|
||||
/**
|
||||
* \name Client/server protocol functions.
|
||||
*
|
||||
* These functions implement the DRI client/server protocol for
|
||||
* context and drawable operations. Platforms that do not implement
|
||||
* the wire protocol (e.g., EGL) will implement glorified no-op functions.
|
||||
*/
|
||||
/*@{*/
|
||||
/**
|
||||
* Determine if the specified window ID still exists.
|
||||
*
|
||||
* \note
|
||||
* Implementations may assume that the driver will only pass an ID into
|
||||
* this function that actually corresponds to a window. On
|
||||
* implementations where windows can only be destroyed by the DRI driver
|
||||
* (e.g., EGL), this function is allowed to always return \c GL_TRUE.
|
||||
*/
|
||||
GLboolean (*windowExists)(__DRInativeDisplay *dpy, __DRIid draw);
|
||||
|
||||
/**
|
||||
* Create the server-side portion of the GL context.
|
||||
*/
|
||||
GLboolean (* createContext)( __DRInativeDisplay *dpy, int screenNum,
|
||||
int configID, void * contextID, drm_context_t * hw_context );
|
||||
|
||||
/**
|
||||
* Destroy the server-side portion of the GL context.
|
||||
*/
|
||||
GLboolean (* destroyContext)( __DRInativeDisplay *dpy, int screenNum,
|
||||
__DRIid context );
|
||||
|
||||
/**
|
||||
* Create the server-side portion of the drawable.
|
||||
*/
|
||||
GLboolean (*createDrawable)( __DRInativeDisplay * ndpy, int screen,
|
||||
__DRIid drawable, drm_drawable_t * hHWDrawable );
|
||||
|
||||
/**
|
||||
* Destroy the server-side portion of the drawable.
|
||||
*/
|
||||
GLboolean (*destroyDrawable)( __DRInativeDisplay * ndpy, int screen,
|
||||
__DRIid drawable );
|
||||
|
||||
/**
|
||||
* This function is used to get information about the position, size, and
|
||||
* clip rects of a drawable.
|
||||
*/
|
||||
GLboolean (* getDrawableInfo) ( __DRInativeDisplay *dpy, int scrn,
|
||||
__DRIid draw, unsigned int * index, unsigned int * stamp,
|
||||
int * x, int * y, int * width, int * height,
|
||||
int * numClipRects, drm_clip_rect_t ** pClipRects,
|
||||
int * backX, int * backY,
|
||||
int * numBackClipRects, drm_clip_rect_t ** pBackClipRects );
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* \name Timing related functions.
|
||||
*/
|
||||
/*@{*/
|
||||
/**
|
||||
* Get the 64-bit unadjusted system time (UST).
|
||||
*/
|
||||
int (*getUST)(int64_t * ust);
|
||||
|
||||
/**
|
||||
* Get the media stream counter (MSC) rate.
|
||||
*
|
||||
* Matching the definition in GLX_OML_sync_control, this function returns
|
||||
* the rate of the "media stream counter". In practical terms, this is
|
||||
* the frame refresh rate of the display.
|
||||
*/
|
||||
GLboolean (*getMSCRate)(__DRInativeDisplay * dpy, __DRIid drawable,
|
||||
int32_t * numerator, int32_t * denominator);
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Reports areas of the given drawable which have been modified by the
|
||||
* driver.
|
||||
*
|
||||
* \param drawable which the drawing was done to.
|
||||
* \param rects rectangles affected, with the drawable origin as the
|
||||
* origin.
|
||||
* \param x X offset of the drawable within the screen (used in the
|
||||
* front_buffer case)
|
||||
* \param y Y offset of the drawable within the screen.
|
||||
* \param front_buffer boolean flag for whether the drawing to the
|
||||
* drawable was actually done directly to the front buffer (instead
|
||||
* of backing storage, for example)
|
||||
*/
|
||||
void (*reportDamage)(__DRInativeDisplay * dpy, int screen,
|
||||
__DRIid drawable,
|
||||
int x, int y,
|
||||
drm_clip_rect_t *rects, int num_rects,
|
||||
int front_buffer);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Framebuffer information record. Used by libGL to communicate information
|
||||
* about the framebuffer to the driver's \c __driCreateNewScreen function.
|
||||
*
|
||||
* In XFree86, most of this information is derrived from data returned by
|
||||
* calling \c XF86DRIGetDeviceInfo.
|
||||
*
|
||||
* \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen
|
||||
* __driUtilCreateNewScreen CallCreateNewScreen
|
||||
*
|
||||
* \bug This structure could be better named.
|
||||
*/
|
||||
struct __DRIframebufferRec {
|
||||
unsigned char *base; /**< Framebuffer base address in the CPU's
|
||||
* address space. This value is calculated by
|
||||
* calling \c drmMap on the framebuffer handle
|
||||
* returned by \c XF86DRIGetDeviceInfo (or a
|
||||
* similar function).
|
||||
*/
|
||||
int size; /**< Framebuffer size, in bytes. */
|
||||
int stride; /**< Number of bytes from one line to the next. */
|
||||
int width; /**< Pixel width of the framebuffer. */
|
||||
int height; /**< Pixel height of the framebuffer. */
|
||||
int dev_priv_size; /**< Size of the driver's dev-priv structure. */
|
||||
void *dev_priv; /**< Pointer to the driver's dev-priv structure. */
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Screen dependent methods. This structure is initialized during the
|
||||
* \c __DRIdisplayRec::createScreen call.
|
||||
*/
|
||||
struct __DRIscreenRec {
|
||||
/**
|
||||
* Method to destroy the private DRI screen data.
|
||||
*/
|
||||
void (*destroyScreen)(__DRInativeDisplay *dpy, int scrn, void *screenPrivate);
|
||||
|
||||
/**
|
||||
* Method to create the private DRI drawable data and initialize the
|
||||
* drawable dependent methods.
|
||||
*/
|
||||
void *(*createNewDrawable)(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
|
||||
__DRIid draw, __DRIdrawable *pdraw,
|
||||
int renderType, const int *attrs);
|
||||
|
||||
/**
|
||||
* Method to return a pointer to the DRI drawable data.
|
||||
*/
|
||||
__DRIdrawable *(*getDrawable)(__DRInativeDisplay *dpy, __DRIid draw,
|
||||
void *drawablePrivate);
|
||||
|
||||
/**
|
||||
* Opaque pointer to private per screen direct rendering data. \c NULL
|
||||
* if direct rendering is not supported on this screen. Never
|
||||
* dereferenced in libGL.
|
||||
*/
|
||||
void *private;
|
||||
|
||||
/**
|
||||
* Get the number of vertical refreshes since some point in time before
|
||||
* this function was first called (i.e., system start up).
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*getMSC)( void *screenPrivate, int64_t *msc );
|
||||
|
||||
/**
|
||||
* Opaque pointer that points back to the containing
|
||||
* \c __GLXscreenConfigs. This data structure is shared with DRI drivers
|
||||
* but \c __GLXscreenConfigs is not. However, they are needed by some GLX
|
||||
* functions called by DRI drivers.
|
||||
*
|
||||
* \since Internal API version 20030813.
|
||||
*/
|
||||
void *screenConfigs;
|
||||
|
||||
/**
|
||||
* Functions associated with MESA_allocate_memory.
|
||||
*
|
||||
* \since Internal API version 20030815.
|
||||
*/
|
||||
/*@{*/
|
||||
void *(*allocateMemory)(__DRInativeDisplay *dpy, int scrn, GLsizei size,
|
||||
GLfloat readfreq, GLfloat writefreq,
|
||||
GLfloat priority);
|
||||
|
||||
void (*freeMemory)(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer);
|
||||
|
||||
GLuint (*memoryOffset)(__DRInativeDisplay *dpy, int scrn, const GLvoid *pointer);
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Method to create the private DRI context data and initialize the
|
||||
* context dependent methods.
|
||||
*
|
||||
* \since Internal API version 20031201.
|
||||
*/
|
||||
void * (*createNewContext)(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
|
||||
int render_type,
|
||||
void *sharedPrivate, __DRIcontext *pctx);
|
||||
|
||||
/**
|
||||
* Method to override base texture image with a driver specific 'offset'.
|
||||
* The depth passed in allows e.g. to ignore the alpha channel of texture
|
||||
* images where the non-alpha components don't occupy a whole texel.
|
||||
*
|
||||
* For GLX_EXT_texture_from_pixmap with AIGLX.
|
||||
*
|
||||
* \since Internal API version 20070121.
|
||||
*/
|
||||
void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
|
||||
unsigned long long offset, GLint depth, GLuint pitch);
|
||||
};
|
||||
|
||||
/**
|
||||
* Context dependent methods. This structure is initialized during the
|
||||
* \c __DRIscreenRec::createContext call.
|
||||
*/
|
||||
struct __DRIcontextRec {
|
||||
/**
|
||||
* Method to destroy the private DRI context data.
|
||||
*/
|
||||
void (*destroyContext)(__DRInativeDisplay *dpy, int scrn, void *contextPrivate);
|
||||
|
||||
/**
|
||||
* Opaque pointer to private per context direct rendering data.
|
||||
* \c NULL if direct rendering is not supported on the display or
|
||||
* screen used to create this context. Never dereferenced in libGL.
|
||||
*/
|
||||
void *private;
|
||||
|
||||
/**
|
||||
* Pointer to the mode used to create this context.
|
||||
*
|
||||
* \since Internal API version 20040317.
|
||||
*/
|
||||
const __GLcontextModes * mode;
|
||||
|
||||
/**
|
||||
* Method to bind a DRI drawable to a DRI graphics context.
|
||||
*
|
||||
* \since Internal API version 20050727.
|
||||
*/
|
||||
GLboolean (*bindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw,
|
||||
__DRIid read, __DRIcontext *ctx);
|
||||
|
||||
/**
|
||||
* Method to unbind a DRI drawable from a DRI graphics context.
|
||||
*
|
||||
* \since Internal API version 20050727.
|
||||
*/
|
||||
GLboolean (*unbindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw,
|
||||
__DRIid read, __DRIcontext *ctx);
|
||||
};
|
||||
|
||||
/**
|
||||
* Drawable dependent methods. This structure is initialized during the
|
||||
* \c __DRIscreenRec::createDrawable call. \c createDrawable is not called
|
||||
* by libGL at this time. It's currently used via the dri_util.c utility code
|
||||
* instead.
|
||||
*/
|
||||
struct __DRIdrawableRec {
|
||||
/**
|
||||
* Method to destroy the private DRI drawable data.
|
||||
*/
|
||||
void (*destroyDrawable)(__DRInativeDisplay *dpy, void *drawablePrivate);
|
||||
|
||||
/**
|
||||
* Method to swap the front and back buffers.
|
||||
*/
|
||||
void (*swapBuffers)(__DRInativeDisplay *dpy, void *drawablePrivate);
|
||||
|
||||
/**
|
||||
* Opaque pointer to private per drawable direct rendering data.
|
||||
* \c NULL if direct rendering is not supported on the display or
|
||||
* screen used to create this drawable. Never dereferenced in libGL.
|
||||
*/
|
||||
void *private;
|
||||
|
||||
/**
|
||||
* Get the number of completed swap buffers for this drawable.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*getSBC)(__DRInativeDisplay *dpy, void *drawablePrivate, int64_t *sbc );
|
||||
|
||||
/**
|
||||
* Wait for the SBC to be greater than or equal target_sbc.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*waitForSBC)( __DRInativeDisplay * dpy, void *drawablePriv,
|
||||
int64_t target_sbc,
|
||||
int64_t * msc, int64_t * sbc );
|
||||
|
||||
/**
|
||||
* Wait for the MSC to equal target_msc, or, if that has already passed,
|
||||
* the next time (MSC % divisor) is equal to remainder. If divisor is
|
||||
* zero, the function will return as soon as MSC is greater than or equal
|
||||
* to target_msc.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*waitForMSC)( __DRInativeDisplay * dpy, void *drawablePriv,
|
||||
int64_t target_msc, int64_t divisor, int64_t remainder,
|
||||
int64_t * msc, int64_t * sbc );
|
||||
|
||||
/**
|
||||
* Like \c swapBuffers, but does NOT have an implicit \c glFlush. Once
|
||||
* rendering is complete, waits until MSC is equal to target_msc, or
|
||||
* if that has already passed, waits until (MSC % divisor) is equal
|
||||
* to remainder. If divisor is zero, the swap will happen as soon as
|
||||
* MSC is greater than or equal to target_msc.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int64_t (*swapBuffersMSC)(__DRInativeDisplay *dpy, void *drawablePrivate,
|
||||
int64_t target_msc,
|
||||
int64_t divisor, int64_t remainder);
|
||||
|
||||
/**
|
||||
* Enable or disable frame usage tracking.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*frameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate, GLboolean enable);
|
||||
|
||||
/**
|
||||
* Retrieve frame usage information.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*queryFrameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate,
|
||||
int64_t * sbc, int64_t * missedFrames,
|
||||
float * lastMissedUsage, float * usage );
|
||||
|
||||
/**
|
||||
* Used by drivers that implement the GLX_SGI_swap_control or
|
||||
* GLX_MESA_swap_control extension.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
unsigned swap_interval;
|
||||
|
||||
/**
|
||||
* Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
|
||||
*
|
||||
* \since Internal API version 20060314.
|
||||
*/
|
||||
void (*copySubBuffer)(__DRInativeDisplay *dpy, void *drawablePrivate,
|
||||
int x, int y, int w, int h);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -3,22 +3,47 @@ INCLUDES = \
|
|||
@KDRIVE_CFLAGS@ \
|
||||
-I$(srcdir)/../../../exa
|
||||
|
||||
noinst_LIBRARIES = libxephyr.a libxephyr-hostx.a
|
||||
noinst_LIBRARIES = libxephyr-hostx.a libxephyr-hostxv.a libxephyr.a
|
||||
|
||||
bin_PROGRAMS = Xephyr
|
||||
|
||||
|
||||
libxephyr_hostx_a_SOURCES = \
|
||||
hostx.c \
|
||||
hostx.h
|
||||
|
||||
libxephyr_hostx_a_INCLUDES = @XEPHYR_INCS@
|
||||
|
||||
libxephyr_hostxv_a_SOURCES= \
|
||||
ephyrhostvideo.c \
|
||||
ephyrhostvideo.h
|
||||
|
||||
libxephyr_a_SOURCES = \
|
||||
ephyr.c \
|
||||
ephyr_draw.c \
|
||||
ephyrvideo.c \
|
||||
XF86dri.c \
|
||||
ephyrdriext.c \
|
||||
ephyrdri.c \
|
||||
ephyrdri.h \
|
||||
ephyrglxext.c \
|
||||
ephyrglxext.h \
|
||||
ephyrhostglx.c \
|
||||
ephyrhostglx.h \
|
||||
ephyrhostproxy.c \
|
||||
ephyrhostproxy.h \
|
||||
ephyrhostproxy.c \
|
||||
ephyrproxyext.c \
|
||||
ephyrproxyext.h \
|
||||
os.c \
|
||||
hostx.h \
|
||||
ephyr.h
|
||||
hostx.h \
|
||||
ephyr.h \
|
||||
ephyrlog.h
|
||||
|
||||
libxephyr_hostx_a_SOURCES = \
|
||||
hostx.c \
|
||||
hostx.h
|
||||
|
||||
libxephyr_hostx_a_INCLUDES = @XEPHYR_INCS@
|
||||
libxephyr_a_CFLAGS = \
|
||||
@LIBDRM_CFLAGS@ \
|
||||
-I$(top_srcdir) \
|
||||
@DRIPROTO_CFLAGS@
|
||||
|
||||
Xephyr_SOURCES = \
|
||||
ephyrinit.c
|
||||
|
|
@ -26,13 +51,17 @@ Xephyr_SOURCES = \
|
|||
Xephyr_LDADD = \
|
||||
libxephyr.a \
|
||||
libxephyr-hostx.a \
|
||||
libxephyr-hostxv.a \
|
||||
../../../exa/libexa.la \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XEPHYR_LIBS@
|
||||
@XEPHYR_LIBS@ \
|
||||
@LIBDRM_LIBS@ \
|
||||
-lGL
|
||||
|
||||
Xephyr_DEPENDENCIES = \
|
||||
libxephyr.a \
|
||||
libxephyr-hostx.a \
|
||||
libxephyr-hostxv.a \
|
||||
@KDRIVE_LOCAL_LIBS@
|
||||
|
||||
relink:
|
||||
|
|
|
|||
622
hw/kdrive/ephyr/XF86dri.c
Normal file
622
hw/kdrive/ephyr/XF86dri.c
Normal file
|
|
@ -0,0 +1,622 @@
|
|||
/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.13 2002/10/30 12:51:25 alanh Exp $ */
|
||||
/**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
Copyright 2000 VA Linux Systems, Inc.
|
||||
All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, 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 PRECISION INSIGHT AND/OR ITS 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.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
* Jens Owen <jens@tungstengraphics.com>
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file has been copied from the mesa source tree and a little bit
|
||||
* modified by:
|
||||
*
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <kdrive-config.h>
|
||||
#endif
|
||||
|
||||
#ifdef XEPHYR_DRI
|
||||
|
||||
/* THIS IS NOT AN X CONSORTIUM STANDARD */
|
||||
|
||||
#define NEED_REPLIES
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/extensions/Xext.h>
|
||||
#include <X11/extensions/extutil.h>
|
||||
#include <GL/glx.h>
|
||||
#include <X11/dri/xf86dri.h>
|
||||
#include <X11/dri/xf86dristr.h>
|
||||
|
||||
static XExtensionInfo _xf86dri_info_data;
|
||||
static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
|
||||
static char xf86dri_extension_name[] = XF86DRINAME;
|
||||
|
||||
#define XF86DRICheckExtension(dpy,i,val) \
|
||||
XextCheckExtension (dpy, i, xf86dri_extension_name, val)
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* private utility routines *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
static int close_display(Display *dpy, XExtCodes *extCodes);
|
||||
static /* const */ XExtensionHooks xf86dri_extension_hooks = {
|
||||
NULL, /* create_gc */
|
||||
NULL, /* copy_gc */
|
||||
NULL, /* flush_gc */
|
||||
NULL, /* free_gc */
|
||||
NULL, /* create_font */
|
||||
NULL, /* free_font */
|
||||
close_display, /* close_display */
|
||||
NULL, /* wire_to_event */
|
||||
NULL, /* event_to_wire */
|
||||
NULL, /* error */
|
||||
NULL, /* error_string */
|
||||
};
|
||||
|
||||
static XEXT_GENERATE_FIND_DISPLAY (find_display, xf86dri_info,
|
||||
xf86dri_extension_name,
|
||||
&xf86dri_extension_hooks,
|
||||
0, NULL)
|
||||
|
||||
static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86dri_info)
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* public XFree86-DRI Extension routines *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
#define TRACE(msg) fprintf(stderr,"XF86DRI%s\n", msg);
|
||||
#else
|
||||
#define TRACE(msg)
|
||||
#endif
|
||||
|
||||
Bool XF86DRIOpenFullScreen(Display *dpy, int screen, Drawable drawable);
|
||||
Bool XF86DRICloseFullScreen(Display *dpy, int screen, Drawable drawable);
|
||||
|
||||
Bool XF86DRIQueryExtension (Display *dpy, int *event_basep, int *error_basep)
|
||||
{
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
|
||||
TRACE("QueryExtension...");
|
||||
if (XextHasExtension(info)) {
|
||||
*event_basep = info->codes->first_event;
|
||||
*error_basep = info->codes->first_error;
|
||||
TRACE("QueryExtension... return True");
|
||||
return True;
|
||||
} else {
|
||||
TRACE("QueryExtension... return False");
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
Bool XF86DRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion)
|
||||
Display* dpy;
|
||||
int* majorVersion;
|
||||
int* minorVersion;
|
||||
int* patchVersion;
|
||||
{
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRIQueryVersionReply rep;
|
||||
xXF86DRIQueryVersionReq *req;
|
||||
|
||||
TRACE("QueryVersion...");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRIQueryVersion, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRIQueryVersion;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("QueryVersion... return False");
|
||||
return False;
|
||||
}
|
||||
*majorVersion = rep.majorVersion;
|
||||
*minorVersion = rep.minorVersion;
|
||||
*patchVersion = rep.patchVersion;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("QueryVersion... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XF86DRIQueryDirectRenderingCapable (Display *dpy, int screen, Bool *isCapable)
|
||||
{
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRIQueryDirectRenderingCapableReply rep;
|
||||
xXF86DRIQueryDirectRenderingCapableReq *req;
|
||||
|
||||
TRACE("QueryDirectRenderingCapable...");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRIQueryDirectRenderingCapable, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("QueryDirectRenderingCapable... return False");
|
||||
return False;
|
||||
}
|
||||
*isCapable = rep.isCapable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("QueryDirectRenderingCapable... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XF86DRIOpenConnection (Display *dpy, int screen,
|
||||
drm_handle_t *hSAREA,
|
||||
char **busIdString)
|
||||
{
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRIOpenConnectionReply rep;
|
||||
xXF86DRIOpenConnectionReq *req;
|
||||
|
||||
TRACE("OpenConnection...");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRIOpenConnection, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRIOpenConnection;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("OpenConnection... return False");
|
||||
return False;
|
||||
}
|
||||
|
||||
*hSAREA = rep.hSAREALow;
|
||||
if (sizeof(drm_handle_t) == 8) {
|
||||
int shift = 32; /* var to prevent warning on next line */
|
||||
*hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift;
|
||||
}
|
||||
|
||||
if (rep.length) {
|
||||
if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) {
|
||||
_XEatData(dpy, ((rep.busIdStringLength+3) & ~3));
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("OpenConnection... return False");
|
||||
return False;
|
||||
}
|
||||
_XReadPad(dpy, *busIdString, rep.busIdStringLength);
|
||||
} else {
|
||||
*busIdString = NULL;
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("OpenConnection... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRIAuthConnection(dpy, screen, magic)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
drm_magic_t magic;
|
||||
{
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRIAuthConnectionReq *req;
|
||||
xXF86DRIAuthConnectionReply rep;
|
||||
|
||||
TRACE("AuthConnection...");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRIAuthConnection, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRIAuthConnection;
|
||||
req->screen = screen;
|
||||
req->magic = magic;
|
||||
rep.authenticated = 0;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse) || !rep.authenticated) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("AuthConnection... return False");
|
||||
return False;
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("AuthConnection... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRICloseConnection(dpy, screen)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
{
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRICloseConnectionReq *req;
|
||||
|
||||
TRACE("CloseConnection...");
|
||||
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRICloseConnection, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRICloseConnection;
|
||||
req->screen = screen;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("CloseConnection... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion,
|
||||
ddxDriverMinorVersion, ddxDriverPatchVersion, clientDriverName)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
int* ddxDriverMajorVersion;
|
||||
int* ddxDriverMinorVersion;
|
||||
int* ddxDriverPatchVersion;
|
||||
char** clientDriverName;
|
||||
{
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRIGetClientDriverNameReply rep;
|
||||
xXF86DRIGetClientDriverNameReq *req;
|
||||
|
||||
TRACE("GetClientDriverName...");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRIGetClientDriverName, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRIGetClientDriverName;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("GetClientDriverName... return False");
|
||||
return False;
|
||||
}
|
||||
|
||||
*ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
|
||||
*ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
|
||||
*ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
|
||||
|
||||
if (rep.length) {
|
||||
if (!(*clientDriverName = (char *)Xcalloc(rep.clientDriverNameLength + 1, 1))) {
|
||||
_XEatData(dpy, ((rep.clientDriverNameLength+3) & ~3));
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("GetClientDriverName... return False");
|
||||
return False;
|
||||
}
|
||||
_XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
|
||||
} else {
|
||||
*clientDriverName = NULL;
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("GetClientDriverName... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRICreateContextWithConfig(dpy, screen, configID, context,
|
||||
hHWContext)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
int configID;
|
||||
XID* context;
|
||||
drm_context_t * hHWContext;
|
||||
{
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRICreateContextReply rep;
|
||||
xXF86DRICreateContextReq *req;
|
||||
|
||||
TRACE("CreateContext...");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRICreateContext, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRICreateContext;
|
||||
req->visual = configID;
|
||||
req->screen = screen;
|
||||
*context = XAllocID(dpy);
|
||||
req->context = *context;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("CreateContext... return False");
|
||||
return False;
|
||||
}
|
||||
*hHWContext = rep.hHWContext;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("CreateContext... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
Visual* visual;
|
||||
XID* context;
|
||||
drm_context_t * hHWContext;
|
||||
{
|
||||
return XF86DRICreateContextWithConfig( dpy, screen, visual->visualid,
|
||||
context, hHWContext );
|
||||
}
|
||||
|
||||
GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen,
|
||||
__DRIid context )
|
||||
{
|
||||
Display * const dpy = (Display *) ndpy;
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRIDestroyContextReq *req;
|
||||
|
||||
TRACE("DestroyContext...");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRIDestroyContext, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRIDestroyContext;
|
||||
req->screen = screen;
|
||||
req->context = context;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("DestroyContext... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
GLboolean XF86DRICreateDrawable( __DRInativeDisplay * ndpy, int screen,
|
||||
__DRIid drawable, drm_drawable_t * hHWDrawable )
|
||||
{
|
||||
Display * const dpy = (Display *) ndpy;
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRICreateDrawableReply rep;
|
||||
xXF86DRICreateDrawableReq *req;
|
||||
|
||||
TRACE("CreateDrawable...");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRICreateDrawable, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRICreateDrawable;
|
||||
req->screen = screen;
|
||||
req->drawable = drawable;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("CreateDrawable... return False");
|
||||
return False;
|
||||
}
|
||||
*hHWDrawable = rep.hHWDrawable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("CreateDrawable... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
|
||||
__DRIid drawable )
|
||||
{
|
||||
Display * const dpy = (Display *) ndpy;
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRIDestroyDrawableReq *req;
|
||||
|
||||
TRACE("DestroyDrawable...");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRIDestroyDrawable, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRIDestroyDrawable;
|
||||
req->screen = screen;
|
||||
req->drawable = drawable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("DestroyDrawable... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRIGetDrawableInfo(Display* dpy, int screen, Drawable drawable,
|
||||
unsigned int* index, unsigned int* stamp,
|
||||
int* X, int* Y, int* W, int* H,
|
||||
int* numClipRects, drm_clip_rect_t ** pClipRects,
|
||||
int* backX, int* backY,
|
||||
int* numBackClipRects, drm_clip_rect_t ** pBackClipRects )
|
||||
{
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRIGetDrawableInfoReply rep;
|
||||
xXF86DRIGetDrawableInfoReq *req=NULL;
|
||||
int total_rects;
|
||||
|
||||
TRACE("GetDrawableInfo...");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRIGetDrawableInfo, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRIGetDrawableInfo;
|
||||
req->screen = screen;
|
||||
req->drawable = drawable;
|
||||
|
||||
if (!_XReply(dpy, (xReply *)&rep, 1, xFalse))
|
||||
{
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("GetDrawableInfo... return False");
|
||||
return False;
|
||||
}
|
||||
*index = rep.drawableTableIndex;
|
||||
*stamp = rep.drawableTableStamp;
|
||||
*X = (int)rep.drawableX;
|
||||
*Y = (int)rep.drawableY;
|
||||
*W = (int)rep.drawableWidth;
|
||||
*H = (int)rep.drawableHeight;
|
||||
*numClipRects = rep.numClipRects;
|
||||
total_rects = *numClipRects;
|
||||
|
||||
*backX = rep.backX;
|
||||
*backY = rep.backY;
|
||||
*numBackClipRects = rep.numBackClipRects;
|
||||
total_rects += *numBackClipRects;
|
||||
|
||||
#if 0
|
||||
/* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
|
||||
* backwards compatibility (Because of the >> 2 shift) but the fix
|
||||
* enables multi-threaded apps to work.
|
||||
*/
|
||||
if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
|
||||
SIZEOF(xGenericReply) +
|
||||
total_rects * sizeof(drm_clip_rect_t)) + 3) & ~3) >> 2)) {
|
||||
_XEatData(dpy, rep.length);
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("GetDrawableInfo... return False");
|
||||
return False;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (*numClipRects) {
|
||||
int len = sizeof(drm_clip_rect_t) * (*numClipRects);
|
||||
|
||||
*pClipRects = (drm_clip_rect_t *)Xcalloc(len, 1);
|
||||
if (*pClipRects)
|
||||
_XRead(dpy, (char*)*pClipRects, len);
|
||||
} else {
|
||||
*pClipRects = NULL;
|
||||
}
|
||||
|
||||
if (*numBackClipRects) {
|
||||
int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
|
||||
|
||||
*pBackClipRects = (drm_clip_rect_t *)Xcalloc(len, 1);
|
||||
if (*pBackClipRects)
|
||||
_XRead(dpy, (char*)*pBackClipRects, len);
|
||||
} else {
|
||||
*pBackClipRects = NULL;
|
||||
}
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("GetDrawableInfo... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XF86DRIGetDeviceInfo (Display *dpy, int screen, drm_handle_t *hFrameBuffer,
|
||||
int *fbOrigin, int *fbSize, int *fbStride,
|
||||
int *devPrivateSize, void **pDevPrivate)
|
||||
{
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRIGetDeviceInfoReply rep;
|
||||
xXF86DRIGetDeviceInfoReq *req;
|
||||
|
||||
TRACE("GetDeviceInfo...");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRIGetDeviceInfo, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRIGetDeviceInfo;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("GetDeviceInfo... return False");
|
||||
return False;
|
||||
}
|
||||
|
||||
*hFrameBuffer = rep.hFrameBufferLow;
|
||||
if (sizeof(drm_handle_t) == 8) {
|
||||
int shift = 32; /* var to prevent warning on next line */
|
||||
*hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift;
|
||||
}
|
||||
|
||||
*fbOrigin = rep.framebufferOrigin;
|
||||
*fbSize = rep.framebufferSize;
|
||||
*fbStride = rep.framebufferStride;
|
||||
*devPrivateSize = rep.devPrivateSize;
|
||||
|
||||
if (rep.length) {
|
||||
if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) {
|
||||
_XEatData(dpy, ((rep.devPrivateSize+3) & ~3));
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("GetDeviceInfo... return False");
|
||||
return False;
|
||||
}
|
||||
_XRead(dpy, (char*)*pDevPrivate, rep.devPrivateSize);
|
||||
} else {
|
||||
*pDevPrivate = NULL;
|
||||
}
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("GetDeviceInfo... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XF86DRIOpenFullScreen(Display *dpy, int screen, Drawable drawable)
|
||||
{
|
||||
/* This function and the underlying X protocol are deprecated.
|
||||
*/
|
||||
(void) dpy;
|
||||
(void) screen;
|
||||
(void) drawable;
|
||||
return False;
|
||||
}
|
||||
|
||||
Bool
|
||||
XF86DRICloseFullScreen(Display *dpy, int screen, Drawable drawable)
|
||||
{
|
||||
/* This function and the underlying X protocol are deprecated.
|
||||
*/
|
||||
(void) dpy;
|
||||
(void) screen;
|
||||
(void) drawable;
|
||||
return True;
|
||||
}
|
||||
#endif /*EPHYR_DRI*/
|
||||
|
||||
|
|
@ -23,22 +23,32 @@
|
|||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
*
|
||||
* o Support multiple screens, shouldn't be hard just alot of rejigging.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <kdrive-config.h>
|
||||
#endif
|
||||
#include "ephyr.h"
|
||||
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "ephyrlog.h"
|
||||
|
||||
#ifdef XEPHYR_DRI
|
||||
#include "ephyrdri.h"
|
||||
#include "ephyrdriext.h"
|
||||
#include "ephyrglxext.h"
|
||||
#include "ephyrproxyext.h"
|
||||
#endif /*XEPHYR_DRI*/
|
||||
|
||||
extern int KdTsPhyScreen;
|
||||
#ifdef GLXEXT
|
||||
extern Bool noGlxVisualInit;
|
||||
#endif
|
||||
|
||||
KdKeyboardInfo *ephyrKbd;
|
||||
KdPointerInfo *ephyrMouse;
|
||||
EphyrKeySyms ephyrKeySyms;
|
||||
Bool ephyrNoDRI=FALSE ;
|
||||
Bool ephyrNoXV=FALSE ;
|
||||
|
||||
static int mouseState = 0;
|
||||
|
||||
|
|
@ -48,6 +58,7 @@ typedef struct _EphyrInputPrivate {
|
|||
|
||||
Bool EphyrWantGrayScale = 0;
|
||||
|
||||
|
||||
Bool
|
||||
ephyrInitialize (KdCardInfo *card, EphyrPriv *priv)
|
||||
{
|
||||
|
|
@ -83,7 +94,7 @@ ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
|
|||
int width = 640, height = 480;
|
||||
unsigned long redMask, greenMask, blueMask;
|
||||
|
||||
if (hostx_want_screen_size(&width, &height)
|
||||
if (hostx_want_screen_size(screen, &width, &height)
|
||||
|| !screen->width || !screen->height)
|
||||
{
|
||||
screen->width = width;
|
||||
|
|
@ -99,13 +110,13 @@ ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
|
|||
&& (screen->fb[0].depth == 24 || screen->fb[0].depth == 16
|
||||
|| screen->fb[0].depth == 8))
|
||||
{
|
||||
hostx_set_server_depth(screen->fb[0].depth);
|
||||
hostx_set_server_depth(screen, screen->fb[0].depth);
|
||||
}
|
||||
else
|
||||
else
|
||||
ErrorF("\nXephyr: requested screen depth not supported, setting to match hosts.\n");
|
||||
}
|
||||
|
||||
screen->fb[0].depth = hostx_get_server_depth();
|
||||
screen->fb[0].depth = hostx_get_server_depth(screen);
|
||||
screen->rate = 72;
|
||||
|
||||
if (screen->fb[0].depth <= 8)
|
||||
|
|
@ -146,7 +157,7 @@ ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
|
|||
screen->fb[0].bitsPerPixel = 32;
|
||||
}
|
||||
|
||||
hostx_get_visual_masks (&redMask, &greenMask, &blueMask);
|
||||
hostx_get_visual_masks (screen, &redMask, &greenMask, &blueMask);
|
||||
|
||||
screen->fb[0].redMask = (Pixel) redMask;
|
||||
screen->fb[0].greenMask = (Pixel) greenMask;
|
||||
|
|
@ -194,9 +205,7 @@ ephyrWindowLinear (ScreenPtr pScreen,
|
|||
EphyrPriv *priv = pScreenPriv->card->driver;
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
||||
*size = priv->bytes_per_line;
|
||||
return priv->base + row * priv->bytes_per_line + offset;
|
||||
|
|
@ -210,8 +219,8 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
|
|||
KdPointerMatrix m;
|
||||
int buffer_height;
|
||||
|
||||
EPHYR_DBG(" screen->width: %d, screen->height: %d",
|
||||
screen->width, screen->height);
|
||||
EPHYR_LOG("screen->width: %d, screen->height: %d index=%d",
|
||||
screen->width, screen->height, screen->mynum);
|
||||
|
||||
KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
|
||||
KdSetPointerMatrix (&m);
|
||||
|
|
@ -226,8 +235,8 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
|
|||
buffer_height = screen->height;
|
||||
else
|
||||
buffer_height = 3 * screen->height;
|
||||
|
||||
priv->base = hostx_screen_init (screen->width, screen->height, buffer_height);
|
||||
|
||||
priv->base = hostx_screen_init (screen, screen->width, screen->height, buffer_height);
|
||||
|
||||
screen->memory_base = (CARD8 *) (priv->base);
|
||||
screen->memory_size = priv->bytes_per_line * buffer_height;
|
||||
|
|
@ -246,7 +255,7 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
|
|||
/* Rotated/Reflected so we need to use shadow fb */
|
||||
scrpriv->shadow = TRUE;
|
||||
|
||||
EPHYR_DBG("allocing shadow");
|
||||
EPHYR_LOG("allocing shadow");
|
||||
|
||||
KdShadowFbAlloc (screen, 0,
|
||||
scrpriv->randr & (RR_Rotate_90|RR_Rotate_270));
|
||||
|
|
@ -297,14 +306,14 @@ ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf)
|
|||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
|
||||
EPHYR_DBG("slow paint");
|
||||
EPHYR_LOG("slow paint");
|
||||
|
||||
/* FIXME: Slow Rotated/Reflected updates could be much
|
||||
* much faster efficiently updating via tranforming
|
||||
* pBuf->pDamage regions
|
||||
*/
|
||||
shadowUpdateRotatePacked(pScreen, pBuf);
|
||||
hostx_paint_rect(0,0,0,0, screen->width, screen->height);
|
||||
hostx_paint_rect(screen, 0,0,0,0, screen->width, screen->height);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -314,29 +323,29 @@ ephyrInternalDamageRedisplay (ScreenPtr pScreen)
|
|||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
EphyrScrPriv *scrpriv = screen->driver;
|
||||
RegionPtr pRegion;
|
||||
|
||||
|
||||
if (!scrpriv || !scrpriv->pDamage)
|
||||
return;
|
||||
|
||||
|
||||
pRegion = DamageRegion (scrpriv->pDamage);
|
||||
|
||||
|
||||
if (REGION_NOTEMPTY (pScreen, pRegion))
|
||||
{
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
|
||||
|
||||
nbox = REGION_NUM_RECTS (pRegion);
|
||||
pbox = REGION_RECTS (pRegion);
|
||||
|
||||
|
||||
while (nbox--)
|
||||
{
|
||||
hostx_paint_rect(pbox->x1, pbox->y1,
|
||||
pbox->x1, pbox->y1,
|
||||
pbox->x2 - pbox->x1,
|
||||
pbox->y2 - pbox->y1);
|
||||
pbox++;
|
||||
}
|
||||
|
||||
{
|
||||
hostx_paint_rect(screen,
|
||||
pbox->x1, pbox->y1,
|
||||
pbox->x1, pbox->y1,
|
||||
pbox->x2 - pbox->x1,
|
||||
pbox->y2 - pbox->y1);
|
||||
pbox++;
|
||||
}
|
||||
DamageEmpty (scrpriv->pDamage);
|
||||
}
|
||||
}
|
||||
|
|
@ -411,7 +420,7 @@ ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
|
|||
Rotation randr;
|
||||
int n = 0;
|
||||
|
||||
EPHYR_DBG("mark");
|
||||
EPHYR_LOG("mark");
|
||||
|
||||
struct { int width, height; } sizes[] =
|
||||
{
|
||||
|
|
@ -432,11 +441,11 @@ ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
|
|||
{ 160, 160 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
*rotations = RR_Rotate_All|RR_Reflect_All;
|
||||
|
||||
if (!hostx_want_preexisting_window()
|
||||
&& !hostx_want_fullscreen()) /* only if no -parent switch */
|
||||
|
||||
if (!hostx_want_preexisting_window (screen)
|
||||
&& !hostx_want_fullscreen ()) /* only if no -parent switch */
|
||||
{
|
||||
while (sizes[n].width != 0 && sizes[n].height != 0)
|
||||
{
|
||||
|
|
@ -564,7 +573,7 @@ ephyrRandRSetConfig (ScreenPtr pScreen,
|
|||
return TRUE;
|
||||
|
||||
bail4:
|
||||
EPHYR_DBG("bailed");
|
||||
EPHYR_LOG("bailed");
|
||||
|
||||
ephyrUnmapFramebuffer (screen);
|
||||
*scrpriv = oldscr;
|
||||
|
|
@ -586,9 +595,7 @@ ephyrRandRInit (ScreenPtr pScreen)
|
|||
rrScrPrivPtr pScrPriv;
|
||||
|
||||
if (!RRScreenInit (pScreen))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
pScrPriv = rrGetScrPriv(pScreen);
|
||||
pScrPriv->rrGetInfo = ephyrRandRGetInfo;
|
||||
|
|
@ -606,7 +613,43 @@ ephyrCreateColormap (ColormapPtr pmap)
|
|||
Bool
|
||||
ephyrInitScreen (ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
|
||||
EPHYR_LOG ("pScreen->myNum:%d\n", pScreen->myNum) ;
|
||||
hostx_set_screen_number (screen, pScreen->myNum);
|
||||
hostx_set_win_title (screen, "(ctrl+shift grabs mouse and keyboard)") ;
|
||||
pScreen->CreateColormap = ephyrCreateColormap;
|
||||
|
||||
#ifdef XV
|
||||
if (!ephyrNoXV) {
|
||||
if (!ephyrInitVideo (pScreen)) {
|
||||
EPHYR_LOG_ERROR ("failed to initialize xvideo\n") ;
|
||||
} else {
|
||||
EPHYR_LOG ("initialized xvideo okay\n") ;
|
||||
}
|
||||
}
|
||||
#endif /*XV*/
|
||||
|
||||
#ifdef XEPHYR_DRI
|
||||
if (!ephyrNoDRI && !hostx_has_dri ()) {
|
||||
EPHYR_LOG ("host x does not support DRI. Disabling DRI forwarding\n") ;
|
||||
ephyrNoDRI = TRUE ;
|
||||
noGlxVisualInit = FALSE ;
|
||||
}
|
||||
if (!ephyrNoDRI) {
|
||||
ephyrDRIExtensionInit (pScreen) ;
|
||||
ephyrHijackGLXExtension () ;
|
||||
ephyrProxyExtensionInit ("ATIFGLRXDRI") ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GLXEXT
|
||||
if (ephyrNoDRI) {
|
||||
noGlxVisualInit = FALSE ;
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -618,12 +661,12 @@ ephyrFinishInitScreen (ScreenPtr pScreen)
|
|||
*/
|
||||
if (!shadowSetup (pScreen))
|
||||
return FALSE;
|
||||
|
||||
|
||||
#ifdef RANDR
|
||||
if (!ephyrRandRInit (pScreen))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -634,7 +677,8 @@ ephyrCreateResources (ScreenPtr pScreen)
|
|||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
EphyrScrPriv *scrpriv = screen->driver;
|
||||
|
||||
EPHYR_DBG("mark");
|
||||
EPHYR_LOG("mark pScreen=%p mynum=%d shadow=%d",
|
||||
pScreen, pScreen->myNum, scrpriv->shadow);
|
||||
|
||||
if (scrpriv->shadow)
|
||||
return KdShadowSet (pScreen,
|
||||
|
|
@ -743,6 +787,56 @@ ephyrUpdateModifierState(unsigned int state)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ephyrBlockSigio (void)
|
||||
{
|
||||
sigset_t set;
|
||||
|
||||
sigemptyset (&set);
|
||||
sigaddset (&set, SIGIO);
|
||||
sigprocmask (SIG_BLOCK, &set, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
ephyrUnblockSigio (void)
|
||||
{
|
||||
sigset_t set;
|
||||
|
||||
sigemptyset (&set);
|
||||
sigaddset (&set, SIGIO);
|
||||
sigprocmask (SIG_UNBLOCK, &set, 0);
|
||||
}
|
||||
|
||||
static Bool
|
||||
ephyrCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
ephyrCrossScreen (ScreenPtr pScreen, Bool entering)
|
||||
{
|
||||
}
|
||||
|
||||
int ephyrCurScreen; /*current event screen*/
|
||||
|
||||
static void
|
||||
ephyrWarpCursor (ScreenPtr pScreen, int x, int y)
|
||||
{
|
||||
ephyrBlockSigio ();
|
||||
ephyrCurScreen = pScreen->myNum;
|
||||
miPointerWarpCursor (pScreen, x, y);
|
||||
ephyrUnblockSigio ();
|
||||
}
|
||||
|
||||
miPointerScreenFuncRec ephyrPointerScreenFuncs =
|
||||
{
|
||||
ephyrCursorOffScreen,
|
||||
ephyrCrossScreen,
|
||||
ephyrWarpCursor
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
ephyrPoll(void)
|
||||
{
|
||||
|
|
@ -751,21 +845,39 @@ ephyrPoll(void)
|
|||
while (hostx_get_event(&ev))
|
||||
{
|
||||
switch (ev.type)
|
||||
{
|
||||
case EPHYR_EV_MOUSE_MOTION:
|
||||
{
|
||||
case EPHYR_EV_MOUSE_MOTION:
|
||||
if (!ephyrMouse ||
|
||||
!((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
|
||||
!((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) {
|
||||
EPHYR_LOG ("skipping mouse motion:%d\n", ephyrCurScreen) ;
|
||||
continue;
|
||||
KdEnqueuePointerEvent(ephyrMouse, mouseState,
|
||||
ev.data.mouse_motion.x,
|
||||
ev.data.mouse_motion.y,
|
||||
0);
|
||||
break;
|
||||
|
||||
case EPHYR_EV_MOUSE_PRESS:
|
||||
}
|
||||
{
|
||||
if (ephyrCurScreen != ev.data.mouse_motion.screen)
|
||||
{
|
||||
EPHYR_LOG ("warping mouse cursor:%d\n", ephyrCurScreen) ;
|
||||
ephyrWarpCursor(screenInfo.screens[ev.data.mouse_motion.screen],
|
||||
ev.data.mouse_motion.x,
|
||||
ev.data.mouse_motion.y );
|
||||
}
|
||||
else
|
||||
{
|
||||
EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ;
|
||||
KdEnqueuePointerEvent(ephyrMouse, mouseState,
|
||||
ev.data.mouse_motion.x,
|
||||
ev.data.mouse_motion.y,
|
||||
0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EPHYR_EV_MOUSE_PRESS:
|
||||
if (!ephyrMouse ||
|
||||
!((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
|
||||
!((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) {
|
||||
EPHYR_LOG ("skipping mouse press:%d\n", ephyrCurScreen) ;
|
||||
continue;
|
||||
}
|
||||
EPHYR_LOG ("enqueuing mouse press:%d\n", ephyrCurScreen) ;
|
||||
ephyrUpdateModifierState(ev.key_state);
|
||||
mouseState |= ev.data.mouse_down.button_num;
|
||||
KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
|
||||
|
|
@ -777,6 +889,7 @@ ephyrPoll(void)
|
|||
continue;
|
||||
ephyrUpdateModifierState(ev.key_state);
|
||||
mouseState &= ~ev.data.mouse_up.button_num;
|
||||
EPHYR_LOG ("enqueuing mouse release:%d\n", ephyrCurScreen) ;
|
||||
KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
|
||||
break;
|
||||
|
||||
|
|
@ -792,7 +905,6 @@ ephyrPoll(void)
|
|||
if (!ephyrKbd ||
|
||||
!((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
|
||||
continue;
|
||||
ephyrUpdateModifierState(ev.key_state);
|
||||
KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE);
|
||||
break;
|
||||
|
||||
|
|
@ -814,7 +926,7 @@ ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
|||
{
|
||||
/* XXX Not sure if this is right */
|
||||
|
||||
EPHYR_DBG("mark");
|
||||
EPHYR_LOG("mark");
|
||||
|
||||
while (n--)
|
||||
{
|
||||
|
|
@ -953,6 +1065,7 @@ EphyrKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
KdKeyboardDriver EphyrKeyboardDriver = {
|
||||
"ephyr",
|
||||
EphyrKeyboardInit,
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ extern KdCardFuncs ephyrFuncs;
|
|||
extern KdKeyboardInfo *ephyrKbd;
|
||||
extern KdPointerInfo *ephyrMouse;
|
||||
|
||||
extern miPointerScreenFuncRec ephyrPointerScreenFuncs;
|
||||
|
||||
Bool
|
||||
ephyrInitialize (KdCardInfo *card, EphyrPriv *priv);
|
||||
|
||||
|
|
@ -192,4 +194,8 @@ ephyrDrawDisable(ScreenPtr pScreen);
|
|||
void
|
||||
ephyrDrawFini(ScreenPtr pScreen);
|
||||
|
||||
/*ephyvideo.c*/
|
||||
|
||||
Bool ephyrInitVideo(ScreenPtr pScreen) ;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ ephyrDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
|
|||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
EphyrScrPriv *scrpriv = screen->driver;
|
||||
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
|
||||
char *src;
|
||||
unsigned char *src;
|
||||
int src_pitch, cpp;
|
||||
|
||||
if (pSrc->drawable.bitsPerPixel < 8)
|
||||
|
|
@ -345,7 +345,7 @@ ephyrUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src,
|
|||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
EphyrScrPriv *scrpriv = screen->driver;
|
||||
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
|
||||
char *dst;
|
||||
unsigned char *dst;
|
||||
int dst_pitch, cpp;
|
||||
|
||||
if (pDst->drawable.bitsPerPixel < 8)
|
||||
|
|
|
|||
291
hw/kdrive/ephyr/ephyrdri.c
Normal file
291
hw/kdrive/ephyr/ephyrdri.c
Normal file
|
|
@ -0,0 +1,291 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <kdrive-config.h>
|
||||
#endif
|
||||
|
||||
#ifdef XEPHYR_DRI
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xlibint.h>
|
||||
/*#define _XF86DRI_SERVER_*/
|
||||
#include <GL/glx.h>
|
||||
#include <X11/dri/xf86dri.h>
|
||||
#include "hostx.h"
|
||||
#include "ephyrdri.h"
|
||||
#define _HAVE_XALLOC_DECLS
|
||||
#include "ephyrlog.h"
|
||||
#include "dixstruct.h"
|
||||
#include "pixmapstr.h"
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif /*TRUE*/
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif /*FALSE*/
|
||||
|
||||
Bool
|
||||
ephyrDRIQueryDirectRenderingCapable (int a_screen, Bool *a_is_capable)
|
||||
{
|
||||
Display *dpy=hostx_get_display () ;
|
||||
Bool is_ok=FALSE ;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_is_capable, FALSE) ;
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
is_ok = XF86DRIQueryDirectRenderingCapable (dpy, DefaultScreen (dpy),
|
||||
a_is_capable) ;
|
||||
EPHYR_LOG ("leave. is_capable:%d, is_ok=%d\n", *a_is_capable, is_ok) ;
|
||||
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrDRIOpenConnection (int a_screen,
|
||||
drm_handle_t *a_sarea,
|
||||
char **a_bus_id_string)
|
||||
{
|
||||
Display *dpy = hostx_get_display () ;
|
||||
Bool is_ok=FALSE ;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_bus_id_string, FALSE) ;
|
||||
EPHYR_LOG ("enter. screen:%d\n", a_screen) ;
|
||||
is_ok = XF86DRIOpenConnection (dpy, DefaultScreen (dpy),
|
||||
a_sarea,
|
||||
a_bus_id_string) ;
|
||||
if (*a_bus_id_string) {
|
||||
EPHYR_LOG ("leave. bus_id_string:%s, is_ok:%d\n",
|
||||
*a_bus_id_string, is_ok) ;
|
||||
} else {
|
||||
EPHYR_LOG ("leave. bus_id_string:null, is_ok:%d\n",
|
||||
is_ok) ;
|
||||
}
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrDRIAuthConnection (int a_screen, drm_magic_t a_magic)
|
||||
{
|
||||
Display *dpy = hostx_get_display () ;
|
||||
Bool is_ok=FALSE ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
is_ok = XF86DRIAuthConnection (dpy, DefaultScreen (dpy), a_magic) ;
|
||||
EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrDRICloseConnection (int a_screen)
|
||||
{
|
||||
Display *dpy = hostx_get_display () ;
|
||||
Bool is_ok=FALSE ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
is_ok = XF86DRICloseConnection (dpy, DefaultScreen (dpy)) ;
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrDRIGetClientDriverName (int a_screen,
|
||||
int *a_ddx_driver_major_version,
|
||||
int *a_ddx_driver_minor_version,
|
||||
int *a_ddx_driver_patch_version,
|
||||
char ** a_client_driver_name)
|
||||
{
|
||||
Display *dpy = hostx_get_display () ;
|
||||
Bool is_ok=FALSE ;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_ddx_driver_major_version
|
||||
&& a_ddx_driver_minor_version
|
||||
&& a_ddx_driver_patch_version
|
||||
&& a_client_driver_name,
|
||||
FALSE);
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
is_ok = XF86DRIGetClientDriverName (dpy, DefaultScreen (dpy),
|
||||
a_ddx_driver_major_version,
|
||||
a_ddx_driver_minor_version,
|
||||
a_ddx_driver_patch_version,
|
||||
a_client_driver_name) ;
|
||||
EPHYR_LOG ("major:%d, minor:%d, patch:%d, name:%s\n",
|
||||
*a_ddx_driver_major_version,
|
||||
*a_ddx_driver_minor_version,
|
||||
*a_ddx_driver_patch_version,
|
||||
*a_client_driver_name) ;
|
||||
EPHYR_LOG ("leave:%d\n", is_ok) ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrDRICreateContext (int a_screen,
|
||||
int a_visual_id,
|
||||
unsigned long int *a_returned_ctxt_id,
|
||||
drm_context_t *a_hw_ctxt)
|
||||
{
|
||||
Display *dpy = hostx_get_display () ;
|
||||
Bool is_ok=FALSE ;
|
||||
Visual v;
|
||||
|
||||
EPHYR_LOG ("enter. screen:%d, visual:%d\n", a_screen, a_visual_id) ;
|
||||
memset (&v, 0, sizeof (v)) ;
|
||||
v.visualid = a_visual_id ;
|
||||
is_ok = XF86DRICreateContext (dpy,
|
||||
DefaultScreen (dpy),
|
||||
&v,
|
||||
a_returned_ctxt_id,
|
||||
a_hw_ctxt) ;
|
||||
EPHYR_LOG ("leave:%d\n", is_ok) ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrDRIDestroyContext (int a_screen,
|
||||
int a_context_id)
|
||||
{
|
||||
Display *dpy = hostx_get_display () ;
|
||||
Bool is_ok=FALSE ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
is_ok = XF86DRIDestroyContext (dpy, DefaultScreen (dpy), a_context_id) ;
|
||||
EPHYR_LOG ("leave:%d\n", is_ok) ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrDRICreateDrawable (int a_screen,
|
||||
int a_drawable,
|
||||
drm_drawable_t *a_hw_drawable)
|
||||
{
|
||||
Bool is_ok=FALSE;
|
||||
Display *dpy=hostx_get_display () ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
is_ok = XF86DRICreateDrawable (dpy, DefaultScreen (dpy),
|
||||
a_drawable, a_hw_drawable) ;
|
||||
EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrDRIDestroyDrawable (int a_screen, int a_drawable)
|
||||
{
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
EPHYR_LOG_ERROR ("not implemented yet\n") ;
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrDRIGetDrawableInfo (int a_screen,
|
||||
int a_drawable,
|
||||
unsigned int *a_index,
|
||||
unsigned int *a_stamp,
|
||||
int *a_x,
|
||||
int *a_y,
|
||||
int *a_w,
|
||||
int *a_h,
|
||||
int *a_num_clip_rects,
|
||||
drm_clip_rect_t **a_clip_rects,
|
||||
int *a_back_x,
|
||||
int *a_back_y,
|
||||
int *a_num_back_clip_rects,
|
||||
drm_clip_rect_t **a_back_clip_rects)
|
||||
{
|
||||
Bool is_ok=FALSE;
|
||||
Display *dpy=hostx_get_display () ;
|
||||
EphyrHostWindowAttributes attrs ;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_x && a_y && a_w && a_h
|
||||
&& a_num_clip_rects,
|
||||
FALSE) ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
memset (&attrs, 0, sizeof (attrs)) ;
|
||||
if (!hostx_get_window_attributes (a_drawable, &attrs)) {
|
||||
EPHYR_LOG_ERROR ("failed to query host window attributes\n") ;
|
||||
goto out;
|
||||
}
|
||||
if (!XF86DRIGetDrawableInfo (dpy, DefaultScreen (dpy), a_drawable,
|
||||
a_index, a_stamp,
|
||||
a_x, a_y,
|
||||
a_w, a_h,
|
||||
a_num_clip_rects, a_clip_rects,
|
||||
a_back_x, a_back_y,
|
||||
a_num_back_clip_rects,
|
||||
a_back_clip_rects)) {
|
||||
EPHYR_LOG_ERROR ("XF86DRIGetDrawableInfo ()\n") ;
|
||||
goto out ;
|
||||
}
|
||||
EPHYR_LOG ("host x,y,w,h: (%d,%d,%d,%d)\n", *a_x, *a_y, *a_w, *a_h) ;
|
||||
if (*a_num_clip_rects) {
|
||||
free (*a_back_clip_rects) ;
|
||||
*a_back_clip_rects = calloc (*a_num_clip_rects,
|
||||
sizeof (drm_clip_rect_t)) ;
|
||||
memmove (*a_back_clip_rects,
|
||||
*a_clip_rects,
|
||||
*a_num_clip_rects * sizeof (drm_clip_rect_t)) ;
|
||||
*a_num_back_clip_rects = *a_num_clip_rects;
|
||||
}
|
||||
EPHYR_LOG ("num back clip rects:%d, num clip rects:%d\n",
|
||||
*a_num_clip_rects, *a_num_back_clip_rects) ;
|
||||
*a_back_x = *a_x ;
|
||||
*a_back_y = *a_y ;
|
||||
*a_w = attrs.width;
|
||||
*a_h = attrs.height;
|
||||
|
||||
is_ok = TRUE ;
|
||||
out:
|
||||
EPHYR_LOG ("leave. index:%d, stamp:%d, x,y:(%d,%d), w,y:(%d,%d)\n",
|
||||
*a_index, *a_stamp, *a_x, *a_y, *a_w, *a_h) ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrDRIGetDeviceInfo (int a_screen,
|
||||
drm_handle_t *a_frame_buffer,
|
||||
int *a_fb_origin,
|
||||
int *a_fb_size,
|
||||
int *a_fb_stride,
|
||||
int *a_dev_private_size,
|
||||
void **a_dev_private)
|
||||
{
|
||||
Bool is_ok = FALSE ;
|
||||
Display *dpy = hostx_get_display () ;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
is_ok = XF86DRIGetDeviceInfo (dpy, DefaultScreen (dpy), a_frame_buffer,
|
||||
a_fb_origin, a_fb_size, a_fb_stride,
|
||||
a_dev_private_size, a_dev_private) ;
|
||||
EPHYR_LOG ("leave:%d\n", is_ok) ;
|
||||
return is_ok ;
|
||||
}
|
||||
#endif /*EPHYR_DRI*/
|
||||
|
||||
75
hw/kdrive/ephyr/ephyrdri.h
Normal file
75
hw/kdrive/ephyr/ephyrdri.h
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
|
||||
#ifndef __EPHYRDRI_H__
|
||||
#define __EPHYRDRI_H__
|
||||
|
||||
#include <xf86drm.h>
|
||||
|
||||
Bool ephyrDRIQueryDirectRenderingCapable (int a_screen, Bool *a_is_capable) ;
|
||||
Bool ephyrDRIOpenConnection (int screen, drm_handle_t *a_sarea, char **a_bus_id_string) ;
|
||||
Bool ephyrDRIAuthConnection (int a_screen, drm_magic_t a_magic) ;
|
||||
Bool ephyrDRICloseConnection (int a_screen) ;
|
||||
Bool ephyrDRIGetClientDriverName (int a_screen,
|
||||
int *a_ddx_driver_major_version,
|
||||
int *a_ddx_driver_minor_version,
|
||||
int *a_ddx_driver_patch_version,
|
||||
char ** a_client_driver_name) ;
|
||||
Bool ephyrDRICreateContext (int a_screen,
|
||||
int a_visual_id,
|
||||
unsigned long int *a_returned_ctx_id,
|
||||
drm_context_t *a_hw_ctx) ;
|
||||
Bool ephyrDRIDestroyContext (int a_screen,
|
||||
int a_context_id) ;
|
||||
Bool ephyrDRICreateDrawable (int a_screen,
|
||||
int a_drawable,
|
||||
drm_drawable_t *a_hw_drawable) ;
|
||||
Bool ephyrDRIDestroyDrawable (int a_screen, int a_drawable) ;
|
||||
Bool ephyrDRIGetDrawableInfo (int a_screen,
|
||||
int /*Drawable*/a_drawable,
|
||||
unsigned int *a_index,
|
||||
unsigned int *a_stamp,
|
||||
int *a_x,
|
||||
int *a_y,
|
||||
int *a_w,
|
||||
int *a_h,
|
||||
int *a_num_clip_rects,
|
||||
drm_clip_rect_t **a_clip_rects,
|
||||
int *a_back_x,
|
||||
int *a_back_y,
|
||||
int *num_back_clip_rects,
|
||||
drm_clip_rect_t **a_back_clip_rects) ;
|
||||
Bool ephyrDRIGetDeviceInfo (int a_screen,
|
||||
drm_handle_t *a_frame_buffer,
|
||||
int *a_fb_origin,
|
||||
int *a_fb_size,
|
||||
int *a_fb_stride,
|
||||
int *a_dev_private_size,
|
||||
void **a_dev_private) ;
|
||||
#endif /*__EPHYRDRI_H__*/
|
||||
|
||||
1448
hw/kdrive/ephyr/ephyrdriext.c
Normal file
1448
hw/kdrive/ephyr/ephyrdriext.c
Normal file
File diff suppressed because it is too large
Load diff
32
hw/kdrive/ephyr/ephyrdriext.h
Normal file
32
hw/kdrive/ephyr/ephyrdriext.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
#ifndef __EPHYRDRIEXT_H__
|
||||
#define __EPHYRDRIEXT_H__
|
||||
Bool ephyrDRIExtensionInit (ScreenPtr a_screen) ;
|
||||
#endif /*__EPHYRDRIEXT_H__*/
|
||||
|
||||
722
hw/kdrive/ephyr/ephyrglxext.c
Normal file
722
hw/kdrive/ephyr/ephyrglxext.c
Normal file
|
|
@ -0,0 +1,722 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <kdrive-config.h>
|
||||
#endif
|
||||
|
||||
#include "extnsionst.h"
|
||||
#include "ephyrglxext.h"
|
||||
#include "ephyrhostglx.h"
|
||||
#define _HAVE_XALLOC_DECLS
|
||||
#include "ephyrlog.h"
|
||||
#include <GL/glxproto.h>
|
||||
#include "GL/glx/glxserver.h"
|
||||
#include "GL/glx/indirect_table.h"
|
||||
#include "GL/glx/indirect_util.h"
|
||||
#include "GL/glx/unpack.h"
|
||||
#include "hostx.h"
|
||||
|
||||
|
||||
#ifdef XEPHYR_DRI
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
|
||||
int ephyrGLXQueryVersion (__GLXclientState *cl, GLbyte *pc) ;
|
||||
int ephyrGLXQueryVersionSwap (__GLXclientState *cl, GLbyte *pc) ;
|
||||
int ephyrGLXGetVisualConfigs (__GLXclientState *cl, GLbyte *pc) ;
|
||||
int ephyrGLXGetVisualConfigsSwap (__GLXclientState *cl, GLbyte *pc) ;
|
||||
int ephyrGLXClientInfo(__GLXclientState *cl, GLbyte *pc) ;
|
||||
int ephyrGLXClientInfoSwap(__GLXclientState *cl, GLbyte *pc) ;
|
||||
int ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc) ;
|
||||
int ephyrGLXQueryServerStringSwap(__GLXclientState *a_cl, GLbyte *a_pc) ;
|
||||
int ephyrGLXGetFBConfigsSGIX (__GLXclientState *a_cl, GLbyte *a_pc);
|
||||
int ephyrGLXGetFBConfigsSGIXSwap (__GLXclientState *a_cl, GLbyte *a_pc);
|
||||
int ephyrGLXCreateContext (__GLXclientState *a_cl, GLbyte *a_pc);
|
||||
int ephyrGLXCreateContextSwap (__GLXclientState *a_cl, GLbyte *a_pc);
|
||||
int ephyrGLXDestroyContext (__GLXclientState *a_cl, GLbyte *a_pc) ;
|
||||
int ephyrGLXDestroyContextSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
|
||||
int ephyrGLXMakeCurrent (__GLXclientState *a_cl, GLbyte *a_pc) ;
|
||||
int ephyrGLXMakeCurrentSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
|
||||
int ephyrGLXGetString (__GLXclientState *a_cl, GLbyte *a_pc) ;
|
||||
int ephyrGLXGetStringSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
|
||||
int ephyrGLXGetIntegerv (__GLXclientState *a_cl, GLbyte *a_pc) ;
|
||||
int ephyrGLXGetIntegervSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
|
||||
int ephyrGLXIsDirect (__GLXclientState *a_cl, GLbyte *a_pc) ;
|
||||
int ephyrGLXIsDirectSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
|
||||
|
||||
Bool
|
||||
ephyrHijackGLXExtension (void)
|
||||
{
|
||||
const void *(*dispatch_functions)[2];
|
||||
|
||||
if (!hostx_has_glx ()) {
|
||||
EPHYR_LOG ("host X does not have GLX\n") ;
|
||||
return FALSE ;
|
||||
}
|
||||
EPHYR_LOG ("host X does have GLX\n") ;
|
||||
|
||||
if (!Single_dispatch_info.dispatch_functions) {
|
||||
EPHYR_LOG_ERROR ("could not get dispatch functions table\n") ;
|
||||
return FALSE ;
|
||||
}
|
||||
/*
|
||||
* hijack some single entry point dispatch functions
|
||||
*/
|
||||
dispatch_functions = Single_dispatch_info.dispatch_functions ;
|
||||
EPHYR_RETURN_VAL_IF_FAIL (dispatch_functions, FALSE) ;
|
||||
|
||||
dispatch_functions[X_GLXQueryVersion][0] = ephyrGLXQueryVersion ;
|
||||
dispatch_functions[X_GLXQueryVersion][1] = ephyrGLXQueryVersionSwap ;
|
||||
|
||||
dispatch_functions[X_GLXGetVisualConfigs][0] = ephyrGLXGetVisualConfigs ;
|
||||
dispatch_functions[X_GLXGetVisualConfigs][1] = ephyrGLXGetVisualConfigsSwap ;
|
||||
dispatch_functions[X_GLXClientInfo][0] = ephyrGLXClientInfo ;
|
||||
dispatch_functions[X_GLXClientInfo][1] = ephyrGLXClientInfoSwap ;
|
||||
|
||||
dispatch_functions[X_GLXQueryServerString][0] = ephyrGLXQueryServerString ;
|
||||
dispatch_functions[X_GLXQueryServerString][1] =
|
||||
ephyrGLXQueryServerStringSwap ;
|
||||
|
||||
dispatch_functions[X_GLXCreateContext][0] = ephyrGLXCreateContext ;
|
||||
dispatch_functions[X_GLXCreateContext][1] = ephyrGLXCreateContextSwap ;
|
||||
|
||||
dispatch_functions[X_GLXDestroyContext][0] = ephyrGLXDestroyContext ;
|
||||
dispatch_functions[X_GLXDestroyContext][1] = ephyrGLXDestroyContextSwap ;
|
||||
|
||||
dispatch_functions[X_GLXMakeCurrent][0] = ephyrGLXMakeCurrent ;
|
||||
dispatch_functions[X_GLXMakeCurrent][1] = ephyrGLXMakeCurrentSwap ;
|
||||
|
||||
dispatch_functions[X_GLXIsDirect][0] = ephyrGLXIsDirect ;
|
||||
dispatch_functions[X_GLXIsDirect][1] = ephyrGLXIsDirectSwap ;
|
||||
|
||||
dispatch_functions[73][0] = ephyrGLXGetString ;
|
||||
dispatch_functions[73][1] = ephyrGLXGetStringSwap ;
|
||||
|
||||
dispatch_functions[61][0] = ephyrGLXGetIntegerv ;
|
||||
dispatch_functions[61][1] = ephyrGLXGetIntegervSwap ;
|
||||
|
||||
/*
|
||||
* hijack some vendor priv entry point dispatch functions
|
||||
*/
|
||||
dispatch_functions = VendorPriv_dispatch_info.dispatch_functions ;
|
||||
dispatch_functions[92][0] = ephyrGLXGetFBConfigsSGIX;
|
||||
dispatch_functions[92][1] = ephyrGLXGetFBConfigsSGIXSwap;
|
||||
EPHYR_LOG ("hijacked glx entry points to forward requests to host X\n") ;
|
||||
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
/*********************
|
||||
* implementation of
|
||||
* hijacked GLX entry
|
||||
* points
|
||||
********************/
|
||||
|
||||
int
|
||||
ephyrGLXQueryVersion(__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
ClientPtr client = a_cl->client;
|
||||
xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) a_pc;
|
||||
xGLXQueryVersionReply reply;
|
||||
int major, minor;
|
||||
int res = BadImplementation ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
major = req->majorVersion ;
|
||||
minor = req->minorVersion ;
|
||||
|
||||
if (!ephyrHostGLXQueryVersion (&major, &minor)) {
|
||||
EPHYR_LOG_ERROR ("ephyrHostGLXQueryVersion() failed\n") ;
|
||||
goto out ;
|
||||
}
|
||||
EPHYR_LOG ("major:%d, minor:%d\n",
|
||||
major, minor);
|
||||
reply.majorVersion = major ;
|
||||
reply.minorVersion = minor ;
|
||||
reply.length = 0 ;
|
||||
reply.type = X_Reply ;
|
||||
reply.sequenceNumber = client->sequence ;
|
||||
|
||||
if (client->swapped) {
|
||||
__glXSwapQueryVersionReply(client, &reply);
|
||||
} else {
|
||||
WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
|
||||
}
|
||||
|
||||
res = Success ;
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXQueryVersionSwap (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) a_pc;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
__GLX_SWAP_SHORT (&req->length);
|
||||
__GLX_SWAP_INT (&req->majorVersion);
|
||||
__GLX_SWAP_INT (&req->minorVersion);
|
||||
return ephyrGLXQueryVersion (a_cl, a_pc) ;
|
||||
}
|
||||
|
||||
static int
|
||||
ephyrGLXGetVisualConfigsReal (__GLXclientState *a_cl,
|
||||
GLbyte *a_pc,
|
||||
Bool a_do_swap)
|
||||
{
|
||||
xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) a_pc;
|
||||
ClientPtr client = a_cl->client;
|
||||
xGLXGetVisualConfigsReply reply;
|
||||
int32_t *props_buf=NULL, num_visuals=0,
|
||||
num_props=0, res=BadImplementation, i=0,
|
||||
props_per_visual_size=0,
|
||||
props_buf_size=0;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
if (!ephyrHostGLXGetVisualConfigs (req->screen,
|
||||
&num_visuals,
|
||||
&num_props,
|
||||
&props_buf_size,
|
||||
&props_buf)) {
|
||||
EPHYR_LOG_ERROR ("ephyrHostGLXGetVisualConfigs() failed\n") ;
|
||||
goto out ;
|
||||
}
|
||||
EPHYR_LOG ("num_visuals:%d, num_props:%d\n", num_visuals, num_props) ;
|
||||
|
||||
reply.numVisuals = num_visuals;
|
||||
reply.numProps = num_props;
|
||||
reply.length = (num_visuals *__GLX_SIZE_CARD32 * num_props) >> 2;
|
||||
reply.type = X_Reply;
|
||||
reply.sequenceNumber = client->sequence;
|
||||
|
||||
if (a_do_swap) {
|
||||
__GLX_SWAP_SHORT(&reply.sequenceNumber);
|
||||
__GLX_SWAP_INT(&reply.length);
|
||||
__GLX_SWAP_INT(&reply.numVisuals);
|
||||
__GLX_SWAP_INT(&reply.numProps);
|
||||
__GLX_SWAP_INT_ARRAY (props_buf, num_props) ;
|
||||
}
|
||||
WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char*)&reply);
|
||||
props_per_visual_size = props_buf_size/num_visuals ;
|
||||
for (i=0; i < num_visuals; i++) {
|
||||
WriteToClient (client,
|
||||
props_per_visual_size,
|
||||
(char*)props_buf +i*props_per_visual_size);
|
||||
}
|
||||
res = Success ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
if (props_buf) {
|
||||
xfree (props_buf) ;
|
||||
props_buf = NULL ;
|
||||
}
|
||||
return res ;
|
||||
}
|
||||
|
||||
static int
|
||||
ephyrGLXGetFBConfigsSGIXReal (__GLXclientState *a_cl,
|
||||
GLbyte *a_pc,
|
||||
Bool a_do_swap)
|
||||
{
|
||||
xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)a_pc;
|
||||
ClientPtr client = a_cl->client;
|
||||
xGLXGetVisualConfigsReply reply;
|
||||
int32_t *props_buf=NULL, num_visuals=0,
|
||||
num_props=0, res=BadImplementation, i=0,
|
||||
props_per_visual_size=0,
|
||||
props_buf_size=0;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
if (!ephyrHostGLXVendorPrivGetFBConfigsSGIX (req->screen,
|
||||
&num_visuals,
|
||||
&num_props,
|
||||
&props_buf_size,
|
||||
&props_buf)) {
|
||||
EPHYR_LOG_ERROR ("ephyrHostGLXGetVisualConfigs() failed\n") ;
|
||||
goto out ;
|
||||
}
|
||||
EPHYR_LOG ("num_visuals:%d, num_props:%d\n", num_visuals, num_props) ;
|
||||
|
||||
reply.numVisuals = num_visuals;
|
||||
reply.numProps = num_props;
|
||||
reply.length = props_buf_size >> 2;
|
||||
reply.type = X_Reply;
|
||||
reply.sequenceNumber = client->sequence;
|
||||
|
||||
if (a_do_swap) {
|
||||
__GLX_SWAP_SHORT(&reply.sequenceNumber);
|
||||
__GLX_SWAP_INT(&reply.length);
|
||||
__GLX_SWAP_INT(&reply.numVisuals);
|
||||
__GLX_SWAP_INT(&reply.numProps);
|
||||
__GLX_SWAP_INT_ARRAY (props_buf, num_props) ;
|
||||
}
|
||||
WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char*)&reply);
|
||||
props_per_visual_size = props_buf_size/num_visuals ;
|
||||
for (i=0; i < num_visuals; i++) {
|
||||
WriteToClient (client,
|
||||
props_per_visual_size,
|
||||
&((char*)props_buf)[i*props_per_visual_size]);
|
||||
}
|
||||
res = Success ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
if (props_buf) {
|
||||
xfree (props_buf) ;
|
||||
props_buf = NULL ;
|
||||
}
|
||||
return res ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXGetVisualConfigs (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXGetVisualConfigsReal (a_cl, a_pc, FALSE) ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXGetVisualConfigsSwap (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXGetVisualConfigsReal (a_cl, a_pc, TRUE) ;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ephyrGLXClientInfo(__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
int res=BadImplementation ;
|
||||
xGLXClientInfoReq *req = (xGLXClientInfoReq *) a_pc;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
if (!ephyrHostGLXSendClientInfo (req->major, req->minor, (char*)req+1)) {
|
||||
EPHYR_LOG_ERROR ("failed to send client info to host\n") ;
|
||||
goto out ;
|
||||
}
|
||||
res = Success ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return res ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXClientInfoSwap (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
xGLXClientInfoReq *req = (xGLXClientInfoReq *)a_pc;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
__GLX_SWAP_SHORT (&req->length);
|
||||
__GLX_SWAP_INT (&req->major);
|
||||
__GLX_SWAP_INT (&req->minor);
|
||||
__GLX_SWAP_INT (&req->numbytes);
|
||||
|
||||
return ephyrGLXClientInfo (a_cl, a_pc) ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
int res = BadImplementation ;
|
||||
ClientPtr client = a_cl->client;
|
||||
xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) a_pc;
|
||||
xGLXQueryServerStringReply reply;
|
||||
char *server_string=NULL ;
|
||||
int length=0 ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
if (!ephyrHostGLXGetStringFromServer (req->screen,
|
||||
req->name,
|
||||
EPHYR_HOST_GLX_QueryServerString,
|
||||
&server_string)) {
|
||||
EPHYR_LOG_ERROR ("failed to query string from host\n") ;
|
||||
goto out ;
|
||||
}
|
||||
EPHYR_LOG ("string: %s\n", server_string) ;
|
||||
length= strlen (server_string) + 1;
|
||||
reply.type = X_Reply ;
|
||||
reply.sequenceNumber = client->sequence ;
|
||||
reply.length = __GLX_PAD (length) >> 2 ;
|
||||
reply.n = length ;
|
||||
|
||||
WriteToClient(client, sz_xGLXQueryServerStringReply, (char*)&reply);
|
||||
WriteToClient(client, (int)length, server_string);
|
||||
|
||||
res = Success ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
if (server_string) {
|
||||
xfree (server_string) ;
|
||||
server_string = NULL;
|
||||
}
|
||||
return res ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXQueryServerStringSwap(__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
EPHYR_LOG_ERROR ("not yet implemented\n") ;
|
||||
return BadImplementation ;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ephyrGLXGetFBConfigsSGIX (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXGetFBConfigsSGIXReal (a_cl, a_pc, FALSE) ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXGetFBConfigsSGIXSwap (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXGetFBConfigsSGIXReal (a_cl, a_pc, TRUE) ;
|
||||
}
|
||||
|
||||
static int
|
||||
ephyrGLXCreateContextReal (xGLXCreateContextReq *a_req, Bool a_do_swap)
|
||||
{
|
||||
int res=BadImplementation;
|
||||
EphyrHostWindowAttributes host_w_attrs ;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_req, BadValue) ;
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
if (a_do_swap) {
|
||||
__GLX_SWAP_SHORT(&a_req->length);
|
||||
__GLX_SWAP_INT(&a_req->context);
|
||||
__GLX_SWAP_INT(&a_req->visual);
|
||||
__GLX_SWAP_INT(&a_req->screen);
|
||||
__GLX_SWAP_INT(&a_req->shareList);
|
||||
}
|
||||
|
||||
EPHYR_LOG ("context creation requested. localid:%d, "
|
||||
"screen:%d, visual:%d, direct:%d\n",
|
||||
(int)a_req->context, (int)a_req->screen,
|
||||
(int)a_req->visual, (int)a_req->isDirect) ;
|
||||
|
||||
memset (&host_w_attrs, 0, sizeof (host_w_attrs)) ;
|
||||
if (!hostx_get_window_attributes (hostx_get_window (a_req->screen),
|
||||
&host_w_attrs)) {
|
||||
EPHYR_LOG_ERROR ("failed to get host window attrs\n") ;
|
||||
goto out ;
|
||||
}
|
||||
|
||||
EPHYR_LOG ("host window visual id: %d\n", host_w_attrs.visualid) ;
|
||||
|
||||
if (!ephyrHostGLXCreateContext (a_req->screen,
|
||||
host_w_attrs.visualid,
|
||||
a_req->context,
|
||||
a_req->shareList,
|
||||
a_req->isDirect)) {
|
||||
EPHYR_LOG_ERROR ("ephyrHostGLXCreateContext() failed\n") ;
|
||||
goto out ;
|
||||
}
|
||||
res = Success;
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return res ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXCreateContext (__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
|
||||
|
||||
return ephyrGLXCreateContextReal (req, FALSE) ;
|
||||
}
|
||||
|
||||
int ephyrGLXCreateContextSwap (__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
|
||||
return ephyrGLXCreateContextReal (req, TRUE) ;
|
||||
}
|
||||
|
||||
static int
|
||||
ephyrGLXDestroyContextReal (__GLXclientState *a_cl,
|
||||
GLbyte *a_pc,
|
||||
Bool a_do_swap)
|
||||
{
|
||||
int res=BadImplementation;
|
||||
ClientPtr client = a_cl->client;
|
||||
xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) a_pc;
|
||||
|
||||
EPHYR_LOG ("enter. id:%d\n", (int)req->context) ;
|
||||
if (!ephyrHostDestroyContext (req->context)) {
|
||||
EPHYR_LOG_ERROR ("ephyrHostDestroyContext() failed\n") ;
|
||||
client->errorValue = req->context ;
|
||||
goto out ;
|
||||
}
|
||||
res = Success ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return res ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXDestroyContext (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXDestroyContextReal (a_cl, a_pc, FALSE) ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXDestroyContextSwap (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXDestroyContextReal (a_cl, a_pc, TRUE) ;
|
||||
}
|
||||
|
||||
static int
|
||||
ephyrGLXMakeCurrentReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
|
||||
{
|
||||
int res=BadImplementation;
|
||||
xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
|
||||
xGLXMakeCurrentReply reply ;
|
||||
DrawablePtr drawable=NULL;
|
||||
int rc=0;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
rc = dixLookupDrawable (&drawable,
|
||||
req->drawable,
|
||||
a_cl->client,
|
||||
0,
|
||||
DixReadAccess);
|
||||
EPHYR_RETURN_VAL_IF_FAIL (drawable, BadValue) ;
|
||||
EPHYR_RETURN_VAL_IF_FAIL (drawable->pScreen, BadValue) ;
|
||||
EPHYR_LOG ("screen nummber requested:%d\n",
|
||||
drawable->pScreen->myNum) ;
|
||||
|
||||
memset (&reply, 0, sizeof (reply)) ;
|
||||
if (!ephyrHostGLXMakeCurrent (hostx_get_window (drawable->pScreen->myNum),
|
||||
req->context,
|
||||
req->oldContextTag,
|
||||
(int*)&reply.contextTag)) {
|
||||
EPHYR_LOG_ERROR ("ephyrHostGLXMakeCurrent() failed\n") ;
|
||||
goto out;
|
||||
}
|
||||
reply.length = 0;
|
||||
reply.type = X_Reply;
|
||||
reply.sequenceNumber = a_cl->client->sequence;
|
||||
if (a_do_swap) {
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
__GLX_SWAP_SHORT(&reply.sequenceNumber);
|
||||
__GLX_SWAP_INT(&reply.length);
|
||||
__GLX_SWAP_INT(&reply.contextTag);
|
||||
}
|
||||
WriteToClient(a_cl->client, sz_xGLXMakeCurrentReply, (char *)&reply);
|
||||
|
||||
res = Success ;
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return res ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXMakeCurrent (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXMakeCurrentReal (a_cl, a_pc, FALSE) ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXMakeCurrentSwap (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXMakeCurrentReal (a_cl, a_pc, TRUE) ;
|
||||
}
|
||||
|
||||
static int
|
||||
ephyrGLXGetStringReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
|
||||
{
|
||||
ClientPtr client=NULL ;
|
||||
int context_tag=0, name=0, res=BadImplementation, length=0 ;
|
||||
char *string=NULL;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_cl && a_pc, BadValue) ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
client = a_cl->client ;
|
||||
|
||||
if (a_do_swap) {
|
||||
__GLX_SWAP_INT (a_pc + 4);
|
||||
__GLX_SWAP_INT (a_pc + __GLX_SINGLE_HDR_SIZE);
|
||||
}
|
||||
context_tag = __GLX_GET_SINGLE_CONTEXT_TAG (a_pc) ;
|
||||
a_pc += __GLX_SINGLE_HDR_SIZE;
|
||||
name = *(GLenum*)(a_pc + 0);
|
||||
EPHYR_LOG ("context_tag:%d, name:%d\n", context_tag, name) ;
|
||||
if (!ephyrHostGLXGetStringFromServer (context_tag,
|
||||
name,
|
||||
EPHYR_HOST_GLX_GetString,
|
||||
&string)) {
|
||||
EPHYR_LOG_ERROR ("failed to get string from server\n") ;
|
||||
goto out ;
|
||||
}
|
||||
if (string) {
|
||||
length = strlen (string) + 1;
|
||||
EPHYR_LOG ("got string:'%s', size:%d\n", string, length) ;
|
||||
} else {
|
||||
EPHYR_LOG ("got string: string (null)\n") ;
|
||||
}
|
||||
__GLX_BEGIN_REPLY (length);
|
||||
__GLX_PUT_SIZE (length);
|
||||
__GLX_SEND_HEADER ();
|
||||
if (a_do_swap) {
|
||||
__GLX_SWAP_REPLY_SIZE ();
|
||||
__GLX_SWAP_REPLY_HEADER ();
|
||||
}
|
||||
WriteToClient (client, length, (char *)string);
|
||||
|
||||
res = Success ;
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return res ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXGetString (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXGetStringReal (a_cl, a_pc, FALSE) ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXGetStringSwap (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXGetStringReal (a_cl, a_pc, TRUE) ;
|
||||
}
|
||||
|
||||
static int
|
||||
ephyrGLXGetIntegervReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
|
||||
{
|
||||
int res=BadImplementation;
|
||||
xGLXSingleReq * const req = (xGLXSingleReq *) a_pc;
|
||||
GLenum int_name ;
|
||||
int value=0 ;
|
||||
GLint answer_buf_room[200];
|
||||
GLint *buf=NULL ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
a_pc += __GLX_SINGLE_HDR_SIZE;
|
||||
|
||||
int_name = *(GLenum*) (a_pc+0) ;
|
||||
if (!ephyrHostGetIntegerValue (req->contextTag, int_name, &value)) {
|
||||
EPHYR_LOG_ERROR ("ephyrHostGetIntegerValue() failed\n") ;
|
||||
goto out ;
|
||||
}
|
||||
buf = __glXGetAnswerBuffer (a_cl, sizeof (value),
|
||||
answer_buf_room,
|
||||
sizeof (answer_buf_room),
|
||||
4) ;
|
||||
|
||||
if (!buf) {
|
||||
EPHYR_LOG_ERROR ("failed to allocate reply buffer\n") ;
|
||||
res = BadAlloc ;
|
||||
goto out ;
|
||||
}
|
||||
__glXSendReply (a_cl->client, buf, 1, sizeof (value), GL_FALSE, 0) ;
|
||||
res = Success ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return res ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXGetIntegerv (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXGetIntegervReal (a_cl, a_pc, FALSE) ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXGetIntegervSwap (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXGetIntegervReal (a_cl, a_pc, TRUE) ;
|
||||
}
|
||||
|
||||
static int
|
||||
ephyrGLXIsDirectReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
|
||||
{
|
||||
int res=BadImplementation;
|
||||
ClientPtr client = a_cl->client;
|
||||
xGLXIsDirectReq *req = (xGLXIsDirectReq *) a_pc;
|
||||
xGLXIsDirectReply reply;
|
||||
int is_direct=0 ;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_cl && a_pc, FALSE) ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
memset (&reply, 0, sizeof (reply)) ;
|
||||
if (!ephyrHostIsContextDirect (req->context, (int*)&is_direct)) {
|
||||
EPHYR_LOG_ERROR ("ephyrHostIsContextDirect() failed\n") ;
|
||||
goto out ;
|
||||
}
|
||||
reply.isDirect = is_direct ;
|
||||
reply.length = 0;
|
||||
reply.type = X_Reply;
|
||||
reply.sequenceNumber = client->sequence;
|
||||
WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
|
||||
res = Success ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return res ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXIsDirect (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXIsDirectReal (a_cl, a_pc, FALSE) ;
|
||||
}
|
||||
|
||||
int
|
||||
ephyrGLXIsDirectSwap (__GLXclientState *a_cl, GLbyte *a_pc)
|
||||
{
|
||||
return ephyrGLXIsDirectReal (a_cl, a_pc, TRUE) ;
|
||||
}
|
||||
|
||||
#endif /*XEPHYR_DRI*/
|
||||
|
||||
35
hw/kdrive/ephyr/ephyrglxext.h
Normal file
35
hw/kdrive/ephyr/ephyrglxext.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
#ifndef __EPHYR_GLXEXT_H__
|
||||
#define __EPHYR_GLXEXT_H__
|
||||
|
||||
#include <X11/Xdefs.h>
|
||||
Bool ephyrHijackGLXExtension (void) ;
|
||||
|
||||
#endif /*__EPHYR_GLXEXT_H__*/
|
||||
|
||||
687
hw/kdrive/ephyr/ephyrhostglx.c
Normal file
687
hw/kdrive/ephyr/ephyrhostglx.c
Normal file
|
|
@ -0,0 +1,687 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* a lots of the content of this file has been adapted from the mesa source
|
||||
* code.
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <kdrive-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/Xlibint.h>
|
||||
#include <GL/glx.h>
|
||||
#include <GL/internal/glcore.h>
|
||||
#include <GL/glxproto.h>
|
||||
#include <GL/glxint.h>
|
||||
#include "ephyrhostglx.h"
|
||||
#define _HAVE_XALLOC_DECLS
|
||||
#include "ephyrlog.h"
|
||||
#include "hostx.h"
|
||||
|
||||
#ifdef XEPHYR_DRI
|
||||
enum VisualConfRequestType {
|
||||
EPHYR_GET_FB_CONFIG,
|
||||
EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
|
||||
EPHYR_GET_VISUAL_CONFIGS
|
||||
|
||||
};
|
||||
|
||||
static Bool ephyrHostGLXGetVisualConfigsInternal
|
||||
(enum VisualConfRequestType a_type,
|
||||
int32_t a_screen,
|
||||
int32_t *a_num_visuals,
|
||||
int32_t *a_num_props,
|
||||
int32_t *a_props_buf_size,
|
||||
int32_t **a_props_buf);
|
||||
Bool
|
||||
ephyrHostGLXGetMajorOpcode (int *a_opcode)
|
||||
{
|
||||
Bool is_ok=FALSE ;
|
||||
Display *dpy=hostx_get_display () ;
|
||||
static int opcode ;
|
||||
int first_event_return=0, first_error_return=0;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
if (!opcode) {
|
||||
if (!XQueryExtension (dpy, GLX_EXTENSION_NAME, &opcode,
|
||||
&first_event_return, &first_error_return)) {
|
||||
EPHYR_LOG_ERROR ("XQueryExtension() failed\n") ;
|
||||
goto out ;
|
||||
}
|
||||
}
|
||||
*a_opcode = opcode ;
|
||||
is_ok = TRUE ;
|
||||
out:
|
||||
EPHYR_LOG ("release\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrHostGLXQueryVersion (int *a_major, int *a_minor)
|
||||
{
|
||||
Bool is_ok = FALSE ;
|
||||
Display *dpy = hostx_get_display () ;
|
||||
int major_opcode=0;
|
||||
xGLXQueryVersionReq *req=NULL;
|
||||
xGLXQueryVersionReply reply;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_major && a_minor, FALSE) ;
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
|
||||
EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
|
||||
goto out ;
|
||||
}
|
||||
EPHYR_LOG ("major opcode: %d\n", major_opcode) ;
|
||||
|
||||
/* Send the glXQueryVersion request */
|
||||
memset (&reply, 0, sizeof (reply)) ;
|
||||
LockDisplay (dpy);
|
||||
GetReq (GLXQueryVersion, req);
|
||||
req->reqType = major_opcode;
|
||||
req->glxCode = X_GLXQueryVersion;
|
||||
req->majorVersion = 2;
|
||||
req->minorVersion = 1;
|
||||
_XReply(dpy, (xReply*) &reply, 0, False);
|
||||
UnlockDisplay (dpy);
|
||||
SyncHandle ();
|
||||
|
||||
*a_major = reply.majorVersion ;
|
||||
*a_minor = reply.minorVersion ;
|
||||
|
||||
EPHYR_LOG ("major:%d, minor:%d\n", *a_major, *a_minor) ;
|
||||
|
||||
is_ok = TRUE ;
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
/**
|
||||
* GLX protocol structure for the ficticious "GXLGenericGetString" request.
|
||||
*
|
||||
* This is a non-existant protocol packet. It just so happens that all of
|
||||
* the real protocol packets used to request a string from the server have
|
||||
* an identical binary layout. The only difference between them is the
|
||||
* meaning of the \c for_whom field and the value of the \c glxCode.
|
||||
* (this has been copied from the mesa source code)
|
||||
*/
|
||||
typedef struct GLXGenericGetString {
|
||||
CARD8 reqType;
|
||||
CARD8 glxCode;
|
||||
CARD16 length B16;
|
||||
CARD32 for_whom B32;
|
||||
CARD32 name B32;
|
||||
} xGLXGenericGetStringReq;
|
||||
|
||||
/* These defines are only needed to make the GetReq macro happy.
|
||||
*/
|
||||
#define sz_xGLXGenericGetStringReq 12
|
||||
#define X_GLXGenericGetString 0
|
||||
|
||||
Bool
|
||||
ephyrHostGLXGetStringFromServer (int a_screen_number,
|
||||
int a_string_name,
|
||||
enum EphyrHostGLXGetStringOps a_op,
|
||||
char **a_string)
|
||||
{
|
||||
Bool is_ok=FALSE ;
|
||||
Display *dpy = hostx_get_display () ;
|
||||
xGLXGenericGetStringReq *req=NULL;
|
||||
xGLXSingleReply reply;
|
||||
int length=0, numbytes=0, major_opcode=0, get_string_op=0;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (dpy && a_string, FALSE) ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
switch (a_op) {
|
||||
case EPHYR_HOST_GLX_QueryServerString:
|
||||
get_string_op = X_GLXQueryServerString;
|
||||
break ;
|
||||
case EPHYR_HOST_GLX_GetString:
|
||||
get_string_op = X_GLsop_GetString;
|
||||
EPHYR_LOG ("Going to glXGetString. strname:%#x, ctxttag:%d\n",
|
||||
a_string_name, a_screen_number) ;
|
||||
break ;
|
||||
default:
|
||||
EPHYR_LOG_ERROR ("unknown EphyrHostGLXGetStringOp:%d\n", a_op) ;
|
||||
goto out ;
|
||||
}
|
||||
|
||||
if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
|
||||
EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
|
||||
goto out ;
|
||||
}
|
||||
EPHYR_LOG ("major opcode: %d\n", major_opcode) ;
|
||||
|
||||
LockDisplay (dpy);
|
||||
|
||||
/* All of the GLX protocol requests for getting a string from the server
|
||||
* look the same. The exact meaning of the a_for_whom field is usually
|
||||
* either the screen number (for glXQueryServerString) or the context tag
|
||||
* (for GLXSingle).
|
||||
*/
|
||||
GetReq (GLXGenericGetString, req);
|
||||
req->reqType = major_opcode;
|
||||
req->glxCode = get_string_op;
|
||||
req->for_whom = DefaultScreen (dpy);
|
||||
req->name = a_string_name;
|
||||
|
||||
_XReply (dpy, (xReply *)&reply, 0, False);
|
||||
|
||||
length = reply.length * 4;
|
||||
numbytes = reply.size;
|
||||
EPHYR_LOG ("going to get a string of size:%d\n", numbytes) ;
|
||||
|
||||
*a_string = (char *) Xmalloc (numbytes +1);
|
||||
if (!a_string) {
|
||||
EPHYR_LOG_ERROR ("allocation failed\n") ;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset (*a_string, 0, numbytes+1) ;
|
||||
if (_XRead (dpy, *a_string, numbytes)) {
|
||||
UnlockDisplay (dpy);
|
||||
SyncHandle ();
|
||||
EPHYR_LOG_ERROR ("read failed\n") ;
|
||||
goto out ;
|
||||
}
|
||||
length -= numbytes;
|
||||
_XEatData (dpy, length) ;
|
||||
UnlockDisplay (dpy);
|
||||
SyncHandle ();
|
||||
EPHYR_LOG ("strname:%#x, strvalue:'%s', strlen:%d\n",
|
||||
a_string_name, *a_string, numbytes) ;
|
||||
|
||||
is_ok = TRUE ;
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
static Bool
|
||||
ephyrHostGLXGetVisualConfigsInternal (enum VisualConfRequestType a_type,
|
||||
int32_t a_screen,
|
||||
int32_t *a_num_visuals,
|
||||
int32_t *a_num_props,
|
||||
int32_t *a_props_buf_size,
|
||||
int32_t **a_props_buf)
|
||||
{
|
||||
Bool is_ok = FALSE ;
|
||||
Display *dpy = hostx_get_display () ;
|
||||
xGLXGetVisualConfigsReq *req;
|
||||
xGLXGetFBConfigsReq *fb_req;
|
||||
xGLXVendorPrivateWithReplyReq *vpreq;
|
||||
xGLXGetFBConfigsSGIXReq *sgi_req;
|
||||
xGLXGetVisualConfigsReply reply;
|
||||
char *server_glx_version=NULL,
|
||||
*server_glx_extensions=NULL ;
|
||||
int j=0,
|
||||
screens=0,
|
||||
major_opcode=0,
|
||||
num_props=0,
|
||||
num_visuals=0,
|
||||
props_buf_size=0,
|
||||
props_per_visual_size=0;
|
||||
int32_t *props_buf=NULL;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
|
||||
|
||||
screens = ScreenCount (dpy);
|
||||
if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
|
||||
EPHYR_LOG_ERROR ("failed to get opcode\n") ;
|
||||
goto out ;
|
||||
}
|
||||
|
||||
LockDisplay(dpy);
|
||||
switch (a_type) {
|
||||
case EPHYR_GET_FB_CONFIG:
|
||||
GetReq(GLXGetFBConfigs,fb_req);
|
||||
fb_req->reqType = major_opcode;
|
||||
fb_req->glxCode = X_GLXGetFBConfigs;
|
||||
fb_req->screen = DefaultScreen (dpy);
|
||||
break;
|
||||
|
||||
case EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX:
|
||||
GetReqExtra(GLXVendorPrivateWithReply,
|
||||
sz_xGLXGetFBConfigsSGIXReq
|
||||
-
|
||||
sz_xGLXVendorPrivateWithReplyReq,
|
||||
vpreq);
|
||||
sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
|
||||
sgi_req->reqType = major_opcode;
|
||||
sgi_req->glxCode = X_GLXVendorPrivateWithReply;
|
||||
sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
|
||||
sgi_req->screen = DefaultScreen (dpy);
|
||||
break;
|
||||
|
||||
case EPHYR_GET_VISUAL_CONFIGS:
|
||||
GetReq(GLXGetVisualConfigs,req);
|
||||
req->reqType = major_opcode;
|
||||
req->glxCode = X_GLXGetVisualConfigs;
|
||||
req->screen = DefaultScreen (dpy);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
|
||||
EPHYR_LOG_ERROR ("unknown error\n") ;
|
||||
UnlockDisplay(dpy);
|
||||
goto out ;
|
||||
}
|
||||
if (!reply.numVisuals) {
|
||||
EPHYR_LOG_ERROR ("screen does not support GL rendering\n") ;
|
||||
UnlockDisplay(dpy);
|
||||
goto out ;
|
||||
}
|
||||
num_visuals = reply.numVisuals ;
|
||||
|
||||
/* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for
|
||||
* FIXME: FBconfigs?
|
||||
*/
|
||||
/* Check number of properties */
|
||||
num_props = reply.numProps;
|
||||
if ((num_props < __GLX_MIN_CONFIG_PROPS) ||
|
||||
(num_props > __GLX_MAX_CONFIG_PROPS)) {
|
||||
/* Huh? Not in protocol defined limits. Punt */
|
||||
EPHYR_LOG_ERROR ("got a bad reply to request\n") ;
|
||||
UnlockDisplay(dpy);
|
||||
goto out ;
|
||||
}
|
||||
|
||||
if (a_type != EPHYR_GET_VISUAL_CONFIGS) {
|
||||
num_props *= 2;
|
||||
}
|
||||
props_per_visual_size = num_props * __GLX_SIZE_INT32;
|
||||
props_buf_size = props_per_visual_size * reply.numVisuals;
|
||||
props_buf = malloc (props_buf_size) ;
|
||||
for (j = 0; j < reply.numVisuals; j++) {
|
||||
if (_XRead (dpy,
|
||||
&((char*)props_buf)[j*props_per_visual_size],
|
||||
props_per_visual_size) != Success) {
|
||||
EPHYR_LOG_ERROR ("read failed\n") ;
|
||||
}
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
|
||||
*a_num_visuals = num_visuals ;
|
||||
*a_num_props = reply.numProps ;
|
||||
*a_props_buf_size = props_buf_size ;
|
||||
*a_props_buf = props_buf ;
|
||||
is_ok = TRUE ;
|
||||
|
||||
out:
|
||||
if (server_glx_version) {
|
||||
XFree (server_glx_version) ;
|
||||
server_glx_version = NULL ;
|
||||
}
|
||||
if (server_glx_extensions) {
|
||||
XFree (server_glx_extensions) ;
|
||||
server_glx_extensions = NULL ;
|
||||
}
|
||||
SyncHandle () ;
|
||||
return is_ok;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrHostGLXGetVisualConfigs (int32_t a_screen,
|
||||
int32_t *a_num_visuals,
|
||||
int32_t *a_num_props,
|
||||
int32_t *a_props_buf_size,
|
||||
int32_t **a_props_buf)
|
||||
{
|
||||
Bool is_ok = FALSE;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
is_ok = ephyrHostGLXGetVisualConfigsInternal (EPHYR_GET_VISUAL_CONFIGS,
|
||||
a_screen,
|
||||
a_num_visuals,
|
||||
a_num_props,
|
||||
a_props_buf_size,
|
||||
a_props_buf) ;
|
||||
|
||||
EPHYR_LOG ("leave:%d\n", is_ok) ;
|
||||
return is_ok;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrHostGLXVendorPrivGetFBConfigsSGIX (int a_screen,
|
||||
int32_t *a_num_visuals,
|
||||
int32_t *a_num_props,
|
||||
int32_t *a_props_buf_size,
|
||||
int32_t **a_props_buf)
|
||||
{
|
||||
Bool is_ok=FALSE ;
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
is_ok = ephyrHostGLXGetVisualConfigsInternal
|
||||
(EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
|
||||
a_screen,
|
||||
a_num_visuals,
|
||||
a_num_props,
|
||||
a_props_buf_size,
|
||||
a_props_buf) ;
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrHostGLXSendClientInfo (int32_t a_major, int32_t a_minor,
|
||||
const char* a_extension_list)
|
||||
{
|
||||
Bool is_ok = FALSE ;
|
||||
Display *dpy = hostx_get_display () ;
|
||||
xGLXClientInfoReq *req;
|
||||
int size;
|
||||
int32_t major_opcode=0 ;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (dpy && a_extension_list, FALSE) ;
|
||||
|
||||
if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
|
||||
EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
|
||||
goto out ;
|
||||
}
|
||||
|
||||
LockDisplay (dpy);
|
||||
|
||||
GetReq (GLXClientInfo,req);
|
||||
req->reqType = major_opcode;
|
||||
req->glxCode = X_GLXClientInfo;
|
||||
req->major = a_major;
|
||||
req->minor = a_minor;
|
||||
|
||||
size = strlen (a_extension_list) + 1;
|
||||
req->length += (size + 3) >> 2;
|
||||
req->numbytes = size;
|
||||
Data (dpy, a_extension_list, size);
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
is_ok=TRUE ;
|
||||
|
||||
out:
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrHostGLXCreateContext (int a_screen,
|
||||
int a_visual_id,
|
||||
int a_context_id,
|
||||
int a_share_list_ctxt_id,
|
||||
Bool a_direct)
|
||||
{
|
||||
Bool is_ok = FALSE;
|
||||
Display *dpy = hostx_get_display ();
|
||||
int major_opcode=0, remote_context_id=0;
|
||||
xGLXCreateContextReq *req;
|
||||
|
||||
EPHYR_LOG ("enter. screen:%d, visual:%d, contextid:%d, direct:%d\n",
|
||||
a_screen, a_visual_id, a_context_id, a_direct) ;
|
||||
|
||||
if (!hostx_allocate_resource_id_peer (a_context_id, &remote_context_id)) {
|
||||
EPHYR_LOG_ERROR ("failed to peer the context id %d host X",
|
||||
remote_context_id) ;
|
||||
goto out ;
|
||||
}
|
||||
|
||||
if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
|
||||
EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
|
||||
goto out ;
|
||||
}
|
||||
|
||||
LockDisplay (dpy) ;
|
||||
|
||||
/* Send the glXCreateContext request */
|
||||
GetReq(GLXCreateContext,req);
|
||||
req->reqType = major_opcode;
|
||||
req->glxCode = X_GLXCreateContext;
|
||||
req->context = remote_context_id;
|
||||
req->visual = a_visual_id;
|
||||
req->screen = DefaultScreen (dpy);
|
||||
req->shareList = a_share_list_ctxt_id;
|
||||
req->isDirect = a_direct;
|
||||
|
||||
UnlockDisplay (dpy);
|
||||
SyncHandle ();
|
||||
|
||||
is_ok = TRUE ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrHostDestroyContext (int a_ctxt_id)
|
||||
{
|
||||
Bool is_ok=FALSE;
|
||||
Display *dpy=hostx_get_display ();
|
||||
int major_opcode=0, remote_ctxt_id=0 ;
|
||||
xGLXDestroyContextReq *req=NULL;
|
||||
|
||||
EPHYR_LOG ("enter:%d\n", a_ctxt_id) ;
|
||||
|
||||
if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
|
||||
EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
|
||||
goto out ;
|
||||
}
|
||||
if (!hostx_get_resource_id_peer (a_ctxt_id, &remote_ctxt_id)) {
|
||||
EPHYR_LOG_ERROR ("failed to get remote glx ctxt id\n") ;
|
||||
goto out ;
|
||||
}
|
||||
EPHYR_LOG ("host context id:%d\n", remote_ctxt_id) ;
|
||||
|
||||
LockDisplay (dpy);
|
||||
GetReq (GLXDestroyContext,req);
|
||||
req->reqType = major_opcode;
|
||||
req->glxCode = X_GLXDestroyContext;
|
||||
req->context = remote_ctxt_id;
|
||||
UnlockDisplay (dpy);
|
||||
SyncHandle ();
|
||||
|
||||
is_ok = TRUE ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrHostGLXMakeCurrent (int a_drawable,
|
||||
int a_glx_ctxt_id,
|
||||
int a_old_ctxt_tag,
|
||||
int *a_ctxt_tag)
|
||||
{
|
||||
Bool is_ok=FALSE ;
|
||||
Display *dpy = hostx_get_display () ;
|
||||
int32_t major_opcode=0 ;
|
||||
int remote_glx_ctxt_id=0 ;
|
||||
xGLXMakeCurrentReq *req;
|
||||
xGLXMakeCurrentReply reply;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_ctxt_tag, FALSE) ;
|
||||
|
||||
EPHYR_LOG ("enter. drawable:%d, context:%d, oldtag:%d\n",
|
||||
a_drawable, a_glx_ctxt_id, a_old_ctxt_tag) ;
|
||||
|
||||
if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
|
||||
EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
|
||||
goto out ;
|
||||
}
|
||||
if (!hostx_get_resource_id_peer (a_glx_ctxt_id, &remote_glx_ctxt_id)) {
|
||||
EPHYR_LOG_ERROR ("failed to get remote glx ctxt id\n") ;
|
||||
goto out ;
|
||||
}
|
||||
|
||||
LockDisplay (dpy);
|
||||
|
||||
GetReq (GLXMakeCurrent,req);
|
||||
req->reqType = major_opcode;
|
||||
req->glxCode = X_GLXMakeCurrent;
|
||||
req->drawable = a_drawable;
|
||||
req->context = remote_glx_ctxt_id;
|
||||
req->oldContextTag = a_old_ctxt_tag;
|
||||
|
||||
memset (&reply, 0, sizeof (reply)) ;
|
||||
if (!_XReply (dpy, (xReply*)&reply, 0, False)) {
|
||||
EPHYR_LOG_ERROR ("failed to get reply from host\n") ;
|
||||
UnlockDisplay (dpy);
|
||||
SyncHandle ();
|
||||
goto out ;
|
||||
}
|
||||
UnlockDisplay (dpy);
|
||||
SyncHandle ();
|
||||
*a_ctxt_tag = reply.contextTag ;
|
||||
EPHYR_LOG ("context tag:%d\n", *a_ctxt_tag) ;
|
||||
is_ok = TRUE ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
#define X_GLXSingle 0
|
||||
|
||||
#define __EPHYR_GLX_SINGLE_PUT_CHAR(offset,a) \
|
||||
*((INT8 *) (pc + offset)) = a
|
||||
|
||||
#define EPHYR_GLX_SINGLE_PUT_SHORT(offset,a) \
|
||||
*((INT16 *) (pc + offset)) = a
|
||||
|
||||
#define EPHYR_GLX_SINGLE_PUT_LONG(offset,a) \
|
||||
*((INT32 *) (pc + offset)) = a
|
||||
|
||||
#define EPHYR_GLX_SINGLE_PUT_FLOAT(offset,a) \
|
||||
*((FLOAT32 *) (pc + offset)) = a
|
||||
|
||||
#define EPHYR_GLX_SINGLE_READ_XREPLY() \
|
||||
(void) _XReply(dpy, (xReply*) &reply, 0, False)
|
||||
|
||||
#define EPHYR_GLX_SINGLE_GET_RETVAL(a,cast) \
|
||||
a = (cast) reply.retval
|
||||
|
||||
#define EPHYR_GLX_SINGLE_GET_SIZE(a) \
|
||||
a = (GLint) reply.size
|
||||
|
||||
#define EPHYR_GLX_SINGLE_GET_CHAR(p) \
|
||||
*p = *(GLbyte *)&reply.pad3;
|
||||
|
||||
#define EPHYR_GLX_SINGLE_GET_SHORT(p) \
|
||||
*p = *(GLshort *)&reply.pad3;
|
||||
|
||||
#define EPHYR_GLX_SINGLE_GET_LONG(p) \
|
||||
*p = *(GLint *)&reply.pad3;
|
||||
|
||||
#define EPHYR_GLX_SINGLE_GET_FLOAT(p) \
|
||||
*p = *(GLfloat *)&reply.pad3;
|
||||
|
||||
Bool
|
||||
ephyrHostGetIntegerValue (int a_current_context_tag, int a_int, int *a_val)
|
||||
{
|
||||
Bool is_ok=FALSE;
|
||||
Display *dpy = hostx_get_display () ;
|
||||
int major_opcode=0, size=0;
|
||||
xGLXSingleReq *req=NULL;
|
||||
xGLXSingleReply reply;
|
||||
unsigned char* pc=NULL ;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_val, FALSE) ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
|
||||
EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
|
||||
goto out ;
|
||||
}
|
||||
LockDisplay (dpy) ;
|
||||
GetReqExtra (GLXSingle, 4, req) ;
|
||||
req->reqType = major_opcode ;
|
||||
req->glxCode = X_GLsop_GetIntegerv ;
|
||||
req->contextTag = a_current_context_tag;
|
||||
pc = ((unsigned char *)(req) + sz_xGLXSingleReq) ;
|
||||
EPHYR_GLX_SINGLE_PUT_LONG (0, a_int) ;
|
||||
EPHYR_GLX_SINGLE_READ_XREPLY () ;
|
||||
EPHYR_GLX_SINGLE_GET_SIZE (size) ;
|
||||
if (!size) {
|
||||
UnlockDisplay (dpy) ;
|
||||
SyncHandle () ;
|
||||
EPHYR_LOG_ERROR ("X_GLsop_GetIngerv failed\n") ;
|
||||
goto out ;
|
||||
}
|
||||
EPHYR_GLX_SINGLE_GET_LONG (a_val) ;
|
||||
UnlockDisplay (dpy) ;
|
||||
SyncHandle () ;
|
||||
is_ok = TRUE ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrHostIsContextDirect (int a_ctxt_id,
|
||||
int *a_is_direct)
|
||||
{
|
||||
Bool is_ok=FALSE;
|
||||
Display *dpy = hostx_get_display () ;
|
||||
xGLXIsDirectReq *req=NULL;
|
||||
xGLXIsDirectReply reply;
|
||||
int major_opcode=0, remote_glx_ctxt_id=0;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
|
||||
EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
|
||||
goto out ;
|
||||
}
|
||||
if (!hostx_get_resource_id_peer (a_ctxt_id, &remote_glx_ctxt_id)) {
|
||||
EPHYR_LOG_ERROR ("failed to get remote glx ctxt id\n") ;
|
||||
goto out ;
|
||||
}
|
||||
memset (&reply, 0, sizeof (reply)) ;
|
||||
|
||||
/* Send the glXIsDirect request */
|
||||
LockDisplay (dpy);
|
||||
GetReq (GLXIsDirect,req);
|
||||
req->reqType = major_opcode;
|
||||
req->glxCode = X_GLXIsDirect;
|
||||
req->context = remote_glx_ctxt_id;
|
||||
if (!_XReply (dpy, (xReply*) &reply, 0, False)) {
|
||||
EPHYR_LOG_ERROR ("fail in reading reply from host\n") ;
|
||||
UnlockDisplay (dpy);
|
||||
SyncHandle ();
|
||||
goto out ;
|
||||
}
|
||||
UnlockDisplay (dpy);
|
||||
SyncHandle ();
|
||||
*a_is_direct = reply.isDirect ;
|
||||
is_ok = TRUE ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
#endif /*XEPHYR_DRI*/
|
||||
|
||||
76
hw/kdrive/ephyr/ephyrhostglx.h
Normal file
76
hw/kdrive/ephyr/ephyrhostglx.h
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
#ifndef __EPHYRHOSTGLX_H__
|
||||
#define __EPHYRHOSTGLX_H__
|
||||
|
||||
enum EphyrHostGLXGetStringOps {
|
||||
EPHYR_HOST_GLX_UNDEF,
|
||||
EPHYR_HOST_GLX_QueryServerString,
|
||||
EPHYR_HOST_GLX_GetString,
|
||||
};
|
||||
|
||||
Bool ephyrHostGLXQueryVersion (int *a_maj, int *a_min) ;
|
||||
Bool ephyrHostGLXGetStringFromServer (int a_screen_number,
|
||||
int a_string_name,
|
||||
enum EphyrHostGLXGetStringOps a_op,
|
||||
char **a_string) ;
|
||||
Bool ephyrHostGLXGetVisualConfigs (int a_screen,
|
||||
int32_t *a_num_visuals,
|
||||
int32_t *a_num_props,
|
||||
int32_t *a_props_buf_size,
|
||||
int32_t **a_props_buf) ;
|
||||
Bool
|
||||
ephyrHostGLXVendorPrivGetFBConfigsSGIX (int a_screen,
|
||||
int32_t *a_num_visuals,
|
||||
int32_t *a_num_props,
|
||||
int32_t *a_props_buf_size,
|
||||
int32_t **a_props_buf);
|
||||
Bool ephyrHostGLXGetMajorOpcode (int32_t *a_opcode) ;
|
||||
Bool ephyrHostGLXSendClientInfo (int32_t a_major, int32_t a_minor,
|
||||
const char* a_extension_list) ;
|
||||
Bool ephyrHostGLXCreateContext (int a_screen,
|
||||
int a_visual_id,
|
||||
int a_context_id,
|
||||
int a_shared_list_ctx_id,
|
||||
Bool a_direct) ;
|
||||
|
||||
Bool ephyrHostDestroyContext (int a_ctxt_id) ;
|
||||
|
||||
Bool ephyrHostGLXMakeCurrent (int a_drawable, int a_glx_ctxt_id,
|
||||
int a_olg_ctxt_tag, int *a_ctxt_tag) ;
|
||||
|
||||
Bool ephyrHostGetIntegerValue (int a_current_context_tag,
|
||||
int a_int,
|
||||
int *a_val) ;
|
||||
|
||||
Bool ephyrHostIsContextDirect (int a_ctxt_id,
|
||||
int *a_is_direct) ;
|
||||
|
||||
|
||||
#endif /*__EPHYRHOSTGLX_H__*/
|
||||
|
||||
94
hw/kdrive/ephyr/ephyrhostproxy.c
Normal file
94
hw/kdrive/ephyr/ephyrhostproxy.c
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <kdrive-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/Xlibint.h>
|
||||
#define _HAVE_XALLOC_DECLS
|
||||
#include "ephyrlog.h"
|
||||
#include "ephyrhostproxy.h"
|
||||
#include "hostx.h"
|
||||
|
||||
/* byte swap a short */
|
||||
#define swaps(x, n) { \
|
||||
n = ((char *) (x))[0];\
|
||||
((char *) (x))[0] = ((char *) (x))[1];\
|
||||
((char *) (x))[1] = n; }
|
||||
|
||||
#define GetXReq(req) \
|
||||
WORD64ALIGN ;\
|
||||
if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
|
||||
_XFlush(dpy);\
|
||||
req = (xReq *)(dpy->last_req = dpy->bufptr);\
|
||||
dpy->bufptr += SIZEOF(xReq);\
|
||||
dpy->request++
|
||||
|
||||
|
||||
Bool
|
||||
ephyrHostProxyDoForward (pointer a_request_buffer,
|
||||
struct XReply *a_reply,
|
||||
Bool a_do_swap)
|
||||
{
|
||||
Bool is_ok = FALSE ;
|
||||
int n=0 ;
|
||||
Display *dpy=hostx_get_display () ;
|
||||
xReq *in_req = (xReq*) a_request_buffer ;
|
||||
xReq *forward_req=NULL ;
|
||||
struct XReply reply ;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (in_req && dpy, FALSE) ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
if (a_do_swap) {
|
||||
swaps (&in_req->length, n) ;
|
||||
}
|
||||
EPHYR_LOG ("Req {type:%d, data:%d, length:%d}\n",
|
||||
in_req->reqType, in_req->data, in_req->length) ;
|
||||
GetXReq (forward_req) ;
|
||||
memmove (forward_req, in_req, 4) ;
|
||||
|
||||
if (!_XReply (dpy, (xReply*) &reply, 0, FALSE)) {
|
||||
EPHYR_LOG_ERROR ("failed to get reply\n") ;
|
||||
goto out;
|
||||
}
|
||||
EPHYR_LOG ("XReply{type:%d, foo:%d, seqnum:%d, length:%d}\n",
|
||||
reply.type, reply.foo, reply.sequence_number, reply.length) ;
|
||||
|
||||
if (a_reply) {
|
||||
memmove (a_reply, &reply, sizeof (reply)) ;
|
||||
}
|
||||
is_ok = TRUE ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
51
hw/kdrive/ephyr/ephyrhostproxy.h
Normal file
51
hw/kdrive/ephyr/ephyrhostproxy.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
|
||||
#ifndef __EPHYRHOSTPROXY_H__
|
||||
#define __EPHYRHOSTPROXY_H__
|
||||
|
||||
struct XReply {
|
||||
int8_t type ;/*X_Reply*/
|
||||
int8_t foo;
|
||||
int16_t sequence_number ;
|
||||
int32_t length ;
|
||||
/*following is some data up to 32 bytes lenght*/
|
||||
int32_t pad0 ;
|
||||
int32_t pad1 ;
|
||||
int32_t pad2 ;
|
||||
int32_t pad3 ;
|
||||
int32_t pad4 ;
|
||||
int32_t pad5 ;
|
||||
};
|
||||
|
||||
Bool
|
||||
ephyrHostProxyDoForward (pointer a_request_buffer,
|
||||
struct XReply *a_reply,
|
||||
Bool a_do_swap) ;
|
||||
|
||||
#endif /*__EPHYRHOSTPROXY_H__*/
|
||||
1004
hw/kdrive/ephyr/ephyrhostvideo.c
Normal file
1004
hw/kdrive/ephyr/ephyrhostvideo.c
Normal file
File diff suppressed because it is too large
Load diff
238
hw/kdrive/ephyr/ephyrhostvideo.h
Normal file
238
hw/kdrive/ephyr/ephyrhostvideo.h
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
#ifndef __EPHYRHOSTVIDEO_H__
|
||||
#define __EPHYRHOSTVIDEO_H__
|
||||
|
||||
typedef void* EphyrHostXVAdaptor ;
|
||||
typedef struct _EphyrHostXVAdaptorArray EphyrHostXVAdaptorArray ;
|
||||
|
||||
typedef struct _EphyrHostVideoFormat {
|
||||
char depth ;
|
||||
short visual_class;
|
||||
} EphyrHostVideoFormat ;
|
||||
|
||||
typedef struct _EphyrHostRational {
|
||||
int numerator ;
|
||||
int denominator ;
|
||||
} EphyrHostRational;
|
||||
|
||||
typedef struct _EphyrHostEncoding {
|
||||
int id ;
|
||||
char *name ;
|
||||
unsigned short width, height ;
|
||||
EphyrHostRational rate ;
|
||||
} EphyrHostEncoding ;
|
||||
|
||||
typedef struct _EphyrHostAttribute {
|
||||
int flags;
|
||||
int min_value;
|
||||
int max_value;
|
||||
char *name;
|
||||
} EphyrHostAttribute ;
|
||||
|
||||
typedef struct _EphyrHostImageFormat {
|
||||
int id; /* Unique descriptor for the format */
|
||||
int type; /* XvRGB, XvYUV */
|
||||
int byte_order; /* LSBFirst, MSBFirst */
|
||||
char guid[16]; /* Globally Unique IDentifier */
|
||||
int bits_per_pixel;
|
||||
int format; /* XvPacked, XvPlanar */
|
||||
int num_planes;
|
||||
|
||||
/* for RGB formats only */
|
||||
int depth;
|
||||
unsigned int red_mask;
|
||||
unsigned int green_mask;
|
||||
unsigned int blue_mask;
|
||||
|
||||
/* for YUV formats only */
|
||||
unsigned int y_sample_bits;
|
||||
unsigned int u_sample_bits;
|
||||
unsigned int v_sample_bits;
|
||||
unsigned int horz_y_period;
|
||||
unsigned int horz_u_period;
|
||||
unsigned int horz_v_period;
|
||||
unsigned int vert_y_period;
|
||||
unsigned int vert_u_period;
|
||||
unsigned int vert_v_period;
|
||||
char component_order[32]; /* eg. UYVY */
|
||||
int scanline_order; /* XvTopToBottom, XvBottomToTop */
|
||||
} EphyrHostImageFormat ;
|
||||
|
||||
typedef struct {
|
||||
unsigned short x1, y1, x2, y2 ;
|
||||
} EphyrHostBox ;
|
||||
|
||||
void ephyrHostXVInit (void) ;
|
||||
|
||||
void ephyrHostFree (void *a_pointer) ;
|
||||
|
||||
/*
|
||||
* host adaptor array
|
||||
*/
|
||||
Bool ephyrHostXVQueryAdaptors (EphyrHostXVAdaptorArray **a_adaptors) ;
|
||||
void ephyrHostXVAdaptorArrayDelete (EphyrHostXVAdaptorArray *a_adaptors) ;
|
||||
int ephyrHostXVAdaptorArrayGetSize (const EphyrHostXVAdaptorArray *a_this) ;
|
||||
EphyrHostXVAdaptor* ephyrHostXVAdaptorArrayAt (const EphyrHostXVAdaptorArray *a_this,
|
||||
int a_index) ;
|
||||
|
||||
/*
|
||||
* host adaptor
|
||||
*/
|
||||
|
||||
char ephyrHostXVAdaptorGetType (const EphyrHostXVAdaptor *a_this) ;
|
||||
const char* ephyrHostXVAdaptorGetName (const EphyrHostXVAdaptor *a_this) ;
|
||||
EphyrHostVideoFormat* ephyrHostXVAdaptorGetVideoFormats
|
||||
(const EphyrHostXVAdaptor *a_this,
|
||||
int *a_nb_formats) ;
|
||||
int ephyrHostXVAdaptorGetNbPorts (const EphyrHostXVAdaptor *a_this) ;
|
||||
int ephyrHostXVAdaptorGetFirstPortID (const EphyrHostXVAdaptor *a_this) ;
|
||||
|
||||
Bool ephyrHostXVAdaptorHasPutVideo (const EphyrHostXVAdaptor *a_this,
|
||||
Bool *a_result) ;
|
||||
Bool ephyrHostXVAdaptorHasGetVideo (const EphyrHostXVAdaptor *a_this,
|
||||
Bool *a_result) ;
|
||||
Bool ephyrHostXVAdaptorHasPutStill (const EphyrHostXVAdaptor *a_this,
|
||||
Bool *a_result) ;
|
||||
Bool ephyrHostXVAdaptorHasGetStill (const EphyrHostXVAdaptor *a_this,
|
||||
Bool *a_result) ;
|
||||
Bool ephyrHostXVAdaptorHasPutImage (const EphyrHostXVAdaptor *a_this,
|
||||
Bool *a_result) ;
|
||||
|
||||
/*
|
||||
* encoding
|
||||
*/
|
||||
Bool ephyrHostXVQueryEncodings (int a_port_id,
|
||||
EphyrHostEncoding **a_encodings,
|
||||
unsigned int *a_num_encodings) ;
|
||||
|
||||
void ephyrHostEncodingsDelete (EphyrHostEncoding *a_encodings,
|
||||
int a_num_encodings) ;
|
||||
|
||||
/*
|
||||
* attribute
|
||||
*/
|
||||
Bool ephyrHostXVQueryPortAttributes (int a_port_id,
|
||||
EphyrHostAttribute **a_attributes,
|
||||
int *a_num_attributes) ;
|
||||
|
||||
void ephyrHostAttributesDelete (EphyrHostAttribute *a_attributes) ;
|
||||
/*
|
||||
* image format
|
||||
*/
|
||||
|
||||
Bool ephyrHostXVQueryImageFormats (int a_port_id,
|
||||
EphyrHostImageFormat **a_formats,
|
||||
int *a_num_format) ;
|
||||
/*
|
||||
* Port Attribute Get/Set
|
||||
*/
|
||||
Bool ephyrHostXVSetPortAttribute (int a_port_id,
|
||||
int a_atom,
|
||||
int a_attr_value) ;
|
||||
Bool ephyrHostXVGetPortAttribute (int a_port_id,
|
||||
int a_atom,
|
||||
int *a_attr_value) ;
|
||||
/*
|
||||
*size query
|
||||
*/
|
||||
Bool ephyrHostXVQueryBestSize (int a_port_id,
|
||||
Bool a_motion,
|
||||
unsigned int a_frame_w,
|
||||
unsigned int a_frame_h,
|
||||
unsigned int a_drw_w,
|
||||
unsigned int a_drw_h,
|
||||
unsigned int *a_actual_w,
|
||||
unsigned int *a_actual_h) ;
|
||||
|
||||
Bool ephyrHostXVQueryImageAttributes (int a_port_id,
|
||||
int a_image_id /*image fourcc code*/,
|
||||
unsigned short *a_width,
|
||||
unsigned short *a_height,
|
||||
int *a_image_size,
|
||||
int *a_pitches,
|
||||
int *a_offsets) ;
|
||||
/*
|
||||
* atom
|
||||
*/
|
||||
Bool ephyrHostGetAtom (const char* a_name,
|
||||
Bool a_create_if_not_exists,
|
||||
int *a_atom) ;
|
||||
char* ephyrHostGetAtomName (int a_atom) ;
|
||||
|
||||
/*
|
||||
*PutImage
|
||||
* (ignore clipping for now)
|
||||
*/
|
||||
Bool ephyrHostXVPutImage (int a_screen_num,
|
||||
int a_port_id,
|
||||
int a_image_id,
|
||||
int a_drw_x,
|
||||
int a_drw_y,
|
||||
int a_drw_w,
|
||||
int a_drw_h,
|
||||
int a_src_x,
|
||||
int a_src_y,
|
||||
int a_src_w,
|
||||
int a_src_h,
|
||||
int a_image_width,
|
||||
int a_image_height,
|
||||
unsigned char *a_buf,
|
||||
EphyrHostBox *a_clip_rects,
|
||||
int a_clip_rect_nums) ;
|
||||
|
||||
/*
|
||||
* Putvideo/PutStill/GetVideo
|
||||
*/
|
||||
Bool ephyrHostXVPutVideo (int a_screen_num,
|
||||
int a_port_id,
|
||||
int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
|
||||
int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ;
|
||||
|
||||
Bool ephyrHostXVGetVideo (int a_screen_num,
|
||||
int a_port_id,
|
||||
int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
|
||||
int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ;
|
||||
|
||||
Bool ephyrHostXVPutStill (int a_screen_num,
|
||||
int a_port_id,
|
||||
int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
|
||||
int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ;
|
||||
|
||||
Bool ephyrHostXVGetStill (int a_screen_num,
|
||||
int a_port_id,
|
||||
int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
|
||||
int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ;
|
||||
|
||||
/*
|
||||
* StopVideo
|
||||
*/
|
||||
Bool ephyrHostXVStopVideo (int a_screen_num, int a_port_id) ;
|
||||
|
||||
#endif /*__EPHYRHOSTVIDEO_H__*/
|
||||
|
||||
|
|
@ -27,12 +27,21 @@
|
|||
#include <kdrive-config.h>
|
||||
#endif
|
||||
#include "ephyr.h"
|
||||
#include "ephyrlog.h"
|
||||
|
||||
extern Window EphyrPreExistingHostWin;
|
||||
extern Bool EphyrWantGrayScale;
|
||||
extern Bool kdHasPointer;
|
||||
extern Bool kdHasKbd;
|
||||
|
||||
#ifdef GLXEXT
|
||||
extern Bool ephyrNoDRI;
|
||||
extern Bool noGlxVisualInit;
|
||||
#endif
|
||||
extern Bool ephyrNoXV;
|
||||
|
||||
void processScreenArg (char *screen_size, char *parent_id) ;
|
||||
|
||||
void
|
||||
InitCard (char *name)
|
||||
{
|
||||
|
|
@ -90,29 +99,74 @@ ddxUseMsg (void)
|
|||
KdUseMsg();
|
||||
|
||||
ErrorF("\nXephyr Option Usage:\n");
|
||||
ErrorF("-parent XID Use existing window as Xephyr root win\n");
|
||||
ErrorF("-host-cursor Re-use exisiting X host server cursor\n");
|
||||
ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n");
|
||||
ErrorF("-grayscale Simulate 8bit grayscale\n");
|
||||
ErrorF("-fakexa Simulate acceleration using software rendering\n");
|
||||
ErrorF("-parent <XID> Use existing window as Xephyr root win\n");
|
||||
ErrorF("-host-cursor Re-use exisiting X host server cursor\n");
|
||||
ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n");
|
||||
ErrorF("-grayscale Simulate 8bit grayscale\n");
|
||||
ErrorF("-fakexa Simulate acceleration using software rendering\n");
|
||||
ErrorF("-verbosity <level> Set log verbosity level\n");
|
||||
#ifdef GLXEXT
|
||||
ErrorF("-nodri do not use DRI\n");
|
||||
#endif
|
||||
ErrorF("-noxv do not use XV\n");
|
||||
ErrorF("\n");
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
processScreenArg (char *screen_size, char *parent_id)
|
||||
{
|
||||
KdCardInfo *card;
|
||||
|
||||
InitCard (0); /*Put each screen on a separate card*/
|
||||
card = KdCardInfoLast ();
|
||||
|
||||
if (card)
|
||||
{
|
||||
KdScreenInfo *screen;
|
||||
unsigned long p_id = 0;
|
||||
|
||||
screen = KdScreenInfoAdd (card);
|
||||
KdParseScreen (screen, screen_size);
|
||||
|
||||
if (parent_id)
|
||||
{
|
||||
p_id = strtol (parent_id, NULL, 0);
|
||||
}
|
||||
EPHYR_DBG ("screen number:%d\n", screen->mynum) ;
|
||||
hostx_add_screen (screen, p_id, screen->mynum);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorF("No matching card found!\n");
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ddxProcessArgument (int argc, char **argv, int i)
|
||||
{
|
||||
EPHYR_DBG("mark");
|
||||
EPHYR_DBG("mark argv[%d]='%s'", i, argv[i] );
|
||||
|
||||
if (!strcmp (argv[i], "-parent"))
|
||||
{
|
||||
if(i+1 < argc)
|
||||
if(i+1 < argc)
|
||||
{
|
||||
hostx_use_preexisting_window(strtol(argv[i+1], NULL, 0));
|
||||
processScreenArg ("100x100", argv[i+1]);
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UseMsg();
|
||||
exit(1);
|
||||
}
|
||||
else if (!strcmp (argv[i], "-screen"))
|
||||
{
|
||||
if ((i+1) < argc)
|
||||
{
|
||||
processScreenArg (argv[i+1], NULL);
|
||||
return 2;
|
||||
}
|
||||
|
||||
UseMsg();
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -139,6 +193,36 @@ ddxProcessArgument (int argc, char **argv, int i)
|
|||
ephyrFuncs.finiAccel = ephyrDrawFini;
|
||||
return 1;
|
||||
}
|
||||
else if (!strcmp (argv[i], "-verbosity"))
|
||||
{
|
||||
if(i+1 < argc && argv[i+1][0] != '-')
|
||||
{
|
||||
int verbosity=atoi (argv[i+1]) ;
|
||||
LogSetParameter (XLOG_VERBOSITY, verbosity) ;
|
||||
EPHYR_LOG ("set verbosiry to %d\n", verbosity) ;
|
||||
return 2 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
UseMsg() ;
|
||||
exit(1) ;
|
||||
}
|
||||
}
|
||||
#ifdef GLXEXT
|
||||
else if (!strcmp (argv[i], "-nodri"))
|
||||
{
|
||||
noGlxVisualInit = FALSE ;
|
||||
ephyrNoDRI = TRUE ;
|
||||
EPHYR_LOG ("no direct rendering enabled\n") ;
|
||||
return 1 ;
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp (argv[i], "-noxv"))
|
||||
{
|
||||
ephyrNoXV = TRUE ;
|
||||
EPHYR_LOG ("no XVideo enabled\n") ;
|
||||
return 1 ;
|
||||
}
|
||||
else if (argv[i][0] == ':')
|
||||
{
|
||||
hostx_set_display_name(argv[i]);
|
||||
|
|
@ -198,8 +282,10 @@ miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
|
|||
Bool
|
||||
ephyrCursorInit(ScreenPtr pScreen)
|
||||
{
|
||||
miPointerInitialize(pScreen, &EphyrPointerSpriteFuncs,
|
||||
&kdPointerScreenFuncs, FALSE);
|
||||
miPointerInitialize(pScreen,
|
||||
&EphyrPointerSpriteFuncs,
|
||||
&ephyrPointerScreenFuncs,
|
||||
FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
67
hw/kdrive/ephyr/ephyrlog.h
Normal file
67
hw/kdrive/ephyr/ephyrlog.h
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
#ifndef __EPHYRLOG_H__
|
||||
#define __EPHYRLOG_H__
|
||||
|
||||
#include <assert.h>
|
||||
#include "os.h"
|
||||
|
||||
#ifdef NDEBUG
|
||||
/*we are not in debug mode*/
|
||||
#define EPHYR_LOG
|
||||
#define EPHYR_LOG_ERROR
|
||||
#endif /*NDEBUG*/
|
||||
|
||||
#define ERROR_LOG_LEVEL 3
|
||||
#define INFO_LOG_LEVEL 4
|
||||
|
||||
#ifndef EPHYR_LOG
|
||||
#define EPHYR_LOG(...) \
|
||||
LogMessageVerb(X_NOTICE, INFO_LOG_LEVEL, "in %s:%d:%s: ",\
|
||||
__FILE__, __LINE__, __func__) ; \
|
||||
LogMessageVerb(X_NOTICE, INFO_LOG_LEVEL, __VA_ARGS__)
|
||||
#endif /*nomadik_log*/
|
||||
|
||||
#ifndef EPHYR_LOG_ERROR
|
||||
#define EPHYR_LOG_ERROR(...) \
|
||||
LogMessageVerb(X_NOTICE, ERROR_LOG_LEVEL, "Error:in %s:%d:%s: ",\
|
||||
__FILE__, __LINE__, __func__) ; \
|
||||
LogMessageVerb(X_NOTICE, ERROR_LOG_LEVEL, __VA_ARGS__)
|
||||
#endif /*EPHYR_LOG_ERROR*/
|
||||
|
||||
#ifndef EPHYR_RETURN_IF_FAIL
|
||||
#define EPHYR_RETURN_IF_FAIL(cond) \
|
||||
if (!(cond)) {EPHYR_LOG_ERROR("condition %s failed\n", #cond);return;}
|
||||
#endif /*nomadik_return_if_fail*/
|
||||
|
||||
#ifndef EPHYR_RETURN_VAL_IF_FAIL
|
||||
#define EPHYR_RETURN_VAL_IF_FAIL(cond,val) \
|
||||
if (!(cond)) {EPHYR_LOG_ERROR("condition %s failed\n", #cond);return val;}
|
||||
#endif /*nomadik_return_val_if_fail*/
|
||||
|
||||
#endif /*__EPHYRLOG_H__*/
|
||||
119
hw/kdrive/ephyr/ephyrproxyext.c
Normal file
119
hw/kdrive/ephyr/ephyrproxyext.c
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* \file
|
||||
* This file defines a proxy extension that forwards requests.
|
||||
* When a request to extension FOO is sent to Xephyr, that request is forwared
|
||||
* to the host X, without even trying to know what the request means.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <kdrive-config.h>
|
||||
#endif
|
||||
|
||||
#include "misc.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "ephyrproxyext.h"
|
||||
#define _HAVE_XALLOC_DECLS
|
||||
#include "ephyrlog.h"
|
||||
#include "ephyrhostproxy.h"
|
||||
#include "hostx.h"
|
||||
|
||||
static Bool ephyrProxyGetHostExtensionInfo (const char *a_ext_name,
|
||||
int *a_major_opcode,
|
||||
int *a_first_event,
|
||||
int *a_first_error) ;
|
||||
|
||||
static int ephyrProxyProcDispatch (ClientPtr client) ;
|
||||
|
||||
static Bool
|
||||
ephyrProxyGetHostExtensionInfo (const char *a_ext_name,
|
||||
int *a_major_opcode,
|
||||
int *a_first_event,
|
||||
int *a_first_error)
|
||||
{
|
||||
return hostx_get_extension_info (a_ext_name, a_major_opcode,
|
||||
a_first_event, a_first_error) ;
|
||||
}
|
||||
|
||||
static int
|
||||
ephyrProxyProcDispatch (ClientPtr a_client)
|
||||
{
|
||||
int res=BadImplementation ;
|
||||
struct XReply reply ;
|
||||
|
||||
if (!ephyrHostProxyDoForward (a_client->requestBuffer, &reply, FALSE)) {
|
||||
EPHYR_LOG_ERROR ("forwarding failed\n") ;
|
||||
goto out ;
|
||||
}
|
||||
reply.sequence_number = a_client->sequence;
|
||||
res = Success ;
|
||||
|
||||
WriteToClient(a_client, 32, (char *)&reply);
|
||||
|
||||
out:
|
||||
return res ;
|
||||
}
|
||||
|
||||
static void
|
||||
ephyrProxyProcReset (ExtensionEntry *a_entry)
|
||||
{
|
||||
}
|
||||
|
||||
Bool
|
||||
ephyrProxyExtensionInit (const char *a_extension_name)
|
||||
{
|
||||
Bool is_ok = FALSE ;
|
||||
int major_opcode=0, first_event=0, first_error=0;
|
||||
ExtensionEntry *ext=NULL ;
|
||||
|
||||
if (!ephyrProxyGetHostExtensionInfo (a_extension_name,
|
||||
&major_opcode,
|
||||
&first_event,
|
||||
&first_error)) {
|
||||
EPHYR_LOG ("failed to query extension %s from host\n", a_extension_name) ;
|
||||
goto out;
|
||||
}
|
||||
ext = AddExtension ((char*)a_extension_name, 0, 0,
|
||||
ephyrProxyProcDispatch,
|
||||
ephyrProxyProcDispatch,
|
||||
ephyrProxyProcReset,
|
||||
StandardMinorOpcode) ;
|
||||
if (!ext) {
|
||||
EPHYR_LOG_ERROR ("failed to add the extension\n") ;
|
||||
goto out ;
|
||||
}
|
||||
is_ok = TRUE ;
|
||||
|
||||
out:
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
34
hw/kdrive/ephyr/ephyrproxyext.h
Normal file
34
hw/kdrive/ephyr/ephyrproxyext.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Xephyr - A kdrive X server thats runs in a host X window.
|
||||
* Authored by Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright © 2007 OpenedHand Ltd
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of OpenedHand Ltd not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. OpenedHand Ltd makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Dodji Seketeli <dodji@openedhand.com>
|
||||
*/
|
||||
#ifndef __EPHYRPROXYEXT_H__
|
||||
#define __EPHYRPROXYEXT_H__
|
||||
|
||||
Bool ephyrProxyExtensionInit (const char *a_extension_name) ;
|
||||
|
||||
#endif /*__EPHYRPROXYEXT_H__*/
|
||||
|
||||
1278
hw/kdrive/ephyr/ephyrvideo.c
Normal file
1278
hw/kdrive/ephyr/ephyrvideo.c
Normal file
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue