Merge branch 'master' into XACE-SELINUX
Conflicts: dix/privates.c
This commit is contained in:
commit
1f06d32ef5
|
@ -46,12 +46,13 @@ libglx_la_SOURCES = \
|
||||||
glxdrawable.h \
|
glxdrawable.h \
|
||||||
glxext.c \
|
glxext.c \
|
||||||
glxext.h \
|
glxext.h \
|
||||||
glxvisuals.c \
|
glxglcore.c \
|
||||||
glxscreens.c \
|
glxscreens.c \
|
||||||
glxscreens.h \
|
glxscreens.h \
|
||||||
glxserver.h \
|
glxserver.h \
|
||||||
glxutil.c \
|
glxutil.c \
|
||||||
glxutil.h \
|
glxutil.h \
|
||||||
|
glxvisuals.c \
|
||||||
indirect_dispatch.c \
|
indirect_dispatch.c \
|
||||||
indirect_dispatch.h \
|
indirect_dispatch.h \
|
||||||
indirect_dispatch_swap.c \
|
indirect_dispatch_swap.c \
|
||||||
|
|
|
@ -40,9 +40,6 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* XXX: should be defined somewhere globally */
|
|
||||||
#define CAPI
|
|
||||||
|
|
||||||
#include "GL/internal/glcore.h"
|
#include "GL/internal/glcore.h"
|
||||||
|
|
||||||
typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
|
typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
|
||||||
|
|
|
@ -829,12 +829,16 @@ static Bool
|
||||||
glxDRIEnterVT (int index, int flags)
|
glxDRIEnterVT (int index, int flags)
|
||||||
{
|
{
|
||||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(index);
|
__GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(index);
|
||||||
|
Bool ret;
|
||||||
|
|
||||||
LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
|
LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
|
||||||
|
|
||||||
|
if (!(*screen->enterVT) (index, flags))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
glxResumeClients();
|
glxResumeClients();
|
||||||
|
|
||||||
return (*screen->enterVT) (index, flags);
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -45,7 +45,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <glxdrawable.h>
|
#include <glxdrawable.h>
|
||||||
#include <glxcontext.h>
|
#include <glxcontext.h>
|
||||||
#include <glxutil.h>
|
#include <glxutil.h>
|
||||||
#include "xmesaP.h"
|
|
||||||
|
|
||||||
#include "glcontextmodes.h"
|
#include "glcontextmodes.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
|
@ -40,9 +40,6 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* XXX: should be defined somewhere globally */
|
|
||||||
#define CAPI
|
|
||||||
|
|
||||||
#include "GL/internal/glcore.h"
|
#include "GL/internal/glcore.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -639,7 +639,7 @@ __glGetBooleanv_size(GLenum e)
|
||||||
case GL_PROGRAM_ERROR_POSITION_ARB:
|
case GL_PROGRAM_ERROR_POSITION_ARB:
|
||||||
case GL_DEPTH_CLAMP_NV:
|
case GL_DEPTH_CLAMP_NV:
|
||||||
case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
|
case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
|
||||||
/* case GL_NUM_TEXTURE_COMPRESSED_FORMATS_ARB:*/
|
/* case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:*/
|
||||||
case GL_MAX_VERTEX_UNITS_ARB:
|
case GL_MAX_VERTEX_UNITS_ARB:
|
||||||
case GL_ACTIVE_VERTEX_UNITS_ARB:
|
case GL_ACTIVE_VERTEX_UNITS_ARB:
|
||||||
case GL_WEIGHT_SUM_UNITY_ARB:
|
case GL_WEIGHT_SUM_UNITY_ARB:
|
||||||
|
@ -699,6 +699,8 @@ __glGetBooleanv_size(GLenum e)
|
||||||
/* case GL_POINT_SPRITE_NV:*/
|
/* case GL_POINT_SPRITE_NV:*/
|
||||||
case GL_POINT_SPRITE_R_MODE_NV:
|
case GL_POINT_SPRITE_R_MODE_NV:
|
||||||
case GL_MAX_VERTEX_ATTRIBS_ARB:
|
case GL_MAX_VERTEX_ATTRIBS_ARB:
|
||||||
|
case GL_MAX_TEXTURE_COORDS_ARB:
|
||||||
|
case GL_MAX_TEXTURE_IMAGE_UNITS_ARB:
|
||||||
case GL_DEPTH_BOUNDS_TEST_EXT:
|
case GL_DEPTH_BOUNDS_TEST_EXT:
|
||||||
case GL_STENCIL_TEST_TWO_SIDE_EXT:
|
case GL_STENCIL_TEST_TWO_SIDE_EXT:
|
||||||
case GL_ACTIVE_STENCIL_FACE_EXT:
|
case GL_ACTIVE_STENCIL_FACE_EXT:
|
||||||
|
@ -1005,8 +1007,6 @@ __glGetProgramivARB_size(GLenum e)
|
||||||
case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
|
case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
|
||||||
case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
|
case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
|
||||||
case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB:
|
case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB:
|
||||||
case GL_MAX_TEXTURE_COORDS_ARB:
|
|
||||||
case GL_MAX_TEXTURE_IMAGE_UNITS_ARB:
|
|
||||||
case GL_PROGRAM_FORMAT_ARB:
|
case GL_PROGRAM_FORMAT_ARB:
|
||||||
case GL_PROGRAM_INSTRUCTIONS_ARB:
|
case GL_PROGRAM_INSTRUCTIONS_ARB:
|
||||||
case GL_MAX_PROGRAM_INSTRUCTIONS_ARB:
|
case GL_MAX_PROGRAM_INSTRUCTIONS_ARB:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
X/drivers
|
X/drivers
|
||||||
X/glxheader.h
|
X/glxheader.h
|
||||||
X/xmesaP.h
|
X/xm*.h
|
||||||
X/xm*.c
|
X/xm*.c
|
||||||
mesa/drivers
|
mesa/drivers
|
||||||
mesa/glxheader.h
|
mesa/glxheader.h
|
||||||
|
|
|
@ -22,14 +22,11 @@ AM_CFLAGS = \
|
||||||
-DXFree86Server \
|
-DXFree86Server \
|
||||||
@GLX_DEFINES@
|
@GLX_DEFINES@
|
||||||
|
|
||||||
libX_la_SOURCES = xf86glx.c \
|
|
||||||
xf86glx_util.c \
|
|
||||||
xf86glx_util.h
|
|
||||||
|
|
||||||
nodist_libX_la_SOURCES = \
|
nodist_libX_la_SOURCES = \
|
||||||
xm_api.c \
|
xm_api.c \
|
||||||
xm_buffer.c \
|
xm_buffer.c \
|
||||||
xm_dd.c \
|
xm_dd.c \
|
||||||
|
xm_image.c \
|
||||||
xm_line.c \
|
xm_line.c \
|
||||||
xm_span.c \
|
xm_span.c \
|
||||||
xm_tri.c \
|
xm_tri.c \
|
||||||
|
|
|
@ -1,149 +0,0 @@
|
||||||
/**************************************************************************
|
|
||||||
|
|
||||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
|
||||||
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 <kevin@precisioninsight.com>
|
|
||||||
* Brian Paul <brian@precisioninsight.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "xf86glx_util.h"
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
|
|
||||||
#ifdef ROUNDUP
|
|
||||||
#undef ROUNDUP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3))
|
|
||||||
|
|
||||||
XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height, char *data)
|
|
||||||
{
|
|
||||||
XMesaImage *image;
|
|
||||||
|
|
||||||
image = (XMesaImage *)xalloc(sizeof(XMesaImage));
|
|
||||||
|
|
||||||
if (image) {
|
|
||||||
image->width = width;
|
|
||||||
image->height = height;
|
|
||||||
image->data = data;
|
|
||||||
/* Always pad to 32 bits */
|
|
||||||
image->bytes_per_line = ROUNDUP((bitsPerPixel * width), 32);
|
|
||||||
image->bits_per_pixel = bitsPerPixel;
|
|
||||||
}
|
|
||||||
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
void XMesaDestroyImage(XMesaImage *image)
|
|
||||||
{
|
|
||||||
if (image->data)
|
|
||||||
free(image->data);
|
|
||||||
xfree(image);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long XMesaGetPixel(XMesaImage *image, int x, int y)
|
|
||||||
{
|
|
||||||
CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line);
|
|
||||||
CARD8 *i8;
|
|
||||||
CARD16 *i16;
|
|
||||||
CARD32 *i32;
|
|
||||||
switch (image->bits_per_pixel) {
|
|
||||||
case 8:
|
|
||||||
i8 = (CARD8 *)row;
|
|
||||||
return i8[x];
|
|
||||||
break;
|
|
||||||
case 15:
|
|
||||||
case 16:
|
|
||||||
i16 = (CARD16 *)row;
|
|
||||||
return i16[x];
|
|
||||||
break;
|
|
||||||
case 24: /* WARNING: architecture specific code */
|
|
||||||
i8 = (CARD8 *)row;
|
|
||||||
return (((CARD32)i8[x*3]) |
|
|
||||||
(((CARD32)i8[x*3+1])<<8) |
|
|
||||||
(((CARD32)i8[x*3+2])<<16));
|
|
||||||
break;
|
|
||||||
case 32:
|
|
||||||
i32 = (CARD32 *)row;
|
|
||||||
return i32[x];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef XMESA_USE_PUTPIXEL_MACRO
|
|
||||||
void XMesaPutPixel(XMesaImage *image, int x, int y, unsigned long pixel)
|
|
||||||
{
|
|
||||||
CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line);
|
|
||||||
CARD8 *i8;
|
|
||||||
CARD16 *i16;
|
|
||||||
CARD32 *i32;
|
|
||||||
switch (image->bits_per_pixel) {
|
|
||||||
case 8:
|
|
||||||
i8 = (CARD8 *)row;
|
|
||||||
i8[x] = (CARD8)pixel;
|
|
||||||
break;
|
|
||||||
case 15:
|
|
||||||
case 16:
|
|
||||||
i16 = (CARD16 *)row;
|
|
||||||
i16[x] = (CARD16)pixel;
|
|
||||||
break;
|
|
||||||
case 24: /* WARNING: architecture specific code */
|
|
||||||
i8 = (CARD8 *)__row;
|
|
||||||
i8[x*3] = (CARD8)(p);
|
|
||||||
i8[x*3+1] = (CARD8)(p>>8);
|
|
||||||
i8[x*3+2] = (CARD8)(p>>16);
|
|
||||||
case 32:
|
|
||||||
i32 = (CARD32 *)row;
|
|
||||||
i32[x] = (CARD32)pixel;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void XMesaPutImageHelper(ScreenPtr display,
|
|
||||||
DrawablePtr d, GCPtr gc,
|
|
||||||
XMesaImage *image,
|
|
||||||
int src_x, int src_y,
|
|
||||||
int dest_x, int dest_y,
|
|
||||||
unsigned int width, unsigned int height)
|
|
||||||
{
|
|
||||||
/* NOT_DONE: Verify that the following works for all depths */
|
|
||||||
char *src = (image->data +
|
|
||||||
src_y * image->bytes_per_line +
|
|
||||||
((src_x * image->bits_per_pixel) >> 3));
|
|
||||||
|
|
||||||
ValidateGC(d, gc);
|
|
||||||
(*gc->ops->PutImage)(d, gc, d->depth, dest_x, dest_y, width, height,
|
|
||||||
0, ZPixmap, src);
|
|
||||||
}
|
|
|
@ -1,105 +0,0 @@
|
||||||
/**************************************************************************
|
|
||||||
|
|
||||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
|
||||||
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 <kevin@precisioninsight.com>
|
|
||||||
* Brian Paul <brian@precisioninsight.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _XF86GLX_UTIL_H_
|
|
||||||
#define _XF86GLX_UTIL_H_
|
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
|
||||||
#undef WIN32
|
|
||||||
#undef _WIN32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <screenint.h>
|
|
||||||
#include <pixmap.h>
|
|
||||||
#include <gc.h>
|
|
||||||
#include "GL/xmesa.h"
|
|
||||||
|
|
||||||
#define XMESA_USE_PUTPIXEL_MACRO
|
|
||||||
|
|
||||||
struct _XMesaImageRec {
|
|
||||||
int width, height;
|
|
||||||
char *data;
|
|
||||||
int bytes_per_line; /* Padded to 32 bits */
|
|
||||||
int bits_per_pixel;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height,
|
|
||||||
char *data);
|
|
||||||
extern void XMesaDestroyImage(XMesaImage *image);
|
|
||||||
extern unsigned long XMesaGetPixel(XMesaImage *image, int x, int y);
|
|
||||||
#ifdef XMESA_USE_PUTPIXEL_MACRO
|
|
||||||
#define XMesaPutPixel(__i,__x,__y,__p) \
|
|
||||||
{ \
|
|
||||||
CARD8 *__row = (CARD8 *)(__i->data + __y*__i->bytes_per_line); \
|
|
||||||
CARD8 *__i8; \
|
|
||||||
CARD16 *__i16; \
|
|
||||||
CARD32 *__i32; \
|
|
||||||
switch (__i->bits_per_pixel) { \
|
|
||||||
case 8: \
|
|
||||||
__i8 = (CARD8 *)__row; \
|
|
||||||
__i8[__x] = (CARD8)__p; \
|
|
||||||
break; \
|
|
||||||
case 15: \
|
|
||||||
case 16: \
|
|
||||||
__i16 = (CARD16 *)__row; \
|
|
||||||
__i16[__x] = (CARD16)__p; \
|
|
||||||
break; \
|
|
||||||
case 24: /* WARNING: architecture specific code */ \
|
|
||||||
__i8 = (CARD8 *)__row; \
|
|
||||||
__i8[__x*3] = (CARD8)(__p); \
|
|
||||||
__i8[__x*3+1] = (CARD8)(__p>>8); \
|
|
||||||
__i8[__x*3+2] = (CARD8)(__p>>16); \
|
|
||||||
break; \
|
|
||||||
case 32: \
|
|
||||||
__i32 = (CARD32 *)__row; \
|
|
||||||
__i32[__x] = (CARD32)__p; \
|
|
||||||
break; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
extern void XMesaPutPixel(XMesaImage *image, int x, int y,
|
|
||||||
unsigned long pixel);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void XMesaPutImageHelper(ScreenPtr display,
|
|
||||||
DrawablePtr d, GCPtr gc,
|
|
||||||
XMesaImage *image,
|
|
||||||
int src_x, int src_y,
|
|
||||||
int dest_x, int dest_y,
|
|
||||||
unsigned int width, unsigned int height);
|
|
||||||
|
|
||||||
#endif /* _XF86GLX_UTIL_H_ */
|
|
|
@ -21,8 +21,6 @@ INCLUDES = -I@MESA_SOURCE@/include \
|
||||||
nodist_libtnl_la_SOURCES = t_context.c \
|
nodist_libtnl_la_SOURCES = t_context.c \
|
||||||
t_draw.c \
|
t_draw.c \
|
||||||
t_pipeline.c \
|
t_pipeline.c \
|
||||||
t_vb_arbprogram.c \
|
|
||||||
t_vb_arbprogram_sse.c \
|
|
||||||
t_vb_cull.c \
|
t_vb_cull.c \
|
||||||
t_vb_fog.c \
|
t_vb_fog.c \
|
||||||
t_vb_light.c \
|
t_vb_light.c \
|
||||||
|
|
|
@ -168,6 +168,8 @@ symlink_mesa_x() {
|
||||||
action xm_api.c
|
action xm_api.c
|
||||||
action xm_buffer.c
|
action xm_buffer.c
|
||||||
action xm_dd.c
|
action xm_dd.c
|
||||||
|
action xm_image.c
|
||||||
|
action xm_image.h
|
||||||
action xm_line.c
|
action xm_line.c
|
||||||
action xm_span.c
|
action xm_span.c
|
||||||
action xm_tri.c
|
action xm_tri.c
|
||||||
|
|
|
@ -2509,7 +2509,7 @@ ServertimeBracketValues(pCounter, pbracket_less, pbracket_greater)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SyncInitServerTime()
|
SyncInitServerTime(void)
|
||||||
{
|
{
|
||||||
CARD64 resolution;
|
CARD64 resolution;
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
XvExtensionInit()
|
XvExtensionInit(void)
|
||||||
{
|
{
|
||||||
ExtensionEntry *extEntry;
|
ExtensionEntry *extEntry;
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ XvExtensionInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
CreateResourceTypes()
|
CreateResourceTypes(void)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -335,13 +335,13 @@ XvResetProc(ExtensionEntry* extEntry)
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
XvGetScreenIndex()
|
XvGetScreenIndex(void)
|
||||||
{
|
{
|
||||||
return XvScreenIndex;
|
return XvScreenIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT unsigned long
|
_X_EXPORT unsigned long
|
||||||
XvGetRTPort()
|
XvGetRTPort(void)
|
||||||
{
|
{
|
||||||
return XvRTPort;
|
return XvRTPort;
|
||||||
}
|
}
|
||||||
|
|
|
@ -675,7 +675,7 @@ SProcXvMCDispatch (ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
XvMCExtensionInit()
|
XvMCExtensionInit(void)
|
||||||
{
|
{
|
||||||
ExtensionEntry *extEntry;
|
ExtensionEntry *extEntry;
|
||||||
|
|
||||||
|
|
14
Xi/stubs.c
14
Xi/stubs.c
|
@ -226,7 +226,19 @@ ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
NewInputDeviceRequest(InputOption *options)
|
NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
|
||||||
{
|
{
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
*
|
||||||
|
* Caller: configRemoveDevice (and others)
|
||||||
|
*
|
||||||
|
* Remove the specified device previously added.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
DeleteInputDeviceRequest(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
113
config/config.c
113
config/config.c
|
@ -92,12 +92,15 @@ configTeardown(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error)
|
configAddDevice(DBusMessage *message, DBusMessageIter *iter,
|
||||||
|
DBusMessage *reply, DBusMessageIter *r_iter,
|
||||||
|
DBusError *error)
|
||||||
{
|
{
|
||||||
DBusMessageIter subiter;
|
DBusMessageIter subiter;
|
||||||
InputOption *tmpo = NULL, *options = NULL;
|
InputOption *tmpo = NULL, *options = NULL;
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
int ret = BadMatch;
|
int ret = BadMatch;
|
||||||
|
DeviceIntPtr dev = NULL;
|
||||||
|
|
||||||
DebugF("[config] adding device\n");
|
DebugF("[config] adding device\n");
|
||||||
|
|
||||||
|
@ -110,6 +113,11 @@ configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error)
|
||||||
|
|
||||||
options->key = xstrdup("_source");
|
options->key = xstrdup("_source");
|
||||||
options->value = xstrdup("client/dbus");
|
options->value = xstrdup("client/dbus");
|
||||||
|
if(!options->key || !options->value) {
|
||||||
|
ErrorF("[config] couldn't allocate first key/value pair\n");
|
||||||
|
ret = BadAlloc;
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
|
|
||||||
while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_ARRAY) {
|
while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_ARRAY) {
|
||||||
tmpo = (InputOption *) xcalloc(sizeof(InputOption), 1);
|
tmpo = (InputOption *) xcalloc(sizeof(InputOption), 1);
|
||||||
|
@ -118,6 +126,8 @@ configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error)
|
||||||
ret = BadAlloc;
|
ret = BadAlloc;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
tmpo->next = options;
|
||||||
|
options = tmpo;
|
||||||
|
|
||||||
dbus_message_iter_recurse(iter, &subiter);
|
dbus_message_iter_recurse(iter, &subiter);
|
||||||
|
|
||||||
|
@ -132,8 +142,8 @@ configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error)
|
||||||
tmp);
|
tmp);
|
||||||
MALFORMED_MESSAGE();
|
MALFORMED_MESSAGE();
|
||||||
}
|
}
|
||||||
tmpo->key = xstrdup(tmp);
|
options->key = xstrdup(tmp);
|
||||||
if (!tmpo->key) {
|
if (!options->key) {
|
||||||
ErrorF("[config] couldn't duplicate key!\n");
|
ErrorF("[config] couldn't duplicate key!\n");
|
||||||
ret = BadAlloc;
|
ret = BadAlloc;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
@ -148,31 +158,37 @@ configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error)
|
||||||
dbus_message_iter_get_basic(&subiter, &tmp);
|
dbus_message_iter_get_basic(&subiter, &tmp);
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
MALFORMED_MESSAGE();
|
MALFORMED_MESSAGE();
|
||||||
tmpo->value = xstrdup(tmp);
|
options->value = xstrdup(tmp);
|
||||||
if (!tmpo->value) {
|
if (!options->value) {
|
||||||
ErrorF("[config] couldn't duplicate option!\n");
|
ErrorF("[config] couldn't duplicate option!\n");
|
||||||
ret = BadAlloc;
|
ret = BadAlloc;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpo->next = options;
|
|
||||||
options = tmpo;
|
|
||||||
dbus_message_iter_next(iter);
|
dbus_message_iter_next(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = NewInputDeviceRequest(options);
|
ret = NewInputDeviceRequest(options, &dev);
|
||||||
if (ret != Success)
|
if (ret != Success) {
|
||||||
DebugF("[config] NewInputDeviceRequest failed\n");
|
DebugF("[config] NewInputDeviceRequest failed\n");
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
if (!dev) {
|
||||||
|
DebugF("[config] NewInputDeviceRequest succeeded, without device\n");
|
||||||
|
ret = BadMatch;
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dbus_message_iter_append_basic(r_iter, DBUS_TYPE_INT32, &(dev->id))) {
|
||||||
|
ErrorF("[config] couldn't append to iterator\n");
|
||||||
|
ret = BadAlloc;
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
|
|
||||||
unwind:
|
unwind:
|
||||||
if (tmpo->key)
|
if (dev && ret != Success)
|
||||||
xfree(tmpo->key);
|
RemoveDevice(dev);
|
||||||
if (tmpo->value)
|
|
||||||
xfree(tmpo->value);
|
|
||||||
if (tmpo)
|
|
||||||
xfree(tmpo);
|
|
||||||
|
|
||||||
while (options) {
|
while (options) {
|
||||||
tmpo = options;
|
tmpo = options;
|
||||||
|
@ -212,7 +228,7 @@ configRemoveDevice(DBusMessage *message, DBusMessageIter *iter,
|
||||||
* already been removed. */
|
* already been removed. */
|
||||||
OsBlockSignals();
|
OsBlockSignals();
|
||||||
ProcessInputEvents();
|
ProcessInputEvents();
|
||||||
RemoveDevice(pDev);
|
DeleteInputDeviceRequest(pDev);
|
||||||
OsReleaseSignals();
|
OsReleaseSignals();
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
|
@ -221,17 +237,47 @@ unwind:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
configListDevices(DBusMessage *message, DBusMessageIter *iter,
|
||||||
|
DBusMessage *reply, DBusMessageIter *r_iter,
|
||||||
|
DBusError *error)
|
||||||
|
{
|
||||||
|
DeviceIntPtr d;
|
||||||
|
int ret = BadMatch;
|
||||||
|
|
||||||
|
for (d = inputInfo.devices; d; d = d->next) {
|
||||||
|
if (!dbus_message_iter_append_basic(r_iter, DBUS_TYPE_INT32,
|
||||||
|
&(d->id))) {
|
||||||
|
ErrorF("[config] couldn't append to iterator\n");
|
||||||
|
ret = BadAlloc;
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
|
if (!dbus_message_iter_append_basic(r_iter, DBUS_TYPE_STRING,
|
||||||
|
&(d->name))) {
|
||||||
|
ErrorF("[config] couldn't append to iterator\n");
|
||||||
|
ret = BadAlloc;
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unwind:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static DBusHandlerResult
|
static DBusHandlerResult
|
||||||
configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
|
configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
|
||||||
{
|
{
|
||||||
DBusMessageIter iter;
|
DBusMessageIter iter;
|
||||||
DBusError error;
|
DBusError error;
|
||||||
DBusMessage *reply;
|
DBusMessage *reply;
|
||||||
|
DBusMessageIter r_iter;
|
||||||
DBusConnection *bus = closure;
|
DBusConnection *bus = closure;
|
||||||
int ret = BadDrawable; /* nonsensical value */
|
int ret = BadDrawable; /* nonsensical value */
|
||||||
|
|
||||||
dbus_error_init(&error);
|
dbus_error_init(&error);
|
||||||
|
|
||||||
|
DebugF("[config] received a message\n");
|
||||||
|
|
||||||
if (strcmp(dbus_message_get_interface(message),
|
if (strcmp(dbus_message_get_interface(message),
|
||||||
"org.x.config.input") == 0) {
|
"org.x.config.input") == 0) {
|
||||||
if (!dbus_message_iter_init(message, &iter)) {
|
if (!dbus_message_iter_init(message, &iter)) {
|
||||||
|
@ -240,26 +286,33 @@ configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
|
||||||
return DBUS_HANDLER_RESULT_NEED_MEMORY; /* ?? */
|
return DBUS_HANDLER_RESULT_NEED_MEMORY; /* ?? */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(reply = dbus_message_new_method_return(message))) {
|
||||||
|
ErrorF("[config] failed to create the reply message\n");
|
||||||
|
dbus_error_free(&error);
|
||||||
|
return DBUS_HANDLER_RESULT_NEED_MEMORY;
|
||||||
|
}
|
||||||
|
dbus_message_iter_init_append(reply, &r_iter);
|
||||||
|
|
||||||
if (strcmp(dbus_message_get_member(message), "add") == 0)
|
if (strcmp(dbus_message_get_member(message), "add") == 0)
|
||||||
ret = configAddDevice(message, &iter, &error);
|
ret = configAddDevice(message, &iter, reply, &r_iter, &error);
|
||||||
else if (strcmp(dbus_message_get_member(message), "remove") == 0)
|
else if (strcmp(dbus_message_get_member(message), "remove") == 0)
|
||||||
ret = configRemoveDevice(message, &iter, &error);
|
ret = configRemoveDevice(message, &iter, &error);
|
||||||
|
else if (strcmp(dbus_message_get_member(message), "listDevices") == 0)
|
||||||
|
ret = configListDevices(message, &iter, reply, &r_iter, &error);
|
||||||
if (ret != BadDrawable && ret != BadAlloc) {
|
if (ret != BadDrawable && ret != BadAlloc) {
|
||||||
reply = dbus_message_new_method_return(message);
|
|
||||||
dbus_message_iter_init_append(reply, &iter);
|
|
||||||
|
|
||||||
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret)) {
|
if (!strlen(dbus_message_get_signature(reply)))
|
||||||
ErrorF("[config] couldn't append to iterator\n");
|
if (!dbus_message_iter_append_basic(&r_iter, DBUS_TYPE_INT32, &ret)) {
|
||||||
dbus_error_free(&error);
|
ErrorF("[config] couldn't append to iterator\n");
|
||||||
return DBUS_HANDLER_RESULT_HANDLED;
|
dbus_error_free(&error);
|
||||||
}
|
return DBUS_HANDLER_RESULT_HANDLED;
|
||||||
|
}
|
||||||
|
|
||||||
if (!dbus_connection_send(bus, reply, NULL))
|
if (!dbus_connection_send(bus, reply, NULL))
|
||||||
ErrorF("[config] failed to send reply\n");
|
ErrorF("[config] failed to send reply\n");
|
||||||
dbus_connection_flush(bus);
|
|
||||||
|
|
||||||
dbus_message_unref(reply);
|
|
||||||
}
|
}
|
||||||
|
dbus_message_unref(reply);
|
||||||
|
dbus_connection_flush(bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_error_free(&error);
|
dbus_error_free(&error);
|
||||||
|
@ -410,13 +463,13 @@ configReconnect(OsTimerPtr timer, CARD32 time, pointer arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
configInitialise()
|
configInitialise(void)
|
||||||
{
|
{
|
||||||
TimerSet(NULL, 0, 1, configReconnect, NULL);
|
TimerSet(NULL, 0, 1, configReconnect, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
configFini()
|
configFini(void)
|
||||||
{
|
{
|
||||||
DBusError error;
|
DBusError error;
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ NameForAtom(Atom atom)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AtomError()
|
AtomError(void)
|
||||||
{
|
{
|
||||||
FatalError("initializing atoms");
|
FatalError("initializing atoms");
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ FreeAtom(NodePtr patom)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FreeAllAtoms()
|
FreeAllAtoms(void)
|
||||||
{
|
{
|
||||||
if(atomRoot == (NodePtr)NULL)
|
if(atomRoot == (NodePtr)NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -197,7 +197,7 @@ FreeAllAtoms()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InitAtoms()
|
InitAtoms(void)
|
||||||
{
|
{
|
||||||
FreeAllAtoms();
|
FreeAllAtoms();
|
||||||
tableLength = InitialTableSize;
|
tableLength = InitialTableSize;
|
||||||
|
|
|
@ -87,15 +87,27 @@ DeviceIntPtr
|
||||||
AddInputDevice(DeviceProc deviceProc, Bool autoStart)
|
AddInputDevice(DeviceProc deviceProc, Bool autoStart)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev, *prev; /* not a typo */
|
DeviceIntPtr dev, *prev; /* not a typo */
|
||||||
|
DeviceIntPtr devtmp;
|
||||||
|
int devid;
|
||||||
|
char devind[MAX_DEVICES];
|
||||||
|
|
||||||
if (inputInfo.numDevices >= MAX_DEVICES)
|
/* Find next available id */
|
||||||
|
memset(devind, 0, sizeof(char)*MAX_DEVICES);
|
||||||
|
for (devtmp = inputInfo.devices; devtmp; devtmp = devtmp->next)
|
||||||
|
devind[devtmp->id]++;
|
||||||
|
for (devtmp = inputInfo.off_devices; devtmp; devtmp = devtmp->next)
|
||||||
|
devind[devtmp->id]++;
|
||||||
|
for (devid = 0; devid < MAX_DEVICES && devind[devid]; devid++)
|
||||||
|
;
|
||||||
|
|
||||||
|
if (devid >= MAX_DEVICES)
|
||||||
return (DeviceIntPtr)NULL;
|
return (DeviceIntPtr)NULL;
|
||||||
dev = (DeviceIntPtr) xcalloc(sizeof(DeviceIntRec), 1);
|
dev = (DeviceIntPtr) xcalloc(sizeof(DeviceIntRec), 1);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return (DeviceIntPtr)NULL;
|
return (DeviceIntPtr)NULL;
|
||||||
dev->name = (char *)NULL;
|
dev->name = (char *)NULL;
|
||||||
dev->type = 0;
|
dev->type = 0;
|
||||||
dev->id = inputInfo.numDevices;
|
dev->id = devid;
|
||||||
inputInfo.numDevices++;
|
inputInfo.numDevices++;
|
||||||
dev->public.on = FALSE;
|
dev->public.on = FALSE;
|
||||||
dev->public.processInputProc = (ProcessInputProc)NoopDDA;
|
dev->public.processInputProc = (ProcessInputProc)NoopDDA;
|
||||||
|
@ -321,7 +333,7 @@ CorePointerProc(DeviceIntPtr pDev, int what)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InitCoreDevices()
|
InitCoreDevices(void)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
|
|
||||||
|
@ -380,7 +392,7 @@ InitCoreDevices()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
InitAndStartDevices()
|
InitAndStartDevices(void)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev, next;
|
DeviceIntPtr dev, next;
|
||||||
|
|
||||||
|
@ -438,8 +450,13 @@ CloseDevice(DeviceIntPtr dev)
|
||||||
xfree(dev->key);
|
xfree(dev->key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->valuator)
|
if (dev->valuator) {
|
||||||
|
/* Counterpart to 'biggest hack ever' in init. */
|
||||||
|
if (dev->valuator->motion &&
|
||||||
|
dev->valuator->GetMotionProc == GetMotionHistory)
|
||||||
|
xfree(dev->valuator->motion);
|
||||||
xfree(dev->valuator);
|
xfree(dev->valuator);
|
||||||
|
}
|
||||||
|
|
||||||
if (dev->button) {
|
if (dev->button) {
|
||||||
#ifdef XKB
|
#ifdef XKB
|
||||||
|
@ -511,7 +528,7 @@ CloseDevice(DeviceIntPtr dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CloseDownDevices()
|
CloseDownDevices(void)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev, next;
|
DeviceIntPtr dev, next;
|
||||||
|
|
||||||
|
@ -575,6 +592,7 @@ RemoveDevice(DeviceIntPtr dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == Success) {
|
if (ret == Success) {
|
||||||
|
inputInfo.numDevices--;
|
||||||
ev.type = DevicePresenceNotify;
|
ev.type = DevicePresenceNotify;
|
||||||
ev.time = currentTime.milliseconds;
|
ev.time = currentTime.milliseconds;
|
||||||
ev.devchange = 0;
|
ev.devchange = 0;
|
||||||
|
@ -588,7 +606,7 @@ RemoveDevice(DeviceIntPtr dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
NumMotionEvents()
|
NumMotionEvents(void)
|
||||||
{
|
{
|
||||||
return inputInfo.pointer->valuator->numMotionEvents;
|
return inputInfo.pointer->valuator->numMotionEvents;
|
||||||
}
|
}
|
||||||
|
@ -606,13 +624,13 @@ RegisterKeyboardDevice(DeviceIntPtr device)
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT DevicePtr
|
_X_EXPORT DevicePtr
|
||||||
LookupKeyboardDevice()
|
LookupKeyboardDevice(void)
|
||||||
{
|
{
|
||||||
return inputInfo.keyboard ? &inputInfo.keyboard->public : NULL;
|
return inputInfo.keyboard ? &inputInfo.keyboard->public : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT DevicePtr
|
_X_EXPORT DevicePtr
|
||||||
LookupPointerDevice()
|
LookupPointerDevice(void)
|
||||||
{
|
{
|
||||||
return inputInfo.pointer ? &inputInfo.pointer->public : NULL;
|
return inputInfo.pointer ? &inputInfo.pointer->public : NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ SetInputCheck(HWEventQueuePtr c0, HWEventQueuePtr c1)
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
UpdateCurrentTime()
|
UpdateCurrentTime(void)
|
||||||
{
|
{
|
||||||
TimeStamp systime;
|
TimeStamp systime;
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ UpdateCurrentTime()
|
||||||
|
|
||||||
/* Like UpdateCurrentTime, but can't call ProcessInputEvents */
|
/* Like UpdateCurrentTime, but can't call ProcessInputEvents */
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
UpdateCurrentTimeIf()
|
UpdateCurrentTimeIf(void)
|
||||||
{
|
{
|
||||||
TimeStamp systime;
|
TimeStamp systime;
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ UpdateCurrentTimeIf()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InitSelections()
|
InitSelections(void)
|
||||||
{
|
{
|
||||||
if (CurrentSelections)
|
if (CurrentSelections)
|
||||||
xfree(CurrentSelections);
|
xfree(CurrentSelections);
|
||||||
|
@ -3661,7 +3661,7 @@ CloseDownClient(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
KillAllClients()
|
KillAllClients(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=1; i<currentMaxClients; i++)
|
for (i=1; i<currentMaxClients; i++)
|
||||||
|
|
|
@ -1878,7 +1878,7 @@ DeleteClientFontStuff(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InitFonts ()
|
InitFonts (void)
|
||||||
{
|
{
|
||||||
patternCache = MakeFontPatternCache();
|
patternCache = MakeFontPatternCache();
|
||||||
|
|
||||||
|
@ -1997,7 +1997,7 @@ RegisterFPEFunctions(NameCheckFunc name_func,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FreeFonts()
|
FreeFonts(void)
|
||||||
{
|
{
|
||||||
if (patternCache) {
|
if (patternCache) {
|
||||||
FreeFontPatternCache(patternCache);
|
FreeFontPatternCache(patternCache);
|
||||||
|
|
|
@ -495,7 +495,7 @@ RemoveBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InitBlockAndWakeupHandlers ()
|
InitBlockAndWakeupHandlers (void)
|
||||||
{
|
{
|
||||||
xfree (handlers);
|
xfree (handlers);
|
||||||
handlers = (BlockHandlerPtr) 0;
|
handlers = (BlockHandlerPtr) 0;
|
||||||
|
@ -895,7 +895,7 @@ DeleteCallbackList(CallbackListPtr *pcbl)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InitCallbackManager()
|
InitCallbackManager(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
466
dix/events.c
466
dix/events.c
|
@ -107,6 +107,10 @@ of the copyright holder.
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
* This file handles event delivery and a big part of the server-side protocol
|
||||||
|
* handling (the parts for input devices).
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
|
@ -168,7 +172,9 @@ static xEvent *xeviexE;
|
||||||
#include "dixevents.h"
|
#include "dixevents.h"
|
||||||
#include "dixgrabs.h"
|
#include "dixgrabs.h"
|
||||||
#include "dispatch.h"
|
#include "dispatch.h"
|
||||||
|
/**
|
||||||
|
* Extension events type numbering starts at EXTENSION_EVENT_BASE.
|
||||||
|
*/
|
||||||
#define EXTENSION_EVENT_BASE 64
|
#define EXTENSION_EVENT_BASE 64
|
||||||
|
|
||||||
#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
|
#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
|
||||||
|
@ -214,6 +220,28 @@ _X_EXPORT CallbackListPtr DeviceEventCallback;
|
||||||
Mask DontPropagateMasks[DNPMCOUNT];
|
Mask DontPropagateMasks[DNPMCOUNT];
|
||||||
static int DontPropagateRefCnts[DNPMCOUNT];
|
static int DontPropagateRefCnts[DNPMCOUNT];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main input device struct.
|
||||||
|
* inputInfo.pointer
|
||||||
|
* is the core pointer. Referred to as "virtual core pointer", "VCP",
|
||||||
|
* "core pointer" or inputInfo.pointer. There is exactly one core pointer,
|
||||||
|
* but multiple devices may send core events. If a device generates core
|
||||||
|
* events, those events will appear to originate from the core pointer.
|
||||||
|
*
|
||||||
|
* inputInfo.keyboard
|
||||||
|
* is the core keyboard ("virtual core keyboard", "VCK", "core keyboard").
|
||||||
|
* See inputInfo.pointer.
|
||||||
|
*
|
||||||
|
* inputInfo.devices
|
||||||
|
* linked list containing all devices including VCK and VCP. The VCK will
|
||||||
|
* always be the first entry, the VCP the second entry in the device list.
|
||||||
|
*
|
||||||
|
* inputInfo.off_devices
|
||||||
|
* Devices that have not been initialized and are thus turned off.
|
||||||
|
*
|
||||||
|
* inputInfo.numDevices
|
||||||
|
* Total number of devices.
|
||||||
|
*/
|
||||||
_X_EXPORT InputInfo inputInfo;
|
_X_EXPORT InputInfo inputInfo;
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
@ -228,12 +256,19 @@ static struct {
|
||||||
* The window trace information is used to avoid having to compute all the
|
* The window trace information is used to avoid having to compute all the
|
||||||
* windows between the root and the current pointer window each time a button
|
* windows between the root and the current pointer window each time a button
|
||||||
* or key goes down. The grabs on each of those windows must be checked.
|
* or key goes down. The grabs on each of those windows must be checked.
|
||||||
|
*
|
||||||
|
* @see XYToWindow() for a documentation on how the array is set up.
|
||||||
*/
|
*/
|
||||||
static WindowPtr *spriteTrace = (WindowPtr *)NULL;
|
static WindowPtr *spriteTrace = (WindowPtr *)NULL;
|
||||||
#define ROOT spriteTrace[0]
|
#define ROOT spriteTrace[0]
|
||||||
static int spriteTraceSize = 0;
|
static int spriteTraceSize = 0;
|
||||||
static int spriteTraceGood;
|
static int spriteTraceGood;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DIX sprite information. This is the sprite as seen from the DIX. It does
|
||||||
|
* not represent the actual sprite rendered to the screen.
|
||||||
|
*
|
||||||
|
*/
|
||||||
static struct {
|
static struct {
|
||||||
CursorPtr current;
|
CursorPtr current;
|
||||||
BoxRec hotLimits; /* logical constraints of hot spot */
|
BoxRec hotLimits; /* logical constraints of hot spot */
|
||||||
|
@ -270,6 +305,9 @@ static WindowPtr XYToWindow(
|
||||||
int y
|
int y
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Max event opcode.
|
||||||
|
*/
|
||||||
extern int lastEvent;
|
extern int lastEvent;
|
||||||
|
|
||||||
static Mask lastEventMask;
|
static Mask lastEventMask;
|
||||||
|
@ -844,11 +882,18 @@ ConfineCursorToWindow(WindowPtr pWin, Bool generateEvents, Bool confineToScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT Bool
|
_X_EXPORT Bool
|
||||||
PointerConfinedToScreen()
|
PointerConfinedToScreen(void)
|
||||||
{
|
{
|
||||||
return sprite.confined;
|
return sprite.confined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the sprite cursor to the given cursor.
|
||||||
|
*
|
||||||
|
* ChangeToCursor() will display the new cursor and free the old cursor (if
|
||||||
|
* applicable). If the provided cursor is already the updated cursor, nothing
|
||||||
|
* happens.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
ChangeToCursor(CursorPtr cursor)
|
ChangeToCursor(CursorPtr cursor)
|
||||||
{
|
{
|
||||||
|
@ -873,7 +918,9 @@ ChangeToCursor(CursorPtr cursor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns true if b is a descendent of a */
|
/**
|
||||||
|
* @returns true if b is a descendent of a
|
||||||
|
*/
|
||||||
Bool
|
Bool
|
||||||
IsParent(WindowPtr a, WindowPtr b)
|
IsParent(WindowPtr a, WindowPtr b)
|
||||||
{
|
{
|
||||||
|
@ -882,6 +929,11 @@ IsParent(WindowPtr a, WindowPtr b)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the cursor displayed on the screen.
|
||||||
|
*
|
||||||
|
* Called whenever a cursor may have changed shape or position.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
PostNewCursor(void)
|
PostNewCursor(void)
|
||||||
{
|
{
|
||||||
|
@ -912,24 +964,36 @@ PostNewCursor(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return root window of current active screen.
|
||||||
|
*/
|
||||||
_X_EXPORT WindowPtr
|
_X_EXPORT WindowPtr
|
||||||
GetCurrentRootWindow()
|
GetCurrentRootWindow(void)
|
||||||
{
|
{
|
||||||
return ROOT;
|
return ROOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return window underneath the cursor sprite.
|
||||||
|
*/
|
||||||
_X_EXPORT WindowPtr
|
_X_EXPORT WindowPtr
|
||||||
GetSpriteWindow()
|
GetSpriteWindow(void)
|
||||||
{
|
{
|
||||||
return sprite.win;
|
return sprite.win;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return current sprite cursor.
|
||||||
|
*/
|
||||||
_X_EXPORT CursorPtr
|
_X_EXPORT CursorPtr
|
||||||
GetSpriteCursor()
|
GetSpriteCursor(void)
|
||||||
{
|
{
|
||||||
return sprite.current;
|
return sprite.current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set x/y current sprite position in screen coordinates.
|
||||||
|
*/
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
GetSpritePosition(int *px, int *py)
|
GetSpritePosition(int *px, int *py)
|
||||||
{
|
{
|
||||||
|
@ -939,7 +1003,7 @@ GetSpritePosition(int *px, int *py)
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
XineramaGetCursorScreen()
|
XineramaGetCursorScreen(void)
|
||||||
{
|
{
|
||||||
if(!noPanoramiXExtension) {
|
if(!noPanoramiXExtension) {
|
||||||
return sprite.screen->myNum;
|
return sprite.screen->myNum;
|
||||||
|
@ -1114,7 +1178,7 @@ FreezeThaw(DeviceIntPtr dev, Bool frozen)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ComputeFreezes()
|
ComputeFreezes(void)
|
||||||
{
|
{
|
||||||
DeviceIntPtr replayDev = syncEvents.replayDev;
|
DeviceIntPtr replayDev = syncEvents.replayDev;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1231,6 +1295,19 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
|
||||||
ComputeFreezes();
|
ComputeFreezes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activate a pointer grab on the given device. A pointer grab will cause all
|
||||||
|
* core pointer events to be delivered to the grabbing client only. Can cause
|
||||||
|
* the cursor to change if a grab cursor is set.
|
||||||
|
*
|
||||||
|
* As a pointer grab can only be issued on the core devices, mouse is always
|
||||||
|
* inputInfo.pointer. Extension devices are set up for ActivateKeyboardGrab().
|
||||||
|
*
|
||||||
|
* @param mouse The device to grab.
|
||||||
|
* @param grab The grab structure, needs to be setup.
|
||||||
|
* @param autoGrab True if the grab was caused by a button down event and not
|
||||||
|
* explicitely by a client.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
|
ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
|
||||||
TimeStamp time, Bool autoGrab)
|
TimeStamp time, Bool autoGrab)
|
||||||
|
@ -1259,6 +1336,12 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
|
||||||
CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode);
|
CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete grab on given device, update the sprite.
|
||||||
|
*
|
||||||
|
* As a pointer grab can only be issued on the core devices, mouse is always
|
||||||
|
* inputInfo.pointer. Extension devices are set up for ActivateKeyboardGrab().
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
DeactivatePointerGrab(DeviceIntPtr mouse)
|
DeactivatePointerGrab(DeviceIntPtr mouse)
|
||||||
{
|
{
|
||||||
|
@ -1283,6 +1366,11 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
|
||||||
ComputeFreezes();
|
ComputeFreezes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activate a keyboard grab on the given device.
|
||||||
|
*
|
||||||
|
* Extension devices have ActivateKeyboardGrab() set as their grabbing proc.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive)
|
ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive)
|
||||||
{
|
{
|
||||||
|
@ -1309,6 +1397,9 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool pass
|
||||||
CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
|
CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete keyboard grab for the given device.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
DeactivateKeyboardGrab(DeviceIntPtr keybd)
|
DeactivateKeyboardGrab(DeviceIntPtr keybd)
|
||||||
{
|
{
|
||||||
|
@ -1441,6 +1532,11 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for AllowEvents request.
|
||||||
|
*
|
||||||
|
* Release some events from a frozen device. Only applicable for core devices.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcAllowEvents(ClientPtr client)
|
ProcAllowEvents(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -1484,6 +1580,9 @@ ProcAllowEvents(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deactivate grabs from any device that has been grabbed by the client.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
ReleaseActiveGrabs(ClientPtr client)
|
ReleaseActiveGrabs(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -1510,6 +1609,30 @@ ReleaseActiveGrabs(ClientPtr client)
|
||||||
* The following procedures deal with delivering events *
|
* The following procedures deal with delivering events *
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deliver the given events to the given client.
|
||||||
|
*
|
||||||
|
* More than one event may be delivered at a time. This is the case with
|
||||||
|
* DeviceMotionNotifies which may be followed by DeviceValuator events.
|
||||||
|
*
|
||||||
|
* TryClientEvents() is the last station before actually writing the events to
|
||||||
|
* the socket. Anything that is not filtered here, will get delivered to the
|
||||||
|
* client.
|
||||||
|
* An event is only delivered if
|
||||||
|
* - mask and filter match up.
|
||||||
|
* - no other client has a grab on the device that caused the event.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param client The target client to deliver to.
|
||||||
|
* @param pEvents The events to be delivered.
|
||||||
|
* @param count Number of elements in pEvents.
|
||||||
|
* @param mask Event mask as set by the window.
|
||||||
|
* @param filter Mask based on event type.
|
||||||
|
* @param grab Possible grab on the device that caused the event.
|
||||||
|
*
|
||||||
|
* @return 1 if event was delivered, 0 if not or -1 if grab was not set by the
|
||||||
|
* client.
|
||||||
|
*/
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
|
TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
|
||||||
Mask filter, GrabPtr grab)
|
Mask filter, GrabPtr grab)
|
||||||
|
@ -1588,6 +1711,23 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deliver events to a window. At this point, we do not yet know if the event
|
||||||
|
* actually needs to be delivered. May activate a grab if the event is a
|
||||||
|
* button press.
|
||||||
|
*
|
||||||
|
* More than one event may be delivered at a time. This is the case with
|
||||||
|
* DeviceMotionNotifies which may be followed by DeviceValuator events.
|
||||||
|
*
|
||||||
|
* @param pWin The window that would get the event.
|
||||||
|
* @param pEvents The events to be delivered.
|
||||||
|
* @param count Number of elements in pEvents.
|
||||||
|
* @param filter Mask based on event type.
|
||||||
|
* @param grab Possible grab on the device that caused the event.
|
||||||
|
* @param mskidx Mask index, depending on device that caused event.
|
||||||
|
*
|
||||||
|
* @return Number of events delivered to various clients.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
DeliverEventsToWindow(WindowPtr pWin, xEvent *pEvents, int count,
|
DeliverEventsToWindow(WindowPtr pWin, xEvent *pEvents, int count,
|
||||||
Mask filter, GrabPtr grab, int mskidx)
|
Mask filter, GrabPtr grab, int mskidx)
|
||||||
|
@ -1707,6 +1847,15 @@ XineramaTryClientEventsResult(
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to deliver events to the interested parties.
|
||||||
|
*
|
||||||
|
* @param pWin The window that would get the event.
|
||||||
|
* @param pEvents The events to be delivered.
|
||||||
|
* @param count Number of elements in pEvents.
|
||||||
|
* @param filter Mask based on event type.
|
||||||
|
* @param dontClient Don't deliver to the dontClient.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
|
MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
|
||||||
int count, Mask filter, ClientPtr dontClient)
|
int count, Mask filter, ClientPtr dontClient)
|
||||||
|
@ -1744,6 +1893,14 @@ MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjust event fields to comply with the window properties.
|
||||||
|
*
|
||||||
|
* @param xE Event to be modified in place
|
||||||
|
* @param pWin The window to get the information from.
|
||||||
|
* @param child Child window setting for event (if applicable)
|
||||||
|
* @param calcChild If True, calculate the child window.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
FixUpEventFromWindow(
|
FixUpEventFromWindow(
|
||||||
xEvent *xE,
|
xEvent *xE,
|
||||||
|
@ -1798,6 +1955,22 @@ FixUpEventFromWindow(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deliver events caused by input devices. Called for all core input events
|
||||||
|
* and XI events. No filtering of events happens before DeliverDeviceEvents(),
|
||||||
|
* it will be called for any event that comes out of the event queue.
|
||||||
|
*
|
||||||
|
* For all core events, dev is either inputInfo.pointer or inputInfo.keyboard.
|
||||||
|
* For all extension events, dev is the device that caused the event.
|
||||||
|
*
|
||||||
|
* @param pWin Window to deliver event to.
|
||||||
|
* @param xE Events to deliver.
|
||||||
|
* @param grab Possible grab on a device.
|
||||||
|
* @param stopAt Don't recurse up to the root window.
|
||||||
|
* @param dev The device that is responsible for the event.
|
||||||
|
* @param count number of events in xE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab,
|
DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab,
|
||||||
WindowPtr stopAt, DeviceIntPtr dev, int count)
|
WindowPtr stopAt, DeviceIntPtr dev, int count)
|
||||||
|
@ -1861,7 +2034,19 @@ DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not useful for events that propagate up the tree or extension events */
|
/**
|
||||||
|
* Deliver event to a window and it's immediate parent. Used for most window
|
||||||
|
* events (CreateNotify, ConfigureNotify, etc.). Not useful for events that
|
||||||
|
* propagate up the tree or extension events
|
||||||
|
*
|
||||||
|
* In case of a ReparentNotify event, the event will be delivered to the
|
||||||
|
* otherParent as well.
|
||||||
|
*
|
||||||
|
* @param pWin Window to deliver events to.
|
||||||
|
* @param xE Events to deliver.
|
||||||
|
* @param count number of events in xE.
|
||||||
|
* @param otherParent Used for ReparentNotify events.
|
||||||
|
*/
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
|
DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
|
||||||
WindowPtr otherParent)
|
WindowPtr otherParent)
|
||||||
|
@ -1926,6 +2111,17 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Traversed from the root window to the window at the position x/y. While
|
||||||
|
* traversing, it sets up the traversal history in the spriteTrace array.
|
||||||
|
* After completing, the spriteTrace history is set in the following way:
|
||||||
|
* spriteTrace[0] ... root window
|
||||||
|
* spriteTrace[1] ... top level window that encloses x/y
|
||||||
|
* ...
|
||||||
|
* spriteTrace[spriteTraceGood - 1] ... window at x/y
|
||||||
|
*
|
||||||
|
* @returns the window at the given coordinates.
|
||||||
|
*/
|
||||||
static WindowPtr
|
static WindowPtr
|
||||||
XYToWindow(int x, int y)
|
XYToWindow(int x, int y)
|
||||||
{
|
{
|
||||||
|
@ -1974,6 +2170,12 @@ XYToWindow(int x, int y)
|
||||||
return spriteTrace[spriteTraceGood-1];
|
return spriteTrace[spriteTraceGood-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the sprite coordinates based on the event. Update the cursor
|
||||||
|
* position, then update the event with the new coordinates that may have been
|
||||||
|
* changed. If the window underneath the sprite has changed, change to new
|
||||||
|
* cursor and send enter/leave events.
|
||||||
|
*/
|
||||||
static Bool
|
static Bool
|
||||||
CheckMotion(xEvent *xE)
|
CheckMotion(xEvent *xE)
|
||||||
{
|
{
|
||||||
|
@ -2046,8 +2248,12 @@ CheckMotion(xEvent *xE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Windows have restructured, we need to update the sprite position and the
|
||||||
|
* sprite's cursor.
|
||||||
|
*/
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
WindowsRestructured()
|
WindowsRestructured(void)
|
||||||
{
|
{
|
||||||
(void) CheckMotion((xEvent *)NULL);
|
(void) CheckMotion((xEvent *)NULL);
|
||||||
}
|
}
|
||||||
|
@ -2091,6 +2297,10 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the given window to sane values, display the cursor in the center of
|
||||||
|
* the screen. Called from main() with the root window on the first screen.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
DefineInitialRootWindow(WindowPtr win)
|
DefineInitialRootWindow(WindowPtr win)
|
||||||
{
|
{
|
||||||
|
@ -2297,6 +2507,10 @@ XineramaWarpPointer(ClientPtr client)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for WarpPointer request.
|
||||||
|
* Warps the cursor position to the coordinates given in the request.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcWarpPointer(ClientPtr client)
|
ProcWarpPointer(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -2405,8 +2619,15 @@ BorderSizeNotEmpty(WindowPtr pWin)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
|
/**
|
||||||
passive grab set on the window to be activated. */
|
* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
|
||||||
|
* passive grab set on the window to be activated.
|
||||||
|
*
|
||||||
|
* @param pWin The window that may be subject to a passive grab.
|
||||||
|
* @param device Device that caused the event.
|
||||||
|
* @param xE List of events (multiple ones for DeviceMotionNotify)
|
||||||
|
* @count number of elements in xE.
|
||||||
|
*/
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
CheckPassiveGrabsOnWindow(
|
CheckPassiveGrabsOnWindow(
|
||||||
|
@ -2556,6 +2777,16 @@ CheckDeviceGrabs(DeviceIntPtr device, xEvent *xE,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called for keyboard events to deliver event to whatever client owns the
|
||||||
|
* focus. Event is delivered to the keyboard's focus window, the root window
|
||||||
|
* or to the window owning the input focus.
|
||||||
|
*
|
||||||
|
* @param keybd The keyboard originating the event.
|
||||||
|
* @param xE The event list.
|
||||||
|
* @param window Window underneath the sprite.
|
||||||
|
* @param count number of events in xE.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count)
|
DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count)
|
||||||
{
|
{
|
||||||
|
@ -2584,6 +2815,13 @@ DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count)
|
||||||
NullGrab, mskidx);
|
NullGrab, mskidx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deliver an event from a device that is currently grabbed. Uses
|
||||||
|
* DeliverDeviceEvents() for further delivery if a ownerEvents is set on the
|
||||||
|
* grab. If not, TryClientEvents() is used.
|
||||||
|
*
|
||||||
|
* @param deactivateGrab True if the device's grab should be deactivated.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
|
DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
|
||||||
Bool deactivateGrab, int count)
|
Bool deactivateGrab, int count)
|
||||||
|
@ -2666,6 +2904,17 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main keyboard event processing function for core keyboard events.
|
||||||
|
* Updates the events fields from the current pointer state and delivers the
|
||||||
|
* event.
|
||||||
|
*
|
||||||
|
* For key events, xE will always be a single event.
|
||||||
|
*
|
||||||
|
* @param xE Event list
|
||||||
|
* @param keybd The device that caused an event.
|
||||||
|
* @param count Number of elements in xE.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
#ifdef XKB
|
#ifdef XKB
|
||||||
CoreProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count)
|
CoreProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count)
|
||||||
|
@ -2861,6 +3110,18 @@ FixKeyState (xEvent *xE, DeviceIntPtr keybd)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main pointer event processing function for core pointer events.
|
||||||
|
* For motion events: update the sprite.
|
||||||
|
* For all other events: Update the event fields based on the current sprite
|
||||||
|
* state.
|
||||||
|
*
|
||||||
|
* For core pointer events, xE will always be a single event.
|
||||||
|
*
|
||||||
|
* @param xE Event list
|
||||||
|
* @param mouse The device that caused an event.
|
||||||
|
* @param count Number of elements in xE.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
#ifdef XKB
|
#ifdef XKB
|
||||||
CoreProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
|
CoreProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
|
||||||
|
@ -2974,6 +3235,18 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
|
||||||
#define AtMostOneClient \
|
#define AtMostOneClient \
|
||||||
(SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask)
|
(SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recalculate which events may be deliverable for the given window.
|
||||||
|
* Recalculated mask is used for quicker determination which events may be
|
||||||
|
* delivered to a window.
|
||||||
|
*
|
||||||
|
* The otherEventMasks on a WindowOptional is the combination of all event
|
||||||
|
* masks set by all clients on the window.
|
||||||
|
* deliverableEventMask is the combination of the eventMask and the
|
||||||
|
* otherEventMask.
|
||||||
|
*
|
||||||
|
* Traverses to siblings and parents of the window.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
RecalculateDeliverableEvents(pWin)
|
RecalculateDeliverableEvents(pWin)
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
|
@ -3172,6 +3445,9 @@ EventSuppressForWindow(WindowPtr pWin, ClientPtr client,
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The window that is the first ancestor of both a and b.
|
||||||
|
*/
|
||||||
static WindowPtr
|
static WindowPtr
|
||||||
CommonAncestor(
|
CommonAncestor(
|
||||||
WindowPtr a,
|
WindowPtr a,
|
||||||
|
@ -3182,6 +3458,10 @@ CommonAncestor(
|
||||||
return NullWindow;
|
return NullWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assembles an EnterNotify or LeaveNotify and sends it event to the client.
|
||||||
|
* The core devices are used to fill in the event fields.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
EnterLeaveEvent(
|
EnterLeaveEvent(
|
||||||
int type,
|
int type,
|
||||||
|
@ -3264,6 +3544,10 @@ EnterLeaveEvent(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send enter notifies to all parent windows up to ancestor.
|
||||||
|
* This function recurses.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail)
|
EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail)
|
||||||
{
|
{
|
||||||
|
@ -3275,6 +3559,11 @@ EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail)
|
||||||
EnterLeaveEvent(EnterNotify, mode, detail, parent, child->drawable.id);
|
EnterLeaveEvent(EnterNotify, mode, detail, parent, child->drawable.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send leave notifies to all parent windows up to ancestor.
|
||||||
|
* This function recurses.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail)
|
LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail)
|
||||||
{
|
{
|
||||||
|
@ -3289,6 +3578,13 @@ LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Figure out if enter/leave events are necessary and send them to the
|
||||||
|
* appropriate windows.
|
||||||
|
*
|
||||||
|
* @param fromWin Window the sprite moved out of.
|
||||||
|
* @param toWin Window the sprite moved into.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode)
|
DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode)
|
||||||
{
|
{
|
||||||
|
@ -3522,6 +3818,23 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the input focus to the given window. Subsequent keyboard events will be
|
||||||
|
* delivered to the given window.
|
||||||
|
*
|
||||||
|
* Usually called from ProcSetInputFocus as result of a client request. If so,
|
||||||
|
* the device is the inputInfo.keyboard.
|
||||||
|
* If called from ProcXSetInputFocus as result of a client xinput request, the
|
||||||
|
* device is set to the device specified by the client.
|
||||||
|
*
|
||||||
|
* @param client Client that requested input focus change.
|
||||||
|
* @param dev Focus device.
|
||||||
|
* @param focusID The window to obtain the focus. Can be PointerRoot or None.
|
||||||
|
* @param revertTo Specifies where the focus reverts to when window becomes
|
||||||
|
* unviewable.
|
||||||
|
* @param ctime Specifies the time.
|
||||||
|
* @param followOK True if pointer is allowed to follow the keyboard.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
SetInputFocus(
|
SetInputFocus(
|
||||||
ClientPtr client,
|
ClientPtr client,
|
||||||
|
@ -3598,6 +3911,11 @@ SetInputFocus(
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for SetInputFocus request.
|
||||||
|
*
|
||||||
|
* Sets the input focus for the virtual core keyboard.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcSetInputFocus(client)
|
ProcSetInputFocus(client)
|
||||||
ClientPtr client;
|
ClientPtr client;
|
||||||
|
@ -3613,6 +3931,12 @@ ProcSetInputFocus(client)
|
||||||
stuff->revertTo, stuff->time, FALSE);
|
stuff->revertTo, stuff->time, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for GetInputFocus request.
|
||||||
|
*
|
||||||
|
* Sends the current input focus for the virtual core keyboard back to the
|
||||||
|
* client.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcGetInputFocus(ClientPtr client)
|
ProcGetInputFocus(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -3634,6 +3958,12 @@ ProcGetInputFocus(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for Grabpointer request.
|
||||||
|
*
|
||||||
|
* Sets an active grab on the inputInfo.pointer and returns success status to
|
||||||
|
* client.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcGrabPointer(ClientPtr client)
|
ProcGrabPointer(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -3741,6 +4071,14 @@ ProcGrabPointer(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for ChangeActivePointerGrab request.
|
||||||
|
*
|
||||||
|
* Changes properties of the grab hold by the client. If the client does not
|
||||||
|
* hold an active grab on the device, nothing happens.
|
||||||
|
*
|
||||||
|
* Works on the core pointer only.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcChangeActivePointerGrab(ClientPtr client)
|
ProcChangeActivePointerGrab(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -3787,6 +4125,11 @@ ProcChangeActivePointerGrab(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for UngrabPointer request.
|
||||||
|
*
|
||||||
|
* Deletes the pointer grab on the core pointer device.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcUngrabPointer(ClientPtr client)
|
ProcUngrabPointer(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -3806,6 +4149,24 @@ ProcUngrabPointer(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a grab on the given device.
|
||||||
|
*
|
||||||
|
* Called from ProcGrabKeyboard to work on the inputInfo.keyboard.
|
||||||
|
* Called from ProcXGrabDevice to work on the device specified by the client.
|
||||||
|
*
|
||||||
|
* The parameters this_mode and other_mode represent the keyboard_mode and
|
||||||
|
* pointer_mode parameters of XGrabKeyboard().
|
||||||
|
* See man page for details on all the parameters
|
||||||
|
*
|
||||||
|
* @param client Client that owns the grab.
|
||||||
|
* @param dev The device to grab.
|
||||||
|
* @param this_mode GrabModeSync or GrabModeAsync
|
||||||
|
* @param other_mode GrabModeSync or GrabModeAsync
|
||||||
|
* @param status Return code to be returned to the caller.
|
||||||
|
*
|
||||||
|
* @returns Success or BadValue.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
GrabDevice(ClientPtr client, DeviceIntPtr dev,
|
GrabDevice(ClientPtr client, DeviceIntPtr dev,
|
||||||
unsigned this_mode, unsigned other_mode, Window grabWindow,
|
unsigned this_mode, unsigned other_mode, Window grabWindow,
|
||||||
|
@ -3864,6 +4225,11 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for GrabKeyboard request.
|
||||||
|
*
|
||||||
|
* Grabs the inputInfo.keyboad and returns success status to client.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcGrabKeyboard(ClientPtr client)
|
ProcGrabKeyboard(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -3892,6 +4258,11 @@ ProcGrabKeyboard(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for UngrabKeyboard request.
|
||||||
|
*
|
||||||
|
* Deletes a possible grab on the inputInfo.keyboard.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcUngrabKeyboard(ClientPtr client)
|
ProcUngrabKeyboard(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -3911,6 +4282,11 @@ ProcUngrabKeyboard(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for QueryPointer request.
|
||||||
|
*
|
||||||
|
* Returns the current state and position of the core pointer to the client.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcQueryPointer(ClientPtr client)
|
ProcQueryPointer(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -3969,8 +4345,12 @@ ProcQueryPointer(ClientPtr client)
|
||||||
return(Success);
|
return(Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the device list and the DIX sprite to sane values. Allocates
|
||||||
|
* trace memory used for quick window traversal.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
InitEvents()
|
InitEvents(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -4030,6 +4410,11 @@ CloseDownEvents(void)
|
||||||
spriteTraceSize = 0;
|
spriteTraceSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for SendEvent request.
|
||||||
|
*
|
||||||
|
* Locates the window to send the event to and forwards the event.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcSendEvent(ClientPtr client)
|
ProcSendEvent(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -4117,6 +4502,12 @@ ProcSendEvent(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for UngrabKey request.
|
||||||
|
*
|
||||||
|
* Deletes a passive grab for the given key. Only works on the
|
||||||
|
* inputInfo.keyboard.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcUngrabKey(ClientPtr client)
|
ProcUngrabKey(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -4159,6 +4550,12 @@ ProcUngrabKey(ClientPtr client)
|
||||||
return(Success);
|
return(Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for GrabKey request.
|
||||||
|
*
|
||||||
|
* Creates a grab for the inputInfo.keyboard and adds it to the list of
|
||||||
|
* passive grabs.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcGrabKey(ClientPtr client)
|
ProcGrabKey(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -4214,6 +4611,12 @@ ProcGrabKey(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for GrabButton request.
|
||||||
|
*
|
||||||
|
* Creates a grab for the inputInfo.pointer and adds it as a passive grab to
|
||||||
|
* the list.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcGrabButton(ClientPtr client)
|
ProcGrabButton(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -4287,6 +4690,11 @@ ProcGrabButton(ClientPtr client)
|
||||||
return AddPassiveGrabToList(grab);
|
return AddPassiveGrabToList(grab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for UngrabButton request.
|
||||||
|
*
|
||||||
|
* Deletes a passive grab on the inputInfo.pointer from the list.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcUngrabButton(ClientPtr client)
|
ProcUngrabButton(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -4320,6 +4728,17 @@ ProcUngrabButton(ClientPtr client)
|
||||||
return(Success);
|
return(Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deactivate any grab that may be on the window, remove the focus.
|
||||||
|
* Delete any XInput extension events from the window too. Does not change the
|
||||||
|
* window mask. Use just before the window is deleted.
|
||||||
|
*
|
||||||
|
* If freeResources is set, passive grabs on the window are deleted.
|
||||||
|
*
|
||||||
|
* @param pWin The window to delete events from.
|
||||||
|
* @param freeResources True if resources associated with the window should be
|
||||||
|
* deleted.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
|
DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
|
||||||
{
|
{
|
||||||
|
@ -4409,7 +4828,9 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this whenever some window at or below pWin has changed geometry
|
* Call this whenever some window at or below pWin has changed geometry. If
|
||||||
|
* there is a grab on the window, the cursor will be re-confined into the
|
||||||
|
* window.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
CheckCursorConfinement(WindowPtr pWin)
|
CheckCursorConfinement(WindowPtr pWin)
|
||||||
|
@ -4445,6 +4866,9 @@ EventMaskForClient(WindowPtr pWin, ClientPtr client)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side protocol handling for RecolorCursor request.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
ProcRecolorCursor(ClientPtr client)
|
ProcRecolorCursor(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -4486,6 +4910,20 @@ ProcRecolorCursor(ClientPtr client)
|
||||||
return (Success);
|
return (Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the given events to a client, swapping the byte order if necessary.
|
||||||
|
* To swap the byte ordering, a callback is called that has to be set up for
|
||||||
|
* the given event type.
|
||||||
|
*
|
||||||
|
* In the case of DeviceMotionNotify trailed by DeviceValuators, the events
|
||||||
|
* can be more than one. Usually it's just one event.
|
||||||
|
*
|
||||||
|
* Do not modify the event structure passed in. See comment below.
|
||||||
|
*
|
||||||
|
* @param pClient Client to send events to.
|
||||||
|
* @param count Number of events.
|
||||||
|
* @param events The event list.
|
||||||
|
*/
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
|
WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
|
||||||
{
|
{
|
||||||
|
|
|
@ -279,7 +279,7 @@ MinorOpcodeOfRequest(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CloseDownExtensions()
|
CloseDownExtensions(void)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
|
||||||
* Pick some arbitrary size for Xi motion history.
|
* Pick some arbitrary size for Xi motion history.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
GetMotionHistorySize()
|
GetMotionHistorySize(void)
|
||||||
{
|
{
|
||||||
return MOTION_HISTORY_SIZE;
|
return MOTION_HISTORY_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, int first_valuator,
|
||||||
* xEvent *events = xcalloc(sizeof(xEvent), GetMaximumEventsNum());
|
* xEvent *events = xcalloc(sizeof(xEvent), GetMaximumEventsNum());
|
||||||
*/
|
*/
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
GetMaximumEventsNum() {
|
GetMaximumEventsNum(void) {
|
||||||
/* Two base events -- core and device, plus valuator events. Multiply
|
/* Two base events -- core and device, plus valuator events. Multiply
|
||||||
* by two if we're doing key repeats. */
|
* by two if we're doing key repeats. */
|
||||||
int ret = 2 + MAX_VALUATOR_EVENTS;
|
int ret = 2 + MAX_VALUATOR_EVENTS;
|
||||||
|
@ -714,6 +714,7 @@ _X_EXPORT void
|
||||||
SwitchCoreKeyboard(DeviceIntPtr pDev)
|
SwitchCoreKeyboard(DeviceIntPtr pDev)
|
||||||
{
|
{
|
||||||
KeyClassPtr ckeyc = inputInfo.keyboard->key;
|
KeyClassPtr ckeyc = inputInfo.keyboard->key;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) {
|
if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) {
|
||||||
memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH);
|
memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH);
|
||||||
|
@ -728,6 +729,25 @@ SwitchCoreKeyboard(DeviceIntPtr pDev)
|
||||||
ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode;
|
ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode;
|
||||||
SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms);
|
SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copy state from the extended keyboard to core. If you omit this,
|
||||||
|
* holding Ctrl on keyboard one, and pressing Q on keyboard two, will
|
||||||
|
* cause your app to quit. This feels wrong to me, hence the below
|
||||||
|
* code.
|
||||||
|
*
|
||||||
|
* XXX: If you synthesise core modifier events, the state will get
|
||||||
|
* clobbered here. You'll have to work out something sensible
|
||||||
|
* to fix that. Good luck.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define KEYBOARD_MASK (ShiftMask | LockMask | ControlMask | Mod1Mask | \
|
||||||
|
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask)
|
||||||
|
ckeyc->state &= ~(KEYBOARD_MASK);
|
||||||
|
ckeyc->state |= (pDev->key->state & KEYBOARD_MASK);
|
||||||
|
#undef KEYBOARD_MASK
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
ckeyc->modifierKeyCount[i] = pDev->key->modifierKeyCount[i];
|
||||||
|
|
||||||
#ifdef XKB
|
#ifdef XKB
|
||||||
if (!noXkbExtension && pDev->key->xkbInfo && pDev->key->xkbInfo->desc) {
|
if (!noXkbExtension && pDev->key->xkbInfo && pDev->key->xkbInfo->desc) {
|
||||||
if (!XkbCopyKeymap(pDev->key->xkbInfo->desc, ckeyc->xkbInfo->desc,
|
if (!XkbCopyKeymap(pDev->key->xkbInfo->desc, ckeyc->xkbInfo->desc,
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "dix.h"
|
#include "dix.h"
|
||||||
void MakePredeclaredAtoms()
|
void MakePredeclaredAtoms(void)
|
||||||
{
|
{
|
||||||
if (MakeAtom("PRIMARY", 7, 1) != XA_PRIMARY) AtomError();
|
if (MakeAtom("PRIMARY", 7, 1) != XA_PRIMARY) AtomError();
|
||||||
if (MakeAtom("SECONDARY", 9, 1) != XA_SECONDARY) AtomError();
|
if (MakeAtom("SECONDARY", 9, 1) != XA_SECONDARY) AtomError();
|
||||||
|
|
|
@ -541,7 +541,7 @@ static int padlength[4] = {0, 3, 2, 1};
|
||||||
static
|
static
|
||||||
#endif
|
#endif
|
||||||
Bool
|
Bool
|
||||||
CreateConnectionBlock()
|
CreateConnectionBlock(void)
|
||||||
{
|
{
|
||||||
xConnSetup setup;
|
xConnSetup setup;
|
||||||
xWindowRoot root;
|
xWindowRoot root;
|
||||||
|
|
|
@ -293,7 +293,7 @@ unsigned *extensionPrivateSizes;
|
||||||
unsigned totalExtensionSize;
|
unsigned totalExtensionSize;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ResetExtensionPrivates()
|
ResetExtensionPrivates(void)
|
||||||
{
|
{
|
||||||
extensionPrivateCount = 1;
|
extensionPrivateCount = 1;
|
||||||
extensionPrivateLen = 1;
|
extensionPrivateLen = 1;
|
||||||
|
@ -306,7 +306,7 @@ ResetExtensionPrivates()
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
AllocateExtensionPrivateIndex()
|
AllocateExtensionPrivateIndex(void)
|
||||||
{
|
{
|
||||||
return extensionPrivateCount++;
|
return extensionPrivateCount++;
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ unsigned *clientPrivateSizes;
|
||||||
unsigned totalClientSize;
|
unsigned totalClientSize;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ResetClientPrivates()
|
ResetClientPrivates(void)
|
||||||
{
|
{
|
||||||
clientPrivateCount = 1;
|
clientPrivateCount = 1;
|
||||||
clientPrivateLen = 1;
|
clientPrivateLen = 1;
|
||||||
|
@ -365,7 +365,7 @@ ResetClientPrivates()
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
AllocateClientPrivateIndex()
|
AllocateClientPrivateIndex(void)
|
||||||
{
|
{
|
||||||
return clientPrivateCount++;
|
return clientPrivateCount++;
|
||||||
}
|
}
|
||||||
|
@ -408,7 +408,7 @@ AllocateClientPrivate(int index2, unsigned amount)
|
||||||
int screenPrivateCount;
|
int screenPrivateCount;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ResetScreenPrivates()
|
ResetScreenPrivates(void)
|
||||||
{
|
{
|
||||||
screenPrivateCount = 1;
|
screenPrivateCount = 1;
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,7 @@ ResetScreenPrivates()
|
||||||
* so we have to worry about resizing existing devPrivates
|
* so we have to worry about resizing existing devPrivates
|
||||||
*/
|
*/
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
AllocateScreenPrivateIndex()
|
AllocateScreenPrivateIndex(void)
|
||||||
{
|
{
|
||||||
int idx;
|
int idx;
|
||||||
int i;
|
int i;
|
||||||
|
@ -450,13 +450,13 @@ AllocateScreenPrivateIndex()
|
||||||
static int windowPrivateCount;
|
static int windowPrivateCount;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ResetWindowPrivates()
|
ResetWindowPrivates(void)
|
||||||
{
|
{
|
||||||
windowPrivateCount = 1;
|
windowPrivateCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
AllocateWindowPrivateIndex()
|
AllocateWindowPrivateIndex(void)
|
||||||
{
|
{
|
||||||
return windowPrivateCount++;
|
return windowPrivateCount++;
|
||||||
}
|
}
|
||||||
|
@ -500,13 +500,13 @@ AllocateWindowPrivate(ScreenPtr pScreen, int index2, unsigned amount)
|
||||||
static int gcPrivateCount;
|
static int gcPrivateCount;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ResetGCPrivates()
|
ResetGCPrivates(void)
|
||||||
{
|
{
|
||||||
gcPrivateCount = 1;
|
gcPrivateCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
AllocateGCPrivateIndex()
|
AllocateGCPrivateIndex(void)
|
||||||
{
|
{
|
||||||
return gcPrivateCount++;
|
return gcPrivateCount++;
|
||||||
}
|
}
|
||||||
|
@ -549,13 +549,13 @@ AllocateGCPrivate(ScreenPtr pScreen, int index2, unsigned amount)
|
||||||
static int pixmapPrivateCount;
|
static int pixmapPrivateCount;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ResetPixmapPrivates()
|
ResetPixmapPrivates(void)
|
||||||
{
|
{
|
||||||
pixmapPrivateCount = 1;
|
pixmapPrivateCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
AllocatePixmapPrivateIndex()
|
AllocatePixmapPrivateIndex(void)
|
||||||
{
|
{
|
||||||
return pixmapPrivateCount++;
|
return pixmapPrivateCount++;
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@ AllocatePixmapPrivate(ScreenPtr pScreen, int index2, unsigned amount)
|
||||||
int colormapPrivateCount;
|
int colormapPrivateCount;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ResetColormapPrivates()
|
ResetColormapPrivates(void)
|
||||||
{
|
{
|
||||||
colormapPrivateCount = 1;
|
colormapPrivateCount = 1;
|
||||||
}
|
}
|
||||||
|
@ -661,7 +661,7 @@ AllocateColormapPrivateIndex (InitCmapPrivFunc initPrivFunc)
|
||||||
static int devicePrivateIndex = 0;
|
static int devicePrivateIndex = 0;
|
||||||
|
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
AllocateDevicePrivateIndex()
|
AllocateDevicePrivateIndex(void)
|
||||||
{
|
{
|
||||||
return devicePrivateIndex++;
|
return devicePrivateIndex++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,7 +246,7 @@ CreateNewResourceType(DeleteType deleteFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT RESTYPE
|
_X_EXPORT RESTYPE
|
||||||
CreateNewResourceClass()
|
CreateNewResourceClass(void)
|
||||||
{
|
{
|
||||||
RESTYPE next = lastResourceClass >> 1;
|
RESTYPE next = lastResourceClass >> 1;
|
||||||
|
|
||||||
|
@ -868,7 +868,7 @@ FreeClientResources(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FreeAllResources()
|
FreeAllResources(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -2307,7 +2307,7 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
NewInputDeviceRequest(InputOption *options)
|
NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
|
||||||
{
|
{
|
||||||
InputOption *option = NULL;
|
InputOption *option = NULL;
|
||||||
KdPointerInfo *pi = NULL;
|
KdPointerInfo *pi = NULL;
|
||||||
|
@ -2372,5 +2372,16 @@ NewInputDeviceRequest(InputOption *options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pi) {
|
||||||
|
*pdev = pi->dixdev;
|
||||||
|
} else if(ki) {
|
||||||
|
*pdev = ki->dixdev;
|
||||||
|
}
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DeleteInputDeviceRequest(DeviceIntPtr pDev)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -1271,7 +1271,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
|
||||||
(count + 1) * sizeof(IDevRec));
|
(count + 1) * sizeof(IDevRec));
|
||||||
indp[count - 1] = Pointer;
|
indp[count - 1] = Pointer;
|
||||||
indp[count - 1].extraOptions =
|
indp[count - 1].extraOptions =
|
||||||
xf86addNewOption(NULL, "CorePointer", NULL);
|
xf86addNewOption(NULL, xnfstrdup("CorePointer"), NULL);
|
||||||
indp[count].identifier = NULL;
|
indp[count].identifier = NULL;
|
||||||
servlayoutp->inputs = indp;
|
servlayoutp->inputs = indp;
|
||||||
}
|
}
|
||||||
|
@ -1287,9 +1287,13 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
|
||||||
* always synthesize a 'mouse' section configured to send core
|
* always synthesize a 'mouse' section configured to send core
|
||||||
* events, unless a 'void' section is found, in which case the user
|
* events, unless a 'void' section is found, in which case the user
|
||||||
* probably wants to run footless.
|
* probably wants to run footless.
|
||||||
|
*
|
||||||
|
* If you're using an evdev keyboard and expect a default mouse
|
||||||
|
* section ... deal.
|
||||||
*/
|
*/
|
||||||
for (i = servlayoutp->inputs; i->identifier && i->driver; i++) {
|
for (i = servlayoutp->inputs; i->identifier && i->driver; i++) {
|
||||||
if (!strcmp(i->driver, "void") || !strcmp(i->driver, "mouse")) {
|
if (!strcmp(i->driver, "void") || !strcmp(i->driver, "mouse") ||
|
||||||
|
!strcmp(i->driver, "vmmouse") || !strcmp(i->driver, "evdev")) {
|
||||||
found = 1; break;
|
found = 1; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1306,7 +1310,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
|
||||||
(count + 1) * sizeof(IDevRec));
|
(count + 1) * sizeof(IDevRec));
|
||||||
indp[count - 1] = Pointer;
|
indp[count - 1] = Pointer;
|
||||||
indp[count - 1].extraOptions =
|
indp[count - 1].extraOptions =
|
||||||
xf86addNewOption(NULL, "AlwaysCore", NULL);
|
xf86addNewOption(NULL, xnfstrdup("AlwaysCore"), NULL);
|
||||||
indp[count].identifier = NULL;
|
indp[count].identifier = NULL;
|
||||||
servlayoutp->inputs = indp;
|
servlayoutp->inputs = indp;
|
||||||
}
|
}
|
||||||
|
@ -1397,7 +1401,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
|
||||||
(count + 1) * sizeof(IDevRec));
|
(count + 1) * sizeof(IDevRec));
|
||||||
indp[count - 1] = Keyboard;
|
indp[count - 1] = Keyboard;
|
||||||
indp[count - 1].extraOptions =
|
indp[count - 1].extraOptions =
|
||||||
xf86addNewOption(NULL, "CoreKeyboard", NULL);
|
xf86addNewOption(NULL, xnfstrdup("CoreKeyboard"), NULL);
|
||||||
indp[count].identifier = NULL;
|
indp[count].identifier = NULL;
|
||||||
servlayoutp->inputs = indp;
|
servlayoutp->inputs = indp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,13 +309,16 @@ configureInputSection (void)
|
||||||
mouse->inp_identifier = "Mouse0";
|
mouse->inp_identifier = "Mouse0";
|
||||||
mouse->inp_driver = "mouse";
|
mouse->inp_driver = "mouse";
|
||||||
mouse->inp_option_lst =
|
mouse->inp_option_lst =
|
||||||
xf86addNewOption(mouse->inp_option_lst, "Protocol", DFLT_MOUSE_PROTO);
|
xf86addNewOption(mouse->inp_option_lst, xstrdup("Protocol"),
|
||||||
|
xstrdup(DFLT_MOUSE_PROTO));
|
||||||
#ifndef __SCO__
|
#ifndef __SCO__
|
||||||
mouse->inp_option_lst =
|
mouse->inp_option_lst =
|
||||||
xf86addNewOption(mouse->inp_option_lst, "Device", DFLT_MOUSE_DEV);
|
xf86addNewOption(mouse->inp_option_lst, xstrdup("Device"),
|
||||||
|
xstrdup(DFLT_MOUSE_DEV));
|
||||||
#endif
|
#endif
|
||||||
mouse->inp_option_lst =
|
mouse->inp_option_lst =
|
||||||
xf86addNewOption(mouse->inp_option_lst, "ZAxisMapping", "4 5 6 7");
|
xf86addNewOption(mouse->inp_option_lst, xstrdup("ZAxisMapping"),
|
||||||
|
xstrdup("4 5 6 7"));
|
||||||
ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse);
|
ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
@ -519,7 +522,7 @@ configureLayoutSection (void)
|
||||||
iptr->iref_option_lst = NULL;
|
iptr->iref_option_lst = NULL;
|
||||||
iptr->iref_inputdev_str = "Mouse0";
|
iptr->iref_inputdev_str = "Mouse0";
|
||||||
iptr->iref_option_lst =
|
iptr->iref_option_lst =
|
||||||
xf86addNewOption (iptr->iref_option_lst, "CorePointer", NULL);
|
xf86addNewOption (iptr->iref_option_lst, xstrdup("CorePointer"), NULL);
|
||||||
ptr->lay_input_lst = (XF86ConfInputrefPtr)
|
ptr->lay_input_lst = (XF86ConfInputrefPtr)
|
||||||
xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
|
xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
|
||||||
}
|
}
|
||||||
|
@ -532,7 +535,7 @@ configureLayoutSection (void)
|
||||||
iptr->iref_option_lst = NULL;
|
iptr->iref_option_lst = NULL;
|
||||||
iptr->iref_inputdev_str = "Keyboard0";
|
iptr->iref_inputdev_str = "Keyboard0";
|
||||||
iptr->iref_option_lst =
|
iptr->iref_option_lst =
|
||||||
xf86addNewOption (iptr->iref_option_lst, "CoreKeyboard", NULL);
|
xf86addNewOption (iptr->iref_option_lst, xstrdup("CoreKeyboard"), NULL);
|
||||||
ptr->lay_input_lst = (XF86ConfInputrefPtr)
|
ptr->lay_input_lst = (XF86ConfInputrefPtr)
|
||||||
xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
|
xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
|
||||||
}
|
}
|
||||||
|
@ -751,7 +754,7 @@ configureDDCMonitorSection (int screennum)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfiguredMonitor->features.dpms) {
|
if (ConfiguredMonitor->features.dpms) {
|
||||||
ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, "DPMS", NULL);
|
ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, xstrdup("DPMS"), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
|
|
|
@ -249,14 +249,11 @@ DGACloseScreen(int i, ScreenPtr pScreen)
|
||||||
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
|
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
|
||||||
|
|
||||||
if (XDGAEventBase) {
|
if (XDGAEventBase) {
|
||||||
OsBlockSignals();
|
|
||||||
ProcessInputEvents();
|
|
||||||
mieqSetHandler(*XDGAEventBase + MotionNotify, NULL);
|
mieqSetHandler(*XDGAEventBase + MotionNotify, NULL);
|
||||||
mieqSetHandler(*XDGAEventBase + ButtonPress, NULL);
|
mieqSetHandler(*XDGAEventBase + ButtonPress, NULL);
|
||||||
mieqSetHandler(*XDGAEventBase + ButtonRelease, NULL);
|
mieqSetHandler(*XDGAEventBase + ButtonRelease, NULL);
|
||||||
mieqSetHandler(*XDGAEventBase + KeyPress, NULL);
|
mieqSetHandler(*XDGAEventBase + KeyPress, NULL);
|
||||||
mieqSetHandler(*XDGAEventBase + KeyRelease, NULL);
|
mieqSetHandler(*XDGAEventBase + KeyRelease, NULL);
|
||||||
OsReleaseSignals();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeMarkedVisuals(pScreen);
|
FreeMarkedVisuals(pScreen);
|
||||||
|
|
|
@ -371,8 +371,11 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
|
||||||
if (pInp->drv)
|
if (pInp->drv)
|
||||||
pInp->drv->refCount--;
|
pInp->drv->refCount--;
|
||||||
|
|
||||||
|
/* This should *really* be handled in drv->UnInit(dev) call instead */
|
||||||
|
#if 0
|
||||||
if (pInp->private)
|
if (pInp->private)
|
||||||
xfree(pInp->private);
|
xfree(pInp->private);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Remove the entry from the list. */
|
/* Remove the entry from the list. */
|
||||||
if (pInp == xf86InputDevs)
|
if (pInp == xf86InputDevs)
|
||||||
|
|
|
@ -289,7 +289,7 @@ xf86CheckBoolOption(pointer optlist, const char *name, int deflt)
|
||||||
_X_EXPORT pointer
|
_X_EXPORT pointer
|
||||||
xf86ReplaceIntOption(pointer optlist, const char *name, const int val)
|
xf86ReplaceIntOption(pointer optlist, const char *name, const int val)
|
||||||
{
|
{
|
||||||
char *tmp = xnfalloc(16);
|
char tmp[16];
|
||||||
sprintf(tmp,"%i",val);
|
sprintf(tmp,"%i",val);
|
||||||
return xf86AddNewOption(optlist,name,tmp);
|
return xf86AddNewOption(optlist,name,tmp);
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ xf86ReplaceIntOption(pointer optlist, const char *name, const int val)
|
||||||
_X_EXPORT pointer
|
_X_EXPORT pointer
|
||||||
xf86ReplaceRealOption(pointer optlist, const char *name, const double val)
|
xf86ReplaceRealOption(pointer optlist, const char *name, const double val)
|
||||||
{
|
{
|
||||||
char *tmp = xnfalloc(32);
|
char tmp[32];
|
||||||
snprintf(tmp,32,"%f",val);
|
snprintf(tmp,32,"%f",val);
|
||||||
return xf86AddNewOption(optlist,name,tmp);
|
return xf86AddNewOption(optlist,name,tmp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,13 +315,14 @@ AddOtherInputDevices()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
NewInputDeviceRequest (InputOption *options)
|
NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
|
||||||
{
|
{
|
||||||
IDevRec *idev = NULL;
|
IDevRec *idev = NULL;
|
||||||
InputDriverPtr drv = NULL;
|
InputDriverPtr drv = NULL;
|
||||||
InputInfoPtr pInfo = NULL;
|
InputInfoPtr pInfo = NULL;
|
||||||
InputOption *option = NULL;
|
InputOption *option = NULL;
|
||||||
DeviceIntPtr dev = NULL;
|
DeviceIntPtr dev = NULL;
|
||||||
|
int rval = Success;
|
||||||
|
|
||||||
idev = xcalloc(sizeof(*idev), 1);
|
idev = xcalloc(sizeof(*idev), 1);
|
||||||
if (!idev)
|
if (!idev)
|
||||||
|
@ -329,64 +330,122 @@ NewInputDeviceRequest (InputOption *options)
|
||||||
|
|
||||||
for (option = options; option; option = option->next) {
|
for (option = options; option; option = option->next) {
|
||||||
if (strcmp(option->key, "driver") == 0) {
|
if (strcmp(option->key, "driver") == 0) {
|
||||||
if (!xf86LoadOneModule(option->value, NULL))
|
if (idev->driver) {
|
||||||
return BadName;
|
rval = BadRequest;
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
|
/* Memory leak for every attached device if we don't
|
||||||
|
* test if the module is already loaded first */
|
||||||
drv = xf86LookupInputDriver(option->value);
|
drv = xf86LookupInputDriver(option->value);
|
||||||
|
if (!drv)
|
||||||
|
if(xf86LoadOneModule(option->value, NULL))
|
||||||
|
drv = xf86LookupInputDriver(option->value);
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
xf86Msg(X_ERROR, "No input driver matching `%s'\n",
|
xf86Msg(X_ERROR, "No input driver matching `%s'\n",
|
||||||
option->value);
|
option->value);
|
||||||
return BadName;
|
rval = BadName;
|
||||||
|
goto unwind;
|
||||||
}
|
}
|
||||||
idev->driver = xstrdup(option->value);
|
idev->driver = xstrdup(option->value);
|
||||||
if (!idev->driver) {
|
if (!idev->driver) {
|
||||||
xfree(idev);
|
rval = BadAlloc;
|
||||||
return BadAlloc;
|
goto unwind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strcmp(option->key, "name") == 0 ||
|
if (strcmp(option->key, "name") == 0 ||
|
||||||
strcmp(option->key, "identifier") == 0) {
|
strcmp(option->key, "identifier") == 0) {
|
||||||
|
if (idev->identifier) {
|
||||||
|
rval = BadRequest;
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
idev->identifier = xstrdup(option->value);
|
idev->identifier = xstrdup(option->value);
|
||||||
if (!idev->identifier) {
|
if (!idev->identifier) {
|
||||||
xfree(idev);
|
rval = BadAlloc;
|
||||||
return BadAlloc;
|
goto unwind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!idev->driver || !idev->identifier) {
|
||||||
|
xf86Msg(X_ERROR, "No input driver/identifier specified (ignoring)\n");
|
||||||
|
rval = BadRequest;
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
|
|
||||||
if (!drv->PreInit) {
|
if (!drv->PreInit) {
|
||||||
xf86Msg(X_ERROR,
|
xf86Msg(X_ERROR,
|
||||||
"Input driver `%s' has no PreInit function (ignoring)\n",
|
"Input driver `%s' has no PreInit function (ignoring)\n",
|
||||||
drv->driverName);
|
drv->driverName);
|
||||||
return BadImplementation;
|
rval = BadImplementation;
|
||||||
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
idev->commonOptions = NULL;
|
for (option = options; option; option = option->next) {
|
||||||
for (option = options; option; option = option->next)
|
/* Steal option key/value strings from the provided list.
|
||||||
|
* We need those strings, the InputOption list doesn't. */
|
||||||
idev->commonOptions = xf86addNewOption(idev->commonOptions,
|
idev->commonOptions = xf86addNewOption(idev->commonOptions,
|
||||||
option->key, option->value);
|
option->key, option->value);
|
||||||
idev->extraOptions = NULL;
|
option->key = NULL;
|
||||||
|
option->value = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
pInfo = drv->PreInit(drv, idev, 0);
|
pInfo = drv->PreInit(drv, idev, 0);
|
||||||
|
|
||||||
if (!pInfo) {
|
if (!pInfo) {
|
||||||
xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n", idev->identifier);
|
xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n", idev->identifier);
|
||||||
return BadMatch;
|
rval = BadMatch;
|
||||||
|
goto unwind;
|
||||||
}
|
}
|
||||||
else if (!(pInfo->flags & XI86_CONFIGURED)) {
|
else if (!(pInfo->flags & XI86_CONFIGURED)) {
|
||||||
xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
|
xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
|
||||||
idev->identifier);
|
idev->identifier);
|
||||||
xf86DeleteInput(pInfo, 0);
|
rval = BadMatch;
|
||||||
return BadMatch;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
xf86ActivateDevice(pInfo);
|
xf86ActivateDevice(pInfo);
|
||||||
|
|
||||||
dev = pInfo->dev;
|
dev = pInfo->dev;
|
||||||
dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
|
ActivateDevice(dev);
|
||||||
if (dev->inited && dev->startup)
|
if (dev->inited && dev->startup)
|
||||||
EnableDevice(dev);
|
EnableDevice(dev);
|
||||||
|
|
||||||
|
*pdev = dev;
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
|
unwind:
|
||||||
|
if(pInfo) {
|
||||||
|
if(drv->UnInit)
|
||||||
|
drv->UnInit(drv, pInfo, 0);
|
||||||
|
else
|
||||||
|
xf86DeleteInput(pInfo, 0);
|
||||||
|
}
|
||||||
|
if(idev->driver)
|
||||||
|
xfree(idev->driver);
|
||||||
|
if(idev->identifier)
|
||||||
|
xfree(idev->identifier);
|
||||||
|
xf86optionListFree(idev->commonOptions);
|
||||||
|
xfree(idev);
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DeleteInputDeviceRequest(DeviceIntPtr pDev)
|
||||||
|
{
|
||||||
|
LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate;
|
||||||
|
InputDriverPtr drv = pInfo->drv;
|
||||||
|
IDevRec *idev = pInfo->conf_idev;
|
||||||
|
|
||||||
|
RemoveDevice(pDev);
|
||||||
|
|
||||||
|
if(drv->UnInit)
|
||||||
|
drv->UnInit(drv, pInfo, 0);
|
||||||
|
else
|
||||||
|
xf86DeleteInput(pInfo, 0);
|
||||||
|
|
||||||
|
xfree(idev->driver);
|
||||||
|
xfree(idev->identifier);
|
||||||
|
xf86optionListFree(idev->commonOptions);
|
||||||
|
xfree(idev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -43,6 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#define NEED_REPLIES
|
#define NEED_REPLIES
|
||||||
#define NEED_EVENTS
|
#define NEED_EVENTS
|
||||||
|
@ -77,6 +78,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
extern Bool noPanoramiXExtension;
|
extern Bool noPanoramiXExtension;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int DRIEntPrivIndex = -1;
|
||||||
static int DRIScreenPrivIndex = -1;
|
static int DRIScreenPrivIndex = -1;
|
||||||
static int DRIWindowPrivIndex = -1;
|
static int DRIWindowPrivIndex = -1;
|
||||||
static unsigned long DRIGeneration = 0;
|
static unsigned long DRIGeneration = 0;
|
||||||
|
@ -112,18 +114,203 @@ DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
DRIOpenDRMCleanup(DRIEntPrivPtr pDRIEntPriv)
|
||||||
|
{
|
||||||
|
if (pDRIEntPriv->pLSAREA != NULL) {
|
||||||
|
drmUnmap(pDRIEntPriv->pLSAREA, pDRIEntPriv->sAreaSize);
|
||||||
|
pDRIEntPriv->pLSAREA = NULL;
|
||||||
|
}
|
||||||
|
if (pDRIEntPriv->hLSAREA != 0) {
|
||||||
|
drmRmMap(pDRIEntPriv->drmFD, pDRIEntPriv->hLSAREA);
|
||||||
|
}
|
||||||
|
if (pDRIEntPriv->drmFD >= 0) {
|
||||||
|
drmClose(pDRIEntPriv->drmFD);
|
||||||
|
pDRIEntPriv->drmFD = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DRIMasterFD(ScrnInfoPtr pScrn)
|
||||||
|
{
|
||||||
|
return DRI_ENT_PRIV(pScrn)->drmFD;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
DRIMasterSareaPointer(ScrnInfoPtr pScrn)
|
||||||
|
{
|
||||||
|
return DRI_ENT_PRIV(pScrn)->pLSAREA;
|
||||||
|
}
|
||||||
|
|
||||||
|
drm_handle_t
|
||||||
|
DRIMasterSareaHandle(ScrnInfoPtr pScrn)
|
||||||
|
{
|
||||||
|
return DRI_ENT_PRIV(pScrn)->hLSAREA;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Bool
|
||||||
|
DRIOpenDRMMaster(ScrnInfoPtr pScrn,
|
||||||
|
unsigned long sAreaSize,
|
||||||
|
const char *busID,
|
||||||
|
const char *drmDriverName)
|
||||||
|
{
|
||||||
|
drmSetVersion saveSv, sv;
|
||||||
|
Bool drmWasAvailable;
|
||||||
|
DRIEntPrivPtr pDRIEntPriv;
|
||||||
|
DRIEntPrivRec tmp;
|
||||||
|
drmVersionPtr drmlibv;
|
||||||
|
int drmlibmajor, drmlibminor;
|
||||||
|
const char *openBusID;
|
||||||
|
int count;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
if (DRIEntPrivIndex == -1)
|
||||||
|
DRIEntPrivIndex = xf86AllocateEntityPrivateIndex();
|
||||||
|
|
||||||
|
pDRIEntPriv = DRI_ENT_PRIV(pScrn);
|
||||||
|
|
||||||
|
if (pDRIEntPriv && pDRIEntPriv->drmFD != -1)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
drmWasAvailable = drmAvailable();
|
||||||
|
|
||||||
|
memset(&tmp, 0, sizeof(tmp));
|
||||||
|
|
||||||
|
/* Check the DRM lib version.
|
||||||
|
* drmGetLibVersion was not supported in version 1.0, so check for
|
||||||
|
* symbol first to avoid possible crash or hang.
|
||||||
|
*/
|
||||||
|
|
||||||
|
drmlibmajor = 1;
|
||||||
|
drmlibminor = 0;
|
||||||
|
if (xf86LoaderCheckSymbol("drmGetLibVersion")) {
|
||||||
|
drmlibv = drmGetLibVersion(-1);
|
||||||
|
if (drmlibv != NULL) {
|
||||||
|
drmlibmajor = drmlibv->version_major;
|
||||||
|
drmlibminor = drmlibv->version_minor;
|
||||||
|
drmFreeVersion(drmlibv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if the libdrm can handle falling back to loading based on name
|
||||||
|
* if a busid string is passed.
|
||||||
|
*/
|
||||||
|
openBusID = (drmlibmajor == 1 && drmlibminor >= 2) ? busID : NULL;
|
||||||
|
|
||||||
|
tmp.drmFD = -1;
|
||||||
|
sv.drm_di_major = 1;
|
||||||
|
sv.drm_di_minor = 1;
|
||||||
|
sv.drm_dd_major = -1;
|
||||||
|
|
||||||
|
saveSv = sv;
|
||||||
|
count = 10;
|
||||||
|
while (count--) {
|
||||||
|
tmp.drmFD = drmOpen(drmDriverName, openBusID);
|
||||||
|
|
||||||
|
if (tmp.drmFD < 0) {
|
||||||
|
DRIDrvMsg(-1, X_ERROR, "[drm] drmOpen failed.\n");
|
||||||
|
goto out_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = drmSetInterfaceVersion(tmp.drmFD, &sv);
|
||||||
|
|
||||||
|
if (err != -EPERM)
|
||||||
|
break;
|
||||||
|
|
||||||
|
sv = saveSv;
|
||||||
|
drmClose(tmp.drmFD);
|
||||||
|
tmp.drmFD = -1;
|
||||||
|
usleep(100000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tmp.drmFD <= 0) {
|
||||||
|
DRIDrvMsg(-1, X_ERROR, "[drm] DRM was busy with another master.\n");
|
||||||
|
goto out_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!drmWasAvailable) {
|
||||||
|
DRIDrvMsg(-1, X_INFO,
|
||||||
|
"[drm] loaded kernel module for \"%s\" driver.\n",
|
||||||
|
drmDriverName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err != 0) {
|
||||||
|
sv.drm_di_major = 1;
|
||||||
|
sv.drm_di_minor = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DRIDrvMsg(-1, X_INFO, "[drm] DRM interface version %d.%d\n",
|
||||||
|
sv.drm_di_major, sv.drm_di_minor);
|
||||||
|
|
||||||
|
if (sv.drm_di_major == 1 && sv.drm_di_minor >= 1)
|
||||||
|
err = 0;
|
||||||
|
else
|
||||||
|
err = drmSetBusid(tmp.drmFD, busID);
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
DRIDrvMsg(-1, X_ERROR, "[drm] Could not set DRM device bus ID.\n");
|
||||||
|
goto out_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a lock-containing sarea.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (drmAddMap( tmp.drmFD, 0, sAreaSize, DRM_SHM,
|
||||||
|
DRM_CONTAINS_LOCK, &tmp.hLSAREA) < 0) {
|
||||||
|
DRIDrvMsg(-1, X_INFO, "[drm] Could not create SAREA for DRM lock.\n");
|
||||||
|
tmp.hLSAREA = 0;
|
||||||
|
goto out_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drmMap( tmp.drmFD, tmp.hLSAREA, sAreaSize,
|
||||||
|
(drmAddressPtr)(&tmp.pLSAREA)) < 0) {
|
||||||
|
DRIDrvMsg(-1, X_INFO, "[drm] Mapping SAREA for DRM lock failed.\n");
|
||||||
|
tmp.pLSAREA = NULL;
|
||||||
|
goto out_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(tmp.pLSAREA, 0, sAreaSize);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reserved contexts are handled by the first opened screen.
|
||||||
|
*/
|
||||||
|
|
||||||
|
tmp.resOwner = NULL;
|
||||||
|
|
||||||
|
if (!pDRIEntPriv)
|
||||||
|
pDRIEntPriv = xnfcalloc(sizeof(*pDRIEntPriv), 1);
|
||||||
|
|
||||||
|
if (!pDRIEntPriv) {
|
||||||
|
DRIDrvMsg(-1, X_INFO, "[drm] Failed to allocate memory for "
|
||||||
|
"DRM device.\n");
|
||||||
|
goto out_err;
|
||||||
|
}
|
||||||
|
*pDRIEntPriv = tmp;
|
||||||
|
xf86GetEntityPrivate((pScrn)->entityList[0],DRIEntPrivIndex)->ptr =
|
||||||
|
pDRIEntPriv;
|
||||||
|
|
||||||
|
DRIDrvMsg(-1, X_INFO, "[drm] DRM open master succeeded.\n");
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
out_err:
|
||||||
|
|
||||||
|
DRIOpenDRMCleanup(&tmp);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
||||||
{
|
{
|
||||||
DRIScreenPrivPtr pDRIPriv;
|
DRIScreenPrivPtr pDRIPriv;
|
||||||
drm_context_t * reserved;
|
drm_context_t * reserved;
|
||||||
int reserved_count;
|
int reserved_count;
|
||||||
int i, fd, drmWasAvailable;
|
int i;
|
||||||
Bool xineramaInCore = FALSE;
|
Bool xineramaInCore = FALSE;
|
||||||
int err = 0;
|
DRIEntPrivPtr pDRIEntPriv;
|
||||||
char *openbusid;
|
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||||
drmVersionPtr drmlibv;
|
|
||||||
int drmlibmajor, drmlibminor, drmdimajor, drmdiminor;
|
|
||||||
|
|
||||||
if (DRIGeneration != serverGeneration) {
|
if (DRIGeneration != serverGeneration) {
|
||||||
if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
|
if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
|
||||||
|
@ -153,47 +340,12 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drmWasAvailable = drmAvailable();
|
if (!DRIOpenDRMMaster(pScrn, pDRIInfo->SAREASize,
|
||||||
|
pDRIInfo->busIdString,
|
||||||
|
pDRIInfo->drmDriverName))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
/* Check the DRM lib version.
|
pDRIEntPriv = DRI_ENT_PRIV(pScrn);
|
||||||
* drmGetLibVersion was not supported in version 1.0, so check for
|
|
||||||
* symbol first to avoid possible crash or hang.
|
|
||||||
*/
|
|
||||||
drmlibmajor = 1;
|
|
||||||
drmlibminor = 0;
|
|
||||||
if (xf86LoaderCheckSymbol("drmGetLibVersion")) {
|
|
||||||
drmlibv = drmGetLibVersion(-1);
|
|
||||||
if (drmlibv != NULL) {
|
|
||||||
drmlibmajor = drmlibv->version_major;
|
|
||||||
drmlibminor = drmlibv->version_minor;
|
|
||||||
drmFreeVersion(drmlibv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if the libdrm can handle falling back to loading based on name
|
|
||||||
* if a busid string is passed.
|
|
||||||
*/
|
|
||||||
if (drmlibmajor == 1 && drmlibminor >= 2)
|
|
||||||
openbusid = pDRIInfo->busIdString;
|
|
||||||
else
|
|
||||||
openbusid = NULL;
|
|
||||||
|
|
||||||
/* Note that drmOpen will try to load the kernel module, if needed. */
|
|
||||||
fd = drmOpen(pDRIInfo->drmDriverName, openbusid);
|
|
||||||
if (fd < 0) {
|
|
||||||
/* failed to open DRM */
|
|
||||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
|
||||||
"[drm] drmOpen failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!drmWasAvailable) {
|
|
||||||
/* drmOpen loaded the kernel module, print a message to say so */
|
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
|
||||||
"[drm] loaded kernel module for \"%s\" driver\n",
|
|
||||||
pDRIInfo->drmDriverName);
|
|
||||||
}
|
|
||||||
|
|
||||||
pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
|
pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
|
||||||
if (!pDRIPriv) {
|
if (!pDRIPriv) {
|
||||||
|
@ -202,7 +354,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
||||||
}
|
}
|
||||||
|
|
||||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv;
|
pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv;
|
||||||
pDRIPriv->drmFD = fd;
|
pDRIPriv->drmFD = pDRIEntPriv->drmFD;
|
||||||
pDRIPriv->directRenderingSupport = TRUE;
|
pDRIPriv->directRenderingSupport = TRUE;
|
||||||
pDRIPriv->pDriverInfo = pDRIInfo;
|
pDRIPriv->pDriverInfo = pDRIInfo;
|
||||||
pDRIPriv->nrWindows = 0;
|
pDRIPriv->nrWindows = 0;
|
||||||
|
@ -214,89 +366,54 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
||||||
|
|
||||||
pDRIPriv->grabbedDRILock = FALSE;
|
pDRIPriv->grabbedDRILock = FALSE;
|
||||||
pDRIPriv->drmSIGIOHandlerInstalled = FALSE;
|
pDRIPriv->drmSIGIOHandlerInstalled = FALSE;
|
||||||
|
|
||||||
if (drmlibmajor == 1 && drmlibminor >= 2) {
|
|
||||||
drmSetVersion sv;
|
|
||||||
|
|
||||||
/* Get the interface version, asking for 1.1. */
|
|
||||||
sv.drm_di_major = 1;
|
|
||||||
sv.drm_di_minor = 1;
|
|
||||||
sv.drm_dd_major = -1;
|
|
||||||
err = drmSetInterfaceVersion(pDRIPriv->drmFD, &sv);
|
|
||||||
if (err == 0) {
|
|
||||||
drmdimajor = sv.drm_di_major;
|
|
||||||
drmdiminor = sv.drm_di_minor;
|
|
||||||
} else {
|
|
||||||
/* failure, so set it to 1.0.0. */
|
|
||||||
drmdimajor = 1;
|
|
||||||
drmdiminor = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* We can't check the DI DRM interface version, so set it to 1.0.0. */
|
|
||||||
drmdimajor = 1;
|
|
||||||
drmdiminor = 0;
|
|
||||||
}
|
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
|
||||||
"[drm] DRM interface version %d.%d\n", drmdimajor, drmdiminor);
|
|
||||||
|
|
||||||
/* If the interface minor number is 1.1, then we've opened a DRM device
|
|
||||||
* that already had the busid set through drmOpen.
|
|
||||||
*/
|
|
||||||
if (drmdimajor == 1 && drmdiminor >= 1)
|
|
||||||
err = 0;
|
|
||||||
else
|
|
||||||
err = drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString);
|
|
||||||
|
|
||||||
if (err < 0) {
|
|
||||||
pDRIPriv->directRenderingSupport = FALSE;
|
|
||||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
|
||||||
drmClose(pDRIPriv->drmFD);
|
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
|
||||||
"[drm] drmSetBusid failed (%d, %s), %s\n",
|
|
||||||
pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString, strerror(-err));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*pDRMFD = pDRIPriv->drmFD;
|
*pDRMFD = pDRIPriv->drmFD;
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
|
||||||
"[drm] created \"%s\" driver at busid \"%s\"\n",
|
|
||||||
pDRIPriv->pDriverInfo->drmDriverName,
|
|
||||||
pDRIPriv->pDriverInfo->busIdString);
|
|
||||||
|
|
||||||
if (drmAddMap( pDRIPriv->drmFD,
|
if (pDRIEntPriv->sAreaGrabbed || pDRIInfo->allocSarea) {
|
||||||
0,
|
|
||||||
pDRIPriv->pDriverInfo->SAREASize,
|
|
||||||
DRM_SHM,
|
|
||||||
DRM_CONTAINS_LOCK,
|
|
||||||
&pDRIPriv->hSAREA) < 0)
|
|
||||||
{
|
|
||||||
pDRIPriv->directRenderingSupport = FALSE;
|
|
||||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
|
||||||
drmClose(pDRIPriv->drmFD);
|
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
|
||||||
"[drm] drmAddMap failed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
|
||||||
"[drm] added %d byte SAREA at %p\n",
|
|
||||||
pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA);
|
|
||||||
|
|
||||||
if (drmMap( pDRIPriv->drmFD,
|
if (drmAddMap( pDRIPriv->drmFD,
|
||||||
pDRIPriv->hSAREA,
|
0,
|
||||||
pDRIPriv->pDriverInfo->SAREASize,
|
pDRIPriv->pDriverInfo->SAREASize,
|
||||||
(drmAddressPtr)(&pDRIPriv->pSAREA)) < 0)
|
DRM_SHM,
|
||||||
{
|
0,
|
||||||
pDRIPriv->directRenderingSupport = FALSE;
|
&pDRIPriv->hSAREA) < 0)
|
||||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
{
|
||||||
drmClose(pDRIPriv->drmFD);
|
pDRIPriv->directRenderingSupport = FALSE;
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
||||||
"[drm] drmMap failed\n");
|
drmClose(pDRIPriv->drmFD);
|
||||||
return FALSE;
|
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||||
|
"[drm] drmAddMap failed\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||||
|
"[drm] added %d byte SAREA at %p\n",
|
||||||
|
pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA);
|
||||||
|
|
||||||
|
/* Backwards compat. */
|
||||||
|
if (drmMap( pDRIPriv->drmFD,
|
||||||
|
pDRIPriv->hSAREA,
|
||||||
|
pDRIPriv->pDriverInfo->SAREASize,
|
||||||
|
(drmAddressPtr)(&pDRIPriv->pSAREA)) < 0)
|
||||||
|
{
|
||||||
|
pDRIPriv->directRenderingSupport = FALSE;
|
||||||
|
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
||||||
|
drmClose(pDRIPriv->drmFD);
|
||||||
|
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||||
|
"[drm] drmMap failed\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n",
|
||||||
|
pDRIPriv->hSAREA, pDRIPriv->pSAREA);
|
||||||
|
memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize);
|
||||||
|
} else {
|
||||||
|
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] Using the DRM lock "
|
||||||
|
"SAREA also for drawables.\n");
|
||||||
|
pDRIPriv->hSAREA = pDRIEntPriv->hLSAREA;
|
||||||
|
pDRIPriv->pSAREA = (XF86DRISAREAPtr) pDRIEntPriv->pLSAREA;
|
||||||
|
pDRIEntPriv->sAreaGrabbed = TRUE;
|
||||||
}
|
}
|
||||||
memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize);
|
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n",
|
pDRIPriv->hLSAREA = pDRIEntPriv->hLSAREA;
|
||||||
pDRIPriv->hSAREA, pDRIPriv->pSAREA);
|
pDRIPriv->pLSAREA = pDRIEntPriv->pLSAREA;
|
||||||
|
|
||||||
if (drmAddMap( pDRIPriv->drmFD,
|
if (drmAddMap( pDRIPriv->drmFD,
|
||||||
(drm_handle_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress,
|
(drm_handle_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress,
|
||||||
|
@ -316,22 +433,26 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n",
|
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n",
|
||||||
pDRIPriv->hFrameBuffer);
|
pDRIPriv->hFrameBuffer);
|
||||||
|
|
||||||
/* Add tags for reserved contexts */
|
if (pDRIEntPriv->resOwner == NULL) {
|
||||||
if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
|
pDRIEntPriv->resOwner = pScreen;
|
||||||
&reserved_count))) {
|
|
||||||
int i;
|
|
||||||
void *tag;
|
|
||||||
|
|
||||||
for (i = 0; i < reserved_count; i++) {
|
/* Add tags for reserved contexts */
|
||||||
tag = DRICreateContextPrivFromHandle(pScreen,
|
if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
|
||||||
reserved[i],
|
&reserved_count))) {
|
||||||
DRI_CONTEXT_RESERVED);
|
int i;
|
||||||
drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag);
|
void *tag;
|
||||||
|
|
||||||
|
for (i = 0; i < reserved_count; i++) {
|
||||||
|
tag = DRICreateContextPrivFromHandle(pScreen,
|
||||||
|
reserved[i],
|
||||||
|
DRI_CONTEXT_RESERVED);
|
||||||
|
drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag);
|
||||||
|
}
|
||||||
|
drmFreeReservedContextList(reserved);
|
||||||
|
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||||
|
"[drm] added %d reserved context%s for kernel\n",
|
||||||
|
reserved_count, reserved_count > 1 ? "s" : "");
|
||||||
}
|
}
|
||||||
drmFreeReservedContextList(reserved);
|
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
|
||||||
"[drm] added %d reserved context%s for kernel\n",
|
|
||||||
reserved_count, reserved_count > 1 ? "s" : "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* validate max drawable table entry set by driver */
|
/* validate max drawable table entry set by driver */
|
||||||
|
@ -349,6 +470,11 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
||||||
pDRIPriv->pSAREA->drawableTable[i].flags = 0;
|
pDRIPriv->pSAREA->drawableTable[i].flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pDRIPriv->pLockRefCount = &pDRIEntPriv->lockRefCount;
|
||||||
|
pDRIPriv->pLockingContext = &pDRIEntPriv->lockingContext;
|
||||||
|
|
||||||
|
pDRIEntPriv->refCount++;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,6 +616,9 @@ DRICloseScreen(ScreenPtr pScreen)
|
||||||
DRIInfoPtr pDRIInfo;
|
DRIInfoPtr pDRIInfo;
|
||||||
drm_context_t * reserved;
|
drm_context_t * reserved;
|
||||||
int reserved_count;
|
int reserved_count;
|
||||||
|
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||||
|
DRIEntPrivPtr pDRIEntPriv = DRI_ENT_PRIV(pScrn);
|
||||||
|
Bool closeMaster;
|
||||||
|
|
||||||
if (pDRIPriv && pDRIPriv->directRenderingSupport) {
|
if (pDRIPriv && pDRIPriv->directRenderingSupport) {
|
||||||
|
|
||||||
|
@ -542,38 +671,55 @@ DRICloseScreen(ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove tags for reserved contexts */
|
/* Remove tags for reserved contexts */
|
||||||
if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
|
if (pDRIEntPriv->resOwner == pScreen) {
|
||||||
&reserved_count))) {
|
pDRIEntPriv->resOwner = NULL;
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < reserved_count; i++) {
|
if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
|
||||||
DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmFD,
|
&reserved_count))) {
|
||||||
reserved[i]));
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < reserved_count; i++) {
|
||||||
|
DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmFD,
|
||||||
|
reserved[i]));
|
||||||
|
}
|
||||||
|
drmFreeReservedContextList(reserved);
|
||||||
|
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||||
|
"[drm] removed %d reserved context%s for kernel\n",
|
||||||
|
reserved_count, reserved_count > 1 ? "s" : "");
|
||||||
}
|
}
|
||||||
drmFreeReservedContextList(reserved);
|
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
|
||||||
"[drm] removed %d reserved context%s for kernel\n",
|
|
||||||
reserved_count, reserved_count > 1 ? "s" : "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure signals get unblocked etc. */
|
/* Make sure signals get unblocked etc. */
|
||||||
drmUnlock(pDRIPriv->drmFD, pDRIPriv->myContext);
|
drmUnlock(pDRIPriv->drmFD, pDRIPriv->myContext);
|
||||||
pDRIPriv->lockRefCount = 0;
|
pDRIPriv->pLockRefCount = NULL;
|
||||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
closeMaster = (--pDRIEntPriv->refCount == 0) &&
|
||||||
"[drm] unmapping %d bytes of SAREA %p at %p\n",
|
!pDRIEntPriv->keepFDOpen;
|
||||||
pDRIInfo->SAREASize,
|
if (closeMaster || pDRIPriv->hSAREA != pDRIEntPriv->hLSAREA) {
|
||||||
pDRIPriv->hSAREA,
|
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||||
pDRIPriv->pSAREA);
|
"[drm] unmapping %d bytes of SAREA %p at %p\n",
|
||||||
if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) {
|
|
||||||
DRIDrvMsg(pScreen->myNum, X_ERROR,
|
|
||||||
"[drm] unable to unmap %d bytes"
|
|
||||||
" of SAREA %p at %p\n",
|
|
||||||
pDRIInfo->SAREASize,
|
pDRIInfo->SAREASize,
|
||||||
pDRIPriv->hSAREA,
|
pDRIPriv->hSAREA,
|
||||||
pDRIPriv->pSAREA);
|
pDRIPriv->pSAREA);
|
||||||
|
if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) {
|
||||||
|
DRIDrvMsg(pScreen->myNum, X_ERROR,
|
||||||
|
"[drm] unable to unmap %d bytes"
|
||||||
|
" of SAREA %p at %p\n",
|
||||||
|
pDRIInfo->SAREASize,
|
||||||
|
pDRIPriv->hSAREA,
|
||||||
|
pDRIPriv->pSAREA);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pDRIEntPriv->sAreaGrabbed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
drmClose(pDRIPriv->drmFD);
|
if (closeMaster || (pDRIEntPriv->drmFD != pDRIPriv->drmFD)) {
|
||||||
|
drmClose(pDRIPriv->drmFD);
|
||||||
|
if (pDRIEntPriv->drmFD == pDRIPriv->drmFD) {
|
||||||
|
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||||
|
"[drm] Closed DRM master.\n");
|
||||||
|
pDRIEntPriv->drmFD = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
xfree(pDRIPriv);
|
xfree(pDRIPriv);
|
||||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
||||||
|
@ -2001,28 +2147,46 @@ void
|
||||||
DRILock(ScreenPtr pScreen, int flags)
|
DRILock(ScreenPtr pScreen, int flags)
|
||||||
{
|
{
|
||||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||||
if(!pDRIPriv) return;
|
|
||||||
|
|
||||||
if (!pDRIPriv->lockRefCount)
|
if(!pDRIPriv || !pDRIPriv->pLockRefCount) return;
|
||||||
DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext, flags);
|
|
||||||
pDRIPriv->lockRefCount++;
|
if (!*pDRIPriv->pLockRefCount) {
|
||||||
|
DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext, flags);
|
||||||
|
*pDRIPriv->pLockingContext = pDRIPriv->myContext;
|
||||||
|
} else if (*pDRIPriv->pLockingContext != pDRIPriv->myContext) {
|
||||||
|
DRIDrvMsg(pScreen->myNum, X_ERROR,
|
||||||
|
"[DRI] Locking deadlock.\n"
|
||||||
|
"\tAlready locked with context %d,\n"
|
||||||
|
"\ttrying to lock with context %d.\n",
|
||||||
|
pDRIPriv->pLockingContext,
|
||||||
|
pDRIPriv->myContext);
|
||||||
|
}
|
||||||
|
(*pDRIPriv->pLockRefCount)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DRIUnlock(ScreenPtr pScreen)
|
DRIUnlock(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||||
if(!pDRIPriv) return;
|
|
||||||
|
|
||||||
if (pDRIPriv->lockRefCount > 0) {
|
if(!pDRIPriv || !pDRIPriv->pLockRefCount) return;
|
||||||
pDRIPriv->lockRefCount--;
|
|
||||||
}
|
if (*pDRIPriv->pLockRefCount > 0) {
|
||||||
else {
|
if (pDRIPriv->myContext != *pDRIPriv->pLockingContext) {
|
||||||
ErrorF("DRIUnlock called when not locked\n");
|
DRIDrvMsg(pScreen->myNum, X_ERROR,
|
||||||
|
"[DRI] Unlocking inconsistency:\n"
|
||||||
|
"\tContext %d trying to unlock lock held by context %d\n",
|
||||||
|
pDRIPriv->pLockingContext,
|
||||||
|
pDRIPriv->myContext);
|
||||||
|
}
|
||||||
|
(*pDRIPriv->pLockRefCount)--;
|
||||||
|
} else {
|
||||||
|
DRIDrvMsg(pScreen->myNum, X_ERROR,
|
||||||
|
"DRIUnlock called when not locked.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!pDRIPriv->lockRefCount)
|
if (! *pDRIPriv->pLockRefCount)
|
||||||
DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext);
|
DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
|
|
|
@ -107,7 +107,7 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DRIINFO_MAJOR_VERSION 5
|
#define DRIINFO_MAJOR_VERSION 5
|
||||||
#define DRIINFO_MINOR_VERSION 1
|
#define DRIINFO_MINOR_VERSION 2
|
||||||
#define DRIINFO_PATCH_VERSION 0
|
#define DRIINFO_PATCH_VERSION 0
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -176,9 +176,17 @@ typedef struct {
|
||||||
|
|
||||||
/* New with DRI version 5.1.0 */
|
/* New with DRI version 5.1.0 */
|
||||||
void (*ClipNotify)(ScreenPtr pScreen, WindowPtr *ppWin, int num);
|
void (*ClipNotify)(ScreenPtr pScreen, WindowPtr *ppWin, int num);
|
||||||
|
|
||||||
|
/* New with DRI version 5.2.0 */
|
||||||
|
Bool allocSarea;
|
||||||
|
Bool keepFDOpen;
|
||||||
} DRIInfoRec, *DRIInfoPtr;
|
} DRIInfoRec, *DRIInfoPtr;
|
||||||
|
|
||||||
|
|
||||||
|
extern Bool DRIOpenDRMMaster(ScrnInfoPtr pScrn, unsigned long sAreaSize,
|
||||||
|
const char *busID,
|
||||||
|
const char *drmDriverName);
|
||||||
|
|
||||||
extern Bool DRIScreenInit(ScreenPtr pScreen,
|
extern Bool DRIScreenInit(ScreenPtr pScreen,
|
||||||
DRIInfoPtr pDRIInfo,
|
DRIInfoPtr pDRIInfo,
|
||||||
int *pDRMFD);
|
int *pDRMFD);
|
||||||
|
@ -344,6 +352,14 @@ extern char *DRICreatePCIBusID(pciVideoPtr PciInfo);
|
||||||
|
|
||||||
extern int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *));
|
extern int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *));
|
||||||
extern int drmRemoveSIGIOHandler(int fd);
|
extern int drmRemoveSIGIOHandler(int fd);
|
||||||
|
extern int DRIMasterFD(ScrnInfoPtr pScrn);
|
||||||
|
|
||||||
|
extern void *DRIMasterSareaPointer(ScrnInfoPtr pScrn);
|
||||||
|
|
||||||
|
extern drm_handle_t DRIMasterSareaHandle(ScrnInfoPtr pScrn);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define _DRI_H_
|
#define _DRI_H_
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,6 +73,11 @@ struct _DRIContextPrivRec
|
||||||
#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
|
#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
|
||||||
(screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr))
|
(screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr))
|
||||||
|
|
||||||
|
#define DRI_ENT_PRIV(pScrn) \
|
||||||
|
((DRIEntPrivIndex < 0) ? \
|
||||||
|
NULL: \
|
||||||
|
((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \
|
||||||
|
DRIEntPrivIndex)->ptr)))
|
||||||
|
|
||||||
typedef struct _DRIScreenPrivRec
|
typedef struct _DRIScreenPrivRec
|
||||||
{
|
{
|
||||||
|
@ -103,6 +108,25 @@ typedef struct _DRIScreenPrivRec
|
||||||
Bool wrapped;
|
Bool wrapped;
|
||||||
Bool windowsTouched;
|
Bool windowsTouched;
|
||||||
int lockRefCount;
|
int lockRefCount;
|
||||||
|
drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */
|
||||||
|
XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */
|
||||||
|
int* pLockRefCount;
|
||||||
|
int* pLockingContext;
|
||||||
} DRIScreenPrivRec, *DRIScreenPrivPtr;
|
} DRIScreenPrivRec, *DRIScreenPrivPtr;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _DRIEntPrivRec {
|
||||||
|
int drmFD;
|
||||||
|
Bool drmOpened;
|
||||||
|
Bool sAreaGrabbed;
|
||||||
|
drm_handle_t hLSAREA;
|
||||||
|
XF86DRILSAREAPtr pLSAREA;
|
||||||
|
unsigned long sAreaSize;
|
||||||
|
int lockRefCount;
|
||||||
|
int lockingContext;
|
||||||
|
ScreenPtr resOwner;
|
||||||
|
Bool keepFDOpen;
|
||||||
|
int refCount;
|
||||||
|
} DRIEntPrivRec, *DRIEntPrivPtr;
|
||||||
|
|
||||||
#endif /* DRI_STRUCT_H */
|
#endif /* DRI_STRUCT_H */
|
||||||
|
|
|
@ -89,4 +89,9 @@ typedef struct _XF86DRISAREA {
|
||||||
drm_context_t dummy_context;
|
drm_context_t dummy_context;
|
||||||
} XF86DRISAREARec, *XF86DRISAREAPtr;
|
} XF86DRISAREARec, *XF86DRISAREAPtr;
|
||||||
|
|
||||||
|
typedef struct _XF86DRILSAREA {
|
||||||
|
drmLock lock;
|
||||||
|
drmLock otherLocks[31];
|
||||||
|
} XF86DRILSAREARec, *XF86DRILSAREAPtr;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -869,7 +869,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
|
||||||
for (cim = compiled_in_modules; *cim; cim++)
|
for (cim = compiled_in_modules; *cim; cim++)
|
||||||
if (!strcmp (module, *cim))
|
if (!strcmp (module, *cim))
|
||||||
{
|
{
|
||||||
xf86MsgVerb(X_INFO, 3, "Module already built-in\n");
|
xf86MsgVerb(X_INFO, 0, "Module already built-in\n");
|
||||||
return (ModuleDescPtr) 1;
|
return (ModuleDescPtr) 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,8 +233,6 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
|
||||||
int saved_x, saved_y;
|
int saved_x, saved_y;
|
||||||
Rotation saved_rotation;
|
Rotation saved_rotation;
|
||||||
|
|
||||||
adjusted_mode = xf86DuplicateMode(mode);
|
|
||||||
|
|
||||||
crtc->enabled = xf86CrtcInUse (crtc);
|
crtc->enabled = xf86CrtcInUse (crtc);
|
||||||
|
|
||||||
if (!crtc->enabled)
|
if (!crtc->enabled)
|
||||||
|
@ -243,6 +241,8 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
adjusted_mode = xf86DuplicateMode(mode);
|
||||||
|
|
||||||
didLock = crtc->funcs->lock (crtc);
|
didLock = crtc->funcs->lock (crtc);
|
||||||
|
|
||||||
saved_mode = crtc->mode;
|
saved_mode = crtc->mode;
|
||||||
|
@ -414,22 +414,51 @@ xf86OutputSetMonitor (xf86OutputPtr output)
|
||||||
xfree (option_name);
|
xfree (option_name);
|
||||||
output->conf_monitor = xf86findMonitor (monitor,
|
output->conf_monitor = xf86findMonitor (monitor,
|
||||||
xf86configptr->conf_monitor_lst);
|
xf86configptr->conf_monitor_lst);
|
||||||
|
/*
|
||||||
|
* Find the monitor section of the screen and use that
|
||||||
|
*/
|
||||||
|
if (!output->conf_monitor && output->use_screen_monitor)
|
||||||
|
output->conf_monitor = xf86findMonitor (output->scrn->monitor->id,
|
||||||
|
xf86configptr->conf_monitor_lst);
|
||||||
if (output->conf_monitor)
|
if (output->conf_monitor)
|
||||||
|
{
|
||||||
|
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
|
||||||
|
"Output %s using monitor section %s\n",
|
||||||
|
output->name, output->conf_monitor->mon_identifier);
|
||||||
xf86ProcessOptions (output->scrn->scrnIndex,
|
xf86ProcessOptions (output->scrn->scrnIndex,
|
||||||
output->conf_monitor->mon_option_lst,
|
output->conf_monitor->mon_option_lst,
|
||||||
output->options);
|
output->options);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
|
||||||
|
"Output %s has no monitor section\n",
|
||||||
|
output->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
xf86OutputEnabled (xf86OutputPtr output)
|
xf86OutputEnabled (xf86OutputPtr output)
|
||||||
{
|
{
|
||||||
/* Check to see if this output was disabled in the config file */
|
Bool enable, disable;
|
||||||
if (xf86ReturnOptValBool (output->options, OPTION_ENABLE, TRUE) == FALSE ||
|
|
||||||
xf86ReturnOptValBool (output->options, OPTION_DISABLE, FALSE) == TRUE)
|
/* check to see if this output was enabled in the config file */
|
||||||
|
if (xf86GetOptValBool (output->options, OPTION_ENABLE, &enable) && enable)
|
||||||
{
|
{
|
||||||
|
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
|
||||||
|
"Output %s enabled by config file\n", output->name);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
/* or if this output was disabled in the config file */
|
||||||
|
if (xf86GetOptValBool (output->options, OPTION_DISABLE, &disable) && disable)
|
||||||
|
{
|
||||||
|
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
|
||||||
|
"Output %s disabled by config file\n", output->name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
/* otherwise, enable if it is not disconnected */
|
||||||
|
enable = output->status != XF86OutputStatusDisconnected;
|
||||||
|
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
|
||||||
|
"Output %s %sconnected\n", output->name, enable ? "" : "dis");
|
||||||
|
return enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
@ -463,7 +492,7 @@ xf86OutputInitialRotation (xf86OutputPtr output)
|
||||||
|
|
||||||
xf86OutputPtr
|
xf86OutputPtr
|
||||||
xf86OutputCreate (ScrnInfoPtr scrn,
|
xf86OutputCreate (ScrnInfoPtr scrn,
|
||||||
const xf86OutputFuncsRec *funcs,
|
const xf86OutputFuncsRec *funcs,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
xf86OutputPtr output, *outputs;
|
xf86OutputPtr output, *outputs;
|
||||||
|
@ -486,6 +515,10 @@ xf86OutputCreate (ScrnInfoPtr scrn,
|
||||||
strcpy (output->name, name);
|
strcpy (output->name, name);
|
||||||
}
|
}
|
||||||
output->subpixel_order = SubPixelUnknown;
|
output->subpixel_order = SubPixelUnknown;
|
||||||
|
/*
|
||||||
|
* Use the old per-screen monitor section for the first output
|
||||||
|
*/
|
||||||
|
output->use_screen_monitor = (xf86_config->num_output == 0);
|
||||||
#ifdef RANDR_12_INTERFACE
|
#ifdef RANDR_12_INTERFACE
|
||||||
output->randr_output = NULL;
|
output->randr_output = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -536,6 +569,16 @@ xf86OutputRename (xf86OutputPtr output, const char *name)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor)
|
||||||
|
{
|
||||||
|
if (use_screen_monitor != output->use_screen_monitor)
|
||||||
|
{
|
||||||
|
output->use_screen_monitor = use_screen_monitor;
|
||||||
|
xf86OutputSetMonitor (output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86OutputDestroy (xf86OutputPtr output)
|
xf86OutputDestroy (xf86OutputPtr output)
|
||||||
{
|
{
|
||||||
|
@ -1203,7 +1246,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
|
||||||
*/
|
*/
|
||||||
output->status = (*output->funcs->detect)(output);
|
output->status = (*output->funcs->detect)(output);
|
||||||
|
|
||||||
if (output->status == XF86OutputStatusDisconnected)
|
if (!xf86OutputEnabled (output))
|
||||||
{
|
{
|
||||||
xf86OutputSetEDID (output, NULL);
|
xf86OutputSetEDID (output, NULL);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1514,8 +1557,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
||||||
xf86OutputPtr output = config->output[o];
|
xf86OutputPtr output = config->output[o];
|
||||||
|
|
||||||
modes[o] = NULL;
|
modes[o] = NULL;
|
||||||
enabled[o] = (xf86OutputEnabled (output) &&
|
enabled[o] = xf86OutputEnabled (output);
|
||||||
output->status != XF86OutputStatusDisconnected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1560,8 +1602,20 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
||||||
{
|
{
|
||||||
xf86OutputPtr output = config->output[o];
|
xf86OutputPtr output = config->output[o];
|
||||||
|
|
||||||
if (enabled[o] && !modes[o])
|
if (enabled[o])
|
||||||
modes[o] = xf86ClosestMode (output, target_mode, target_rotation, width, height);
|
{
|
||||||
|
if (!modes[o])
|
||||||
|
modes[o] = xf86ClosestMode (output, target_mode,
|
||||||
|
target_rotation, width, height);
|
||||||
|
if (!modes[o])
|
||||||
|
xf86DrvMsg (scrn->scrnIndex, X_ERROR,
|
||||||
|
"Output %s enabled but has no modes\n",
|
||||||
|
output->name);
|
||||||
|
else
|
||||||
|
xf86DrvMsg (scrn->scrnIndex, X_INFO,
|
||||||
|
"Output %s using initial mode %s\n",
|
||||||
|
output->name, modes[o]->name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1833,6 +1887,11 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
|
||||||
else
|
else
|
||||||
crtc_mode = xf86OutputFindClosestMode (output, desired);
|
crtc_mode = xf86OutputFindClosestMode (output, desired);
|
||||||
}
|
}
|
||||||
|
if (!crtc_mode)
|
||||||
|
{
|
||||||
|
crtc->enabled = FALSE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!xf86CrtcSetMode (crtc, crtc_mode, rotation, 0, 0))
|
if (!xf86CrtcSetMode (crtc, crtc_mode, rotation, 0, 0))
|
||||||
ok = FALSE;
|
ok = FALSE;
|
||||||
else
|
else
|
||||||
|
@ -1844,6 +1903,7 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xf86DisableUnusedFunctions(pScrn);
|
xf86DisableUnusedFunctions(pScrn);
|
||||||
|
xf86RandR12TellChanged (pScrn->pScreen);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -479,6 +479,9 @@ struct _xf86Output {
|
||||||
/** driver private information */
|
/** driver private information */
|
||||||
void *driver_private;
|
void *driver_private;
|
||||||
|
|
||||||
|
/** Whether to use the old per-screen Monitor config section */
|
||||||
|
Bool use_screen_monitor;
|
||||||
|
|
||||||
#ifdef RANDR_12_INTERFACE
|
#ifdef RANDR_12_INTERFACE
|
||||||
/**
|
/**
|
||||||
* RandR 1.2 output structure.
|
* RandR 1.2 output structure.
|
||||||
|
@ -618,9 +621,12 @@ xf86CrtcInUse (xf86CrtcPtr crtc);
|
||||||
* Output functions
|
* Output functions
|
||||||
*/
|
*/
|
||||||
xf86OutputPtr
|
xf86OutputPtr
|
||||||
xf86OutputCreate (ScrnInfoPtr scrn,
|
xf86OutputCreate (ScrnInfoPtr scrn,
|
||||||
const xf86OutputFuncsRec *funcs,
|
const xf86OutputFuncsRec *funcs,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
|
void
|
||||||
|
xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor);
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
xf86OutputRename (xf86OutputPtr output, const char *name);
|
xf86OutputRename (xf86OutputPtr output, const char *name);
|
||||||
|
|
|
@ -82,6 +82,11 @@ static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
|
||||||
DDC->vendor.prod_id == 1516)
|
DDC->vendor.prod_id == 1516)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
/* Acer AL1706 */
|
||||||
|
if (memcmp (DDC->vendor.name, "ACR", 4) == 0 &&
|
||||||
|
DDC->vendor.prod_id == 44358)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1048,6 +1048,28 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Something happened within the screen configuration due
|
||||||
|
* to DGA, VidMode or hot key. Tell RandR
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
xf86RandR12TellChanged (ScreenPtr pScreen)
|
||||||
|
{
|
||||||
|
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||||
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||||
|
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
||||||
|
int c;
|
||||||
|
|
||||||
|
if (!randrp)
|
||||||
|
return;
|
||||||
|
xf86RandR12SetInfo12 (pScreen);
|
||||||
|
for (c = 0; c < config->num_crtc; c++)
|
||||||
|
xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
|
||||||
|
|
||||||
|
RRTellChanged (pScreen);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xf86RandR12PointerMoved (int scrnIndex, int x, int y)
|
xf86RandR12PointerMoved (int scrnIndex, int x, int y)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,5 +33,6 @@ Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate,
|
||||||
Rotation xf86RandR12GetRotation(ScreenPtr pScreen);
|
Rotation xf86RandR12GetRotation(ScreenPtr pScreen);
|
||||||
void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y);
|
void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y);
|
||||||
Bool xf86RandR12PreInit (ScrnInfoPtr pScrn);
|
Bool xf86RandR12PreInit (ScrnInfoPtr pScrn);
|
||||||
|
void xf86RandR12TellChanged (ScreenPtr pScreen);
|
||||||
|
|
||||||
#endif /* _XF86_RANDR_H_ */
|
#endif /* _XF86_RANDR_H_ */
|
||||||
|
|
|
@ -38,8 +38,7 @@ ARCH_SOURCES = i386_video.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if PPC_VIDEO
|
if PPC_VIDEO
|
||||||
ARCH_SOURCES = ppc_video.c \
|
ARCH_SOURCES = ppc_video.c
|
||||||
$(srcdir)/../shared/ioperm_noop.c
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if SPARC64_VIDEO
|
if SPARC64_VIDEO
|
||||||
|
|
|
@ -56,6 +56,9 @@
|
||||||
static pointer ppcMapVidMem(int, unsigned long, unsigned long, int flags);
|
static pointer ppcMapVidMem(int, unsigned long, unsigned long, int flags);
|
||||||
static void ppcUnmapVidMem(int, pointer, unsigned long);
|
static void ppcUnmapVidMem(int, pointer, unsigned long);
|
||||||
|
|
||||||
|
Bool xf86EnableIO(void);
|
||||||
|
void xf86DisableIO(void);
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
|
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
|
||||||
{
|
{
|
||||||
|
@ -63,6 +66,7 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
|
||||||
pVidMem->mapMem = ppcMapVidMem;
|
pVidMem->mapMem = ppcMapVidMem;
|
||||||
pVidMem->unmapMem = ppcUnmapVidMem;
|
pVidMem->unmapMem = ppcUnmapVidMem;
|
||||||
pVidMem->initialised = TRUE;
|
pVidMem->initialised = TRUE;
|
||||||
|
xf86EnableIO();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,3 +142,32 @@ xf86EnableInterrupts()
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool xf86EnableIO()
|
||||||
|
{
|
||||||
|
int fd = xf86Info.screenFd;
|
||||||
|
|
||||||
|
xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd);
|
||||||
|
if (ioBase == MAP_FAILED)
|
||||||
|
{
|
||||||
|
ioBase=mmap(NULL, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
|
||||||
|
0xf2000000);
|
||||||
|
xf86MsgVerb(X_INFO, 3, "xf86EnableIO: %08x\n", ioBase);
|
||||||
|
if (ioBase == MAP_FAILED) {
|
||||||
|
xf86MsgVerb(X_WARNING, 3, "Can't map IO space!\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void xf86DisableIO()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (ioBase != MAP_FAILED)
|
||||||
|
{
|
||||||
|
munmap(__UNVOLATILE(ioBase), 0x10000);
|
||||||
|
ioBase = MAP_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -773,8 +773,8 @@ xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf)
|
||||||
bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag));
|
bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag));
|
||||||
dev = PCI_DEV_FROM_TAG(Tag);
|
dev = PCI_DEV_FROM_TAG(Tag);
|
||||||
func = PCI_FUNC_FROM_TAG(Tag);
|
func = PCI_FUNC_FROM_TAG(Tag);
|
||||||
sprintf(file, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/rom",
|
sprintf(file, "/sys/bus/pci/devices/%04x:%02x:%02x.%1x/rom",
|
||||||
dom, bus, dom, bus, dev, func);
|
dom, bus, dev, func);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the caller wants the ROM and the sysfs rom interface exists,
|
* If the caller wants the ROM and the sysfs rom interface exists,
|
||||||
|
|
|
@ -245,15 +245,15 @@ xf86OpenConsole(void)
|
||||||
lnx_savefont();
|
lnx_savefont();
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* now get the VT
|
* now get the VT. This _must_ succeed, or else fail completely.
|
||||||
*/
|
*/
|
||||||
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
|
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
|
||||||
xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed: %s\n",
|
FatalError("xf86OpenConsole: VT_ACTIVATE failed: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
|
||||||
if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0)
|
if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0)
|
||||||
xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed: %s\n",
|
FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
|
||||||
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
|
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
|
||||||
FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
|
FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
|
||||||
|
@ -350,6 +350,10 @@ xf86CloseConsole()
|
||||||
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, activeVT) < 0)
|
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, activeVT) < 0)
|
||||||
xf86Msg(X_WARNING, "xf86CloseConsole: VT_ACTIVATE failed: %s\n",
|
xf86Msg(X_WARNING, "xf86CloseConsole: VT_ACTIVATE failed: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, activeVT) < 0)
|
||||||
|
xf86Msg(X_WARNING,
|
||||||
|
"xf86CloseConsole: VT_WAITACTIVE failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
activeVT = -1;
|
activeVT = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,21 +198,21 @@ addNewOption2 (XF86OptionPtr head, char *name, char *val, int used)
|
||||||
{
|
{
|
||||||
XF86OptionPtr new, old = NULL;
|
XF86OptionPtr new, old = NULL;
|
||||||
|
|
||||||
/* Don't allow duplicates */
|
/* Don't allow duplicates, free old strings */
|
||||||
if (head != NULL && (old = xf86findOption(head, name)) != NULL)
|
if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
|
||||||
new = old;
|
new = old;
|
||||||
else {
|
xf86conffree(new->opt_name);
|
||||||
|
xf86conffree(new->opt_val);
|
||||||
|
}
|
||||||
|
else
|
||||||
new = xf86confcalloc (1, sizeof (XF86OptionRec));
|
new = xf86confcalloc (1, sizeof (XF86OptionRec));
|
||||||
new->list.next = NULL;
|
new->opt_name = name;
|
||||||
}
|
new->opt_val = val;
|
||||||
new->opt_name = name;
|
new->opt_used = used;
|
||||||
new->opt_val = val;
|
|
||||||
new->opt_used = used;
|
if (old)
|
||||||
|
return head;
|
||||||
if (old == NULL)
|
return ((XF86OptionPtr) xf86addListItem ((glp) head, (glp) new));
|
||||||
return ((XF86OptionPtr) xf86addListItem ((glp) head, (glp) new));
|
|
||||||
else
|
|
||||||
return head;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XF86OptionPtr
|
XF86OptionPtr
|
||||||
|
|
|
@ -107,13 +107,19 @@ doWriteConfigFile (const char *filename, XF86ConfigPtr cptr)
|
||||||
|
|
||||||
xf86printLayoutSection (cf, cptr->conf_layout_lst);
|
xf86printLayoutSection (cf, cptr->conf_layout_lst);
|
||||||
|
|
||||||
fprintf (cf, "Section \"Files\"\n");
|
if (cptr->conf_files != NULL)
|
||||||
xf86printFileSection (cf, cptr->conf_files);
|
{
|
||||||
fprintf (cf, "EndSection\n\n");
|
fprintf (cf, "Section \"Files\"\n");
|
||||||
|
xf86printFileSection (cf, cptr->conf_files);
|
||||||
|
fprintf (cf, "EndSection\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
fprintf (cf, "Section \"Module\"\n");
|
if (cptr->conf_modules != NULL)
|
||||||
xf86printModuleSection (cf, cptr->conf_modules);
|
{
|
||||||
fprintf (cf, "EndSection\n\n");
|
fprintf (cf, "Section \"Module\"\n");
|
||||||
|
xf86printModuleSection (cf, cptr->conf_modules);
|
||||||
|
fprintf (cf, "EndSection\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
xf86printVendorSection (cf, cptr->conf_vendor_lst);
|
xf86printVendorSection (cf, cptr->conf_vendor_lst);
|
||||||
|
|
||||||
|
|
|
@ -2111,7 +2111,7 @@ LayoutConfig(void)
|
||||||
else
|
else
|
||||||
iref->iref_option_lst =
|
iref->iref_option_lst =
|
||||||
xf86addNewOption(iref->iref_option_lst,
|
xf86addNewOption(iref->iref_option_lst,
|
||||||
"CorePointer", NULL);
|
XtNewString("CorePointer"), NULL);
|
||||||
option = xf86findOption(mref->iref_option_lst,
|
option = xf86findOption(mref->iref_option_lst,
|
||||||
"CorePointer");
|
"CorePointer");
|
||||||
XtFree(option->opt_name);
|
XtFree(option->opt_name);
|
||||||
|
@ -2209,7 +2209,7 @@ LayoutConfig(void)
|
||||||
else
|
else
|
||||||
iref->iref_option_lst =
|
iref->iref_option_lst =
|
||||||
xf86addNewOption(iref->iref_option_lst,
|
xf86addNewOption(iref->iref_option_lst,
|
||||||
"CoreKeyboard", NULL);
|
XtNewString("CoreKeyboard"), NULL);
|
||||||
option = xf86findOption(kref->iref_option_lst,
|
option = xf86findOption(kref->iref_option_lst,
|
||||||
"CoreKeyboard");
|
"CoreKeyboard");
|
||||||
XtFree(option->opt_name);
|
XtFree(option->opt_name);
|
||||||
|
|
|
@ -176,7 +176,7 @@ xnestOpenDisplay(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xnestCloseDisplay()
|
xnestCloseDisplay(void)
|
||||||
{
|
{
|
||||||
if (!xnestDoFullGeneration || !xnestDisplay) return;
|
if (!xnestDoFullGeneration || !xnestDisplay) return;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ ProcessInputEvents()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
TimeSinceLastInputEvent()
|
TimeSinceLastInputEvent(void)
|
||||||
{
|
{
|
||||||
if (lastEventTime == 0)
|
if (lastEventTime == 0)
|
||||||
lastEventTime = GetTimeInMillis();
|
lastEventTime = GetTimeInMillis();
|
||||||
|
@ -60,7 +60,7 @@ TimeSinceLastInputEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SetTimeSinceLastInputEvent()
|
SetTimeSinceLastInputEvent(void)
|
||||||
{
|
{
|
||||||
lastEventTime = GetTimeInMillis();
|
lastEventTime = GetTimeInMillis();
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ xnestNotExposurePredicate(Display *display, XEvent *event, char *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xnestCollectExposures()
|
xnestCollectExposures(void)
|
||||||
{
|
{
|
||||||
XEvent X;
|
XEvent X;
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
|
@ -113,7 +113,7 @@ xnestQueueKeyEvent(int type, unsigned int keycode)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xnestCollectEvents()
|
xnestCollectEvents(void)
|
||||||
{
|
{
|
||||||
XEvent X;
|
XEvent X;
|
||||||
xEvent x;
|
xEvent x;
|
||||||
|
|
|
@ -444,7 +444,10 @@ extern DeviceIntPtr LookupDeviceIntRec(
|
||||||
|
|
||||||
/* Implemented by the DDX. */
|
/* Implemented by the DDX. */
|
||||||
extern int NewInputDeviceRequest(
|
extern int NewInputDeviceRequest(
|
||||||
InputOption *options);
|
InputOption *options,
|
||||||
|
DeviceIntPtr *dev);
|
||||||
|
extern void DeleteInputDeviceRequest(
|
||||||
|
DeviceIntPtr dev);
|
||||||
|
|
||||||
extern void DDXRingBell(
|
extern void DDXRingBell(
|
||||||
int volume,
|
int volume,
|
||||||
|
|
|
@ -385,7 +385,7 @@ static int miVisualPriority[] = {
|
||||||
static miVisualsPtr miVisuals;
|
static miVisualsPtr miVisuals;
|
||||||
|
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
miClearVisualTypes()
|
miClearVisualTypes(void)
|
||||||
{
|
{
|
||||||
miVisualsPtr v;
|
miVisualsPtr v;
|
||||||
|
|
||||||
|
@ -690,7 +690,7 @@ miDoInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
miResetInitVisuals()
|
miResetInitVisuals(void)
|
||||||
{
|
{
|
||||||
miInitVisualsProc = miDoInitVisuals;
|
miInitVisualsProc = miDoInitVisuals;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ in this Software without prior written authorization from The Open Group.
|
||||||
# include <X11/extensions/dpms.h>
|
# include <X11/extensions/dpms.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define QUEUE_SIZE 256
|
#define QUEUE_SIZE 512
|
||||||
|
|
||||||
typedef struct _Event {
|
typedef struct _Event {
|
||||||
xEvent event[7];
|
xEvent event[7];
|
||||||
|
@ -80,7 +80,7 @@ typedef struct _EventQueue {
|
||||||
static EventQueueRec miEventQueue;
|
static EventQueueRec miEventQueue;
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
mieqInit()
|
mieqInit(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ mieqSetHandler(int event, mieqHandler handler)
|
||||||
|
|
||||||
/* Call this from ProcessInputEvents(). */
|
/* Call this from ProcessInputEvents(). */
|
||||||
void
|
void
|
||||||
mieqProcessInputEvents()
|
mieqProcessInputEvents(void)
|
||||||
{
|
{
|
||||||
EventRec *e = NULL;
|
EventRec *e = NULL;
|
||||||
int x = 0, y = 0;
|
int x = 0, y = 0;
|
||||||
|
|
4
os/log.c
4
os/log.c
|
@ -221,7 +221,7 @@ LogInit(const char *fname, const char *backup)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LogClose()
|
LogClose(void)
|
||||||
{
|
{
|
||||||
if (logFile) {
|
if (logFile) {
|
||||||
fclose(logFile);
|
fclose(logFile);
|
||||||
|
@ -616,7 +616,7 @@ Error(char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LogPrintMarkers()
|
LogPrintMarkers(void)
|
||||||
{
|
{
|
||||||
/* Show what the message marker symbols mean. */
|
/* Show what the message marker symbols mean. */
|
||||||
ErrorF("Markers: ");
|
ErrorF("Markers: ");
|
||||||
|
|
|
@ -102,7 +102,7 @@ typedef struct _builtinColor {
|
||||||
#define NUM_BUILTIN_COLORS (sizeof (BuiltinColors) / sizeof (BuiltinColors[0]))
|
#define NUM_BUILTIN_COLORS (sizeof (BuiltinColors) / sizeof (BuiltinColors[0]))
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
OsInitColors()
|
OsInitColors(void)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <X11/Xos.h>
|
#include <X11/Xos.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/resource.h>
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#define XSERV_t
|
#define XSERV_t
|
||||||
|
@ -795,7 +797,13 @@ ProcessCommandLine(int argc, char *argv[])
|
||||||
UseMsg();
|
UseMsg();
|
||||||
}
|
}
|
||||||
else if ( strcmp( argv[i], "-core") == 0)
|
else if ( strcmp( argv[i], "-core") == 0)
|
||||||
|
{
|
||||||
|
struct rlimit core_limit;
|
||||||
CoreDump = TRUE;
|
CoreDump = TRUE;
|
||||||
|
getrlimit (RLIMIT_CORE, &core_limit);
|
||||||
|
core_limit.rlim_cur = core_limit.rlim_max;
|
||||||
|
setrlimit (RLIMIT_CORE, &core_limit);
|
||||||
|
}
|
||||||
else if ( strcmp( argv[i], "-dpi") == 0)
|
else if ( strcmp( argv[i], "-dpi") == 0)
|
||||||
{
|
{
|
||||||
if(++i < argc)
|
if(++i < argc)
|
||||||
|
|
|
@ -518,6 +518,7 @@ ProcRRGetCrtcInfo (ClientPtr client)
|
||||||
RROutput *outputs;
|
RROutput *outputs;
|
||||||
RROutput *possible;
|
RROutput *possible;
|
||||||
int i, j, k, n;
|
int i, j, k, n;
|
||||||
|
int width, height;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
|
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
|
||||||
crtc = LookupCrtc(client, stuff->crtc, DixReadAccess);
|
crtc = LookupCrtc(client, stuff->crtc, DixReadAccess);
|
||||||
|
@ -540,8 +541,9 @@ ProcRRGetCrtcInfo (ClientPtr client)
|
||||||
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
|
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
|
||||||
rep.x = crtc->x;
|
rep.x = crtc->x;
|
||||||
rep.y = crtc->y;
|
rep.y = crtc->y;
|
||||||
rep.width = mode ? mode->mode.width : 0;
|
RRCrtcGetScanoutSize (crtc, &width, &height);
|
||||||
rep.height = mode ? mode->mode.height : 0;
|
rep.width = width;
|
||||||
|
rep.height = height;
|
||||||
rep.mode = mode ? mode->mode.id : 0;
|
rep.mode = mode ? mode->mode.id : 0;
|
||||||
rep.rotation = crtc->rotation;
|
rep.rotation = crtc->rotation;
|
||||||
rep.rotations = crtc->rotations;
|
rep.rotations = crtc->rotations;
|
||||||
|
|
|
@ -741,6 +741,7 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||||
RRModePtr mode;
|
RRModePtr mode;
|
||||||
RR10DataPtr pData = NULL;
|
RR10DataPtr pData = NULL;
|
||||||
RRScreenSizePtr pSize;
|
RRScreenSizePtr pSize;
|
||||||
|
int width, height;
|
||||||
|
|
||||||
UpdateCurrentTime ();
|
UpdateCurrentTime ();
|
||||||
|
|
||||||
|
@ -883,8 +884,14 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||||
* If the screen size is changing, adjust all of the other outputs
|
* If the screen size is changing, adjust all of the other outputs
|
||||||
* to fit the new size, mirroring as much as possible
|
* to fit the new size, mirroring as much as possible
|
||||||
*/
|
*/
|
||||||
if (mode->mode.width != pScreen->width ||
|
width = mode->mode.width;
|
||||||
mode->mode.height != pScreen->height)
|
height = mode->mode.height;
|
||||||
|
if (rotation & (RR_Rotate_90|RR_Rotate_270))
|
||||||
|
{
|
||||||
|
width = mode->mode.height;
|
||||||
|
height = mode->mode.width;
|
||||||
|
}
|
||||||
|
if (width != pScreen->width || height != pScreen->height)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
@ -898,7 +905,7 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!RRScreenSizeSet (pScreen, mode->mode.width, mode->mode.height,
|
if (!RRScreenSizeSet (pScreen, width, height,
|
||||||
pScreen->mmWidth, pScreen->mmHeight))
|
pScreen->mmWidth, pScreen->mmHeight))
|
||||||
{
|
{
|
||||||
rep.status = RRSetConfigFailed;
|
rep.status = RRSetConfigFailed;
|
||||||
|
|
|
@ -86,13 +86,13 @@ static int globalTotalGlyphPrivateSize = 0;
|
||||||
static int glyphPrivateCount = 0;
|
static int glyphPrivateCount = 0;
|
||||||
|
|
||||||
void
|
void
|
||||||
ResetGlyphPrivates ()
|
ResetGlyphPrivates (void)
|
||||||
{
|
{
|
||||||
glyphPrivateCount = 0;
|
glyphPrivateCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
AllocateGlyphPrivateIndex ()
|
AllocateGlyphPrivateIndex (void)
|
||||||
{
|
{
|
||||||
return glyphPrivateCount++;
|
return glyphPrivateCount++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue