Merge branch 'master' into mpx
This merge reverts Magnus' device coorindate scaling changes. MPX core event generation is very different, so we can't scale in GetPointerEvents. Conflicts: Xi/opendev.c dix/devices.c dix/dixfonts.c dix/getevents.c dix/resource.c dix/window.c hw/xfree86/common/xf86Xinput.c mi/mipointer.c xkb/ddxBeep.c xkb/ddxCtrls.c xkb/ddxKeyClick.c xkb/ddxList.c xkb/ddxLoad.c xkb/xkb.c xkb/xkbAccessX.c xkb/xkbEvents.c xkb/xkbInit.c xkb/xkbPrKeyEv.c xkb/xkbUtils.c
This commit is contained in:
commit
4f2cd0ed96
12
GL/glx/.gitignore
vendored
12
GL/glx/.gitignore
vendored
|
@ -1,5 +1,13 @@
|
||||||
indirect_size.h
|
glapi.c
|
||||||
glcontextmodes.c
|
glcontextmodes.c
|
||||||
glcontextmodes.h
|
glcontextmodes.h
|
||||||
glapi.c
|
|
||||||
glthread.c
|
glthread.c
|
||||||
|
indirect_dispatch.c
|
||||||
|
indirect_dispatch.h
|
||||||
|
indirect_dispatch_swap.c
|
||||||
|
indirect_reqsize.c
|
||||||
|
indirect_reqsize.h
|
||||||
|
indirect_size.h
|
||||||
|
indirect_size_get.c
|
||||||
|
indirect_size_get.h
|
||||||
|
indirect_table.c
|
||||||
|
|
|
@ -25,6 +25,7 @@ INCLUDES = \
|
||||||
-I$(top_srcdir)/hw/xfree86/os-support/bus \
|
-I$(top_srcdir)/hw/xfree86/os-support/bus \
|
||||||
-I$(top_srcdir)/hw/xfree86/common \
|
-I$(top_srcdir)/hw/xfree86/common \
|
||||||
-I$(top_srcdir)/hw/xfree86/dri \
|
-I$(top_srcdir)/hw/xfree86/dri \
|
||||||
|
-I$(top_srcdir)/hw/xfree86/dri2 \
|
||||||
-I$(top_srcdir)/mi
|
-I$(top_srcdir)/mi
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,10 +33,19 @@ nodist_libglx_la_SOURCES = indirect_size.h \
|
||||||
glapi.c \
|
glapi.c \
|
||||||
glcontextmodes.c \
|
glcontextmodes.c \
|
||||||
glcontextmode.h \
|
glcontextmode.h \
|
||||||
glthread.c
|
glthread.c \
|
||||||
|
indirect_dispatch.c \
|
||||||
|
indirect_dispatch.h \
|
||||||
|
indirect_dispatch_swap.c \
|
||||||
|
indirect_reqsize.c \
|
||||||
|
indirect_reqsize.h \
|
||||||
|
indirect_size_get.c \
|
||||||
|
indirect_size_get.h \
|
||||||
|
indirect_table.c
|
||||||
|
|
||||||
libglxdri_la_SOURCES = \
|
libglxdri_la_SOURCES = \
|
||||||
glxdri.c \
|
glxdri.c \
|
||||||
|
glxdri2.c \
|
||||||
extension_string.c \
|
extension_string.c \
|
||||||
extension_string.h
|
extension_string.h
|
||||||
|
|
||||||
|
@ -54,15 +64,7 @@ libglx_la_SOURCES = \
|
||||||
glxserver.h \
|
glxserver.h \
|
||||||
glxutil.c \
|
glxutil.c \
|
||||||
glxutil.h \
|
glxutil.h \
|
||||||
indirect_dispatch.c \
|
|
||||||
indirect_dispatch.h \
|
|
||||||
indirect_dispatch_swap.c \
|
|
||||||
indirect_program.c \
|
indirect_program.c \
|
||||||
indirect_reqsize.c \
|
|
||||||
indirect_reqsize.h \
|
|
||||||
indirect_size_get.c \
|
|
||||||
indirect_size_get.h \
|
|
||||||
indirect_table.c \
|
|
||||||
indirect_table.h \
|
indirect_table.h \
|
||||||
indirect_texture_compression.c \
|
indirect_texture_compression.c \
|
||||||
indirect_util.c \
|
indirect_util.c \
|
||||||
|
|
104
GL/glx/glxdri.c
104
GL/glx/glxdri.c
|
@ -180,11 +180,54 @@ __glXDRIenterServer(GLboolean rendering)
|
||||||
DRIWakeupHandler(NULL, 0, NULL);
|
DRIWakeupHandler(NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
__glXDRIdoReleaseTexImage(__GLXDRIscreen *screen, __GLXDRIdrawable *drawable)
|
||||||
|
{
|
||||||
|
GLuint lastOverride = screen->lastTexOffsetOverride;
|
||||||
|
|
||||||
|
if (lastOverride) {
|
||||||
|
__GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < lastOverride; i++) {
|
||||||
|
if (texOffsetOverride[i] == drawable) {
|
||||||
|
|
||||||
|
texOffsetOverride[i] = NULL;
|
||||||
|
|
||||||
|
if (i + 1 == lastOverride) {
|
||||||
|
lastOverride = 0;
|
||||||
|
|
||||||
|
while (i--) {
|
||||||
|
if (texOffsetOverride[i]) {
|
||||||
|
lastOverride = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
screen->lastTexOffsetOverride = lastOverride;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
__glXDRIdrawableDestroy(__GLXdrawable *drawable)
|
__glXDRIdrawableDestroy(__GLXdrawable *drawable)
|
||||||
{
|
{
|
||||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
|
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||||
|
__glXDRIdoReleaseTexImage((__GLXDRIscreen *)
|
||||||
|
glxGetScreen(screenInfo.screens[i]),
|
||||||
|
private);
|
||||||
|
}
|
||||||
|
|
||||||
(*private->driDrawable.destroyDrawable)(&private->driDrawable);
|
(*private->driDrawable.destroyDrawable)(&private->driDrawable);
|
||||||
|
|
||||||
/* If the X window was destroyed, the dri DestroyWindow hook will
|
/* If the X window was destroyed, the dri DestroyWindow hook will
|
||||||
|
@ -525,41 +568,9 @@ __glXDRIreleaseTexImage(__GLXcontext *baseContext,
|
||||||
int buffer,
|
int buffer,
|
||||||
__GLXdrawable *pixmap)
|
__GLXdrawable *pixmap)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pixmap->pDraw->pScreen;
|
__glXDRIdoReleaseTexImage((__GLXDRIscreen *)
|
||||||
__GLXDRIdrawable *driDraw =
|
glxGetScreen(pixmap->pDraw->pScreen),
|
||||||
containerOf(pixmap, __GLXDRIdrawable, base);
|
containerOf(pixmap, __GLXDRIdrawable, base));
|
||||||
__GLXDRIscreen * const screen =
|
|
||||||
(__GLXDRIscreen *) glxGetScreen(pScreen);
|
|
||||||
GLuint lastOverride = screen->lastTexOffsetOverride;
|
|
||||||
|
|
||||||
if (lastOverride) {
|
|
||||||
__GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < lastOverride; i++) {
|
|
||||||
if (texOffsetOverride[i] == driDraw) {
|
|
||||||
if (screen->texOffsetFinish)
|
|
||||||
screen->texOffsetFinish((PixmapPtr)pixmap->pDraw);
|
|
||||||
|
|
||||||
texOffsetOverride[i] = NULL;
|
|
||||||
|
|
||||||
if (i + 1 == lastOverride) {
|
|
||||||
lastOverride = 0;
|
|
||||||
|
|
||||||
while (i--) {
|
|
||||||
if (texOffsetOverride[i]) {
|
|
||||||
lastOverride = i + 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
screen->lastTexOffsetOverride = lastOverride;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
@ -603,6 +614,9 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
||||||
else
|
else
|
||||||
driShare = NULL;
|
driShare = NULL;
|
||||||
|
|
||||||
|
if (baseShareContext && baseShareContext->isDirect)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
context = xalloc(sizeof *context);
|
context = xalloc(sizeof *context);
|
||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -638,6 +652,14 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
||||||
hwContext,
|
hwContext,
|
||||||
&context->driContext);
|
&context->driContext);
|
||||||
|
|
||||||
|
if (context->driContext.private == NULL) {
|
||||||
|
__glXenterServer(GL_FALSE);
|
||||||
|
retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID);
|
||||||
|
__glXleaveServer(GL_FALSE);
|
||||||
|
xfree(context);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return &context->base;
|
return &context->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,6 +706,14 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
||||||
&private->driDrawable,
|
&private->driDrawable,
|
||||||
hwDrawable, 0, NULL);
|
hwDrawable, 0, NULL);
|
||||||
|
|
||||||
|
if (private->driDrawable.private == NULL) {
|
||||||
|
__glXenterServer(GL_FALSE);
|
||||||
|
DRIDestroyDrawable(screen->pScreen, serverClient, pDraw);
|
||||||
|
__glXleaveServer(GL_FALSE);
|
||||||
|
xfree(private);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return &private->base;
|
return &private->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,10 +817,14 @@ static void __glXReportDamage(__DRIdrawable *driDraw,
|
||||||
DrawablePtr pDraw = drawable->base.pDraw;
|
DrawablePtr pDraw = drawable->base.pDraw;
|
||||||
RegionRec region;
|
RegionRec region;
|
||||||
|
|
||||||
|
__glXenterServer(GL_FALSE);
|
||||||
|
|
||||||
REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, num_rects);
|
REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, num_rects);
|
||||||
REGION_TRANSLATE(pScreen, ®ion, pDraw->x, pDraw->y);
|
REGION_TRANSLATE(pScreen, ®ion, pDraw->x, pDraw->y);
|
||||||
DamageDamageRegion(pDraw, ®ion);
|
DamageDamageRegion(pDraw, ®ion);
|
||||||
REGION_UNINIT(pDraw->pScreen, ®ion);
|
REGION_UNINIT(pDraw->pScreen, ®ion);
|
||||||
|
|
||||||
|
__glXleaveServer(GL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Table of functions that we export to the driver. */
|
/* Table of functions that we export to the driver. */
|
||||||
|
|
633
GL/glx/glxdri2.c
Normal file
633
GL/glx/glxdri2.c
Normal file
|
@ -0,0 +1,633 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2007 Red Hat, Inc
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software
|
||||||
|
* and its documentation for any purpose is hereby granted without
|
||||||
|
* fee, provided that the above copyright notice appear in all copies
|
||||||
|
* and that both that copyright notice and this permission notice
|
||||||
|
* appear in supporting documentation, and that the name of Red Hat,
|
||||||
|
* Inc not be used in advertising or publicity pertaining to
|
||||||
|
* distribution of the software without specific, written prior
|
||||||
|
* permission. Red Hat, Inc makes no representations about the
|
||||||
|
* suitability of this software for any purpose. It is provided "as
|
||||||
|
* is" without express or implied warranty.
|
||||||
|
*
|
||||||
|
* RED HAT, INC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||||
|
* NO EVENT SHALL RED HAT, INC BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||||
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
#include <dix-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
#include <drm.h>
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#include <GL/internal/dri_interface.h>
|
||||||
|
|
||||||
|
#include <windowstr.h>
|
||||||
|
#include <os.h>
|
||||||
|
|
||||||
|
#define _XF86DRI_SERVER_
|
||||||
|
#include <xf86drm.h>
|
||||||
|
#include <xf86dristr.h>
|
||||||
|
#include <xf86str.h>
|
||||||
|
#include <xf86.h>
|
||||||
|
#include <dri2.h>
|
||||||
|
|
||||||
|
#include "glxserver.h"
|
||||||
|
#include "glxutil.h"
|
||||||
|
#include "glcontextmodes.h"
|
||||||
|
|
||||||
|
#include "g_disptab.h"
|
||||||
|
#include "glapitable.h"
|
||||||
|
#include "glapi.h"
|
||||||
|
#include "glthread.h"
|
||||||
|
#include "dispatch.h"
|
||||||
|
#include "extension_string.h"
|
||||||
|
|
||||||
|
#define containerOf(ptr, type, member) \
|
||||||
|
(type *)( (char *)ptr - offsetof(type,member) )
|
||||||
|
|
||||||
|
typedef struct __GLXDRIscreen __GLXDRIscreen;
|
||||||
|
typedef struct __GLXDRIcontext __GLXDRIcontext;
|
||||||
|
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
|
||||||
|
|
||||||
|
struct __GLXDRIscreen {
|
||||||
|
__GLXscreen base;
|
||||||
|
__DRIscreen driScreen;
|
||||||
|
void *driver;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
xf86EnterVTProc *enterVT;
|
||||||
|
xf86LeaveVTProc *leaveVT;
|
||||||
|
|
||||||
|
__DRIcopySubBufferExtension *copySubBuffer;
|
||||||
|
__DRIswapControlExtension *swapControl;
|
||||||
|
__DRItexBufferExtension *texBuffer;
|
||||||
|
|
||||||
|
unsigned char glx_enable_bits[__GLX_EXT_BYTES];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct __GLXDRIcontext {
|
||||||
|
__GLXcontext base;
|
||||||
|
__DRIcontext driContext;
|
||||||
|
drm_context_t hwContext;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct __GLXDRIdrawable {
|
||||||
|
__GLXdrawable base;
|
||||||
|
__DRIdrawable driDrawable;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char CREATE_NEW_SCREEN_FUNC[] = __DRI2_CREATE_NEW_SCREEN_STRING;
|
||||||
|
|
||||||
|
static void
|
||||||
|
__glXDRIdrawableDestroy(__GLXdrawable *drawable)
|
||||||
|
{
|
||||||
|
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
|
||||||
|
|
||||||
|
(*private->driDrawable.destroyDrawable)(&private->driDrawable);
|
||||||
|
|
||||||
|
/* If the X window was destroyed, the dri DestroyWindow hook will
|
||||||
|
* aready have taken care of this, so only call if pDraw isn't NULL. */
|
||||||
|
if (drawable->pDraw != NULL)
|
||||||
|
DRI2DestroyDrawable(drawable->pDraw->pScreen, drawable->pDraw);
|
||||||
|
|
||||||
|
xfree(private);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLboolean
|
||||||
|
__glXDRIdrawableResize(__GLXdrawable *glxPriv)
|
||||||
|
{
|
||||||
|
/* Nothing to do here, the DRI driver asks the server for drawable
|
||||||
|
* geometry when it sess the SAREA timestamps change.*/
|
||||||
|
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLboolean
|
||||||
|
__glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate)
|
||||||
|
{
|
||||||
|
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
|
||||||
|
|
||||||
|
(*private->driDrawable.swapBuffers)(&private->driDrawable);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval)
|
||||||
|
{
|
||||||
|
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable;
|
||||||
|
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||||
|
glxGetScreen(baseDrawable->pDraw->pScreen);
|
||||||
|
|
||||||
|
if (screen->swapControl)
|
||||||
|
screen->swapControl->setSwapInterval(&draw->driDrawable, interval);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
__glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
|
||||||
|
int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
|
||||||
|
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||||
|
glxGetScreen(basePrivate->pDraw->pScreen);
|
||||||
|
|
||||||
|
if (screen->copySubBuffer)
|
||||||
|
screen->copySubBuffer->copySubBuffer(&private->driDrawable,
|
||||||
|
x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
__glXDRIcontextDestroy(__GLXcontext *baseContext)
|
||||||
|
{
|
||||||
|
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||||
|
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseContext->pGlxScreen;
|
||||||
|
|
||||||
|
context->driContext.destroyContext(&context->driContext);
|
||||||
|
drmDestroyContext(screen->fd, context->hwContext);
|
||||||
|
__glXContextDestroy(&context->base);
|
||||||
|
xfree(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
|
||||||
|
{
|
||||||
|
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||||
|
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
|
||||||
|
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
|
||||||
|
|
||||||
|
return (*context->driContext.bindContext)(&context->driContext,
|
||||||
|
&draw->driDrawable,
|
||||||
|
&read->driDrawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
|
||||||
|
{
|
||||||
|
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||||
|
|
||||||
|
return (*context->driContext.unbindContext)(&context->driContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
__glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
|
||||||
|
unsigned long mask)
|
||||||
|
{
|
||||||
|
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
|
||||||
|
__GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
|
||||||
|
|
||||||
|
/* FIXME: We will need to add DRIcontext::copyContext for this. */
|
||||||
|
|
||||||
|
(void) dst;
|
||||||
|
(void) src;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
__glXDRIcontextForceCurrent(__GLXcontext *baseContext)
|
||||||
|
{
|
||||||
|
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||||
|
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
|
||||||
|
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
|
||||||
|
|
||||||
|
return (*context->driContext.bindContext)(&context->driContext,
|
||||||
|
&draw->driDrawable,
|
||||||
|
&read->driDrawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __DRI_TEX_BUFFER
|
||||||
|
|
||||||
|
#define isPowerOfTwo(n) (((n) & ((n) - 1 )) == 0)
|
||||||
|
|
||||||
|
static int
|
||||||
|
__glXDRIbindTexImage(__GLXcontext *baseContext,
|
||||||
|
int buffer,
|
||||||
|
__GLXdrawable *glxPixmap)
|
||||||
|
{
|
||||||
|
ScreenPtr pScreen = glxPixmap->pDraw->pScreen;
|
||||||
|
__GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen);
|
||||||
|
PixmapPtr pixmap;
|
||||||
|
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||||
|
unsigned int flags;
|
||||||
|
int w, h, target;
|
||||||
|
|
||||||
|
if (screen->texBuffer == NULL)
|
||||||
|
return Success;
|
||||||
|
|
||||||
|
pixmap = (PixmapPtr) glxPixmap->pDraw;
|
||||||
|
w = pixmap->drawable.width;
|
||||||
|
h = pixmap->drawable.height;
|
||||||
|
|
||||||
|
if (!isPowerOfTwo(w) || !isPowerOfTwo(h))
|
||||||
|
target = GL_TEXTURE_RECTANGLE_ARB;
|
||||||
|
else
|
||||||
|
target = GL_TEXTURE_2D;
|
||||||
|
|
||||||
|
screen->texBuffer->setTexBuffer(&context->driContext,
|
||||||
|
target,
|
||||||
|
DRI2GetPixmapHandle(pixmap, &flags),
|
||||||
|
pixmap->drawable.depth,
|
||||||
|
pixmap->devKind,
|
||||||
|
h);
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
__glXDRIreleaseTexImage(__GLXcontext *baseContext,
|
||||||
|
int buffer,
|
||||||
|
__GLXdrawable *pixmap)
|
||||||
|
{
|
||||||
|
/* FIXME: Just unbind the texture? */
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static int
|
||||||
|
__glXDRIbindTexImage(__GLXcontext *baseContext,
|
||||||
|
int buffer,
|
||||||
|
__GLXdrawable *glxPixmap)
|
||||||
|
{
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
__glXDRIreleaseTexImage(__GLXcontext *baseContext,
|
||||||
|
int buffer,
|
||||||
|
__GLXdrawable *pixmap)
|
||||||
|
{
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
|
||||||
|
__glXDRIbindTexImage,
|
||||||
|
__glXDRIreleaseTexImage
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
__glXDRIscreenDestroy(__GLXscreen *baseScreen)
|
||||||
|
{
|
||||||
|
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||||
|
|
||||||
|
screen->driScreen.destroyScreen(&screen->driScreen);
|
||||||
|
|
||||||
|
dlclose(screen->driver);
|
||||||
|
|
||||||
|
__glXScreenDestroy(baseScreen);
|
||||||
|
|
||||||
|
xfree(screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __GLXcontext *
|
||||||
|
__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
||||||
|
__GLcontextModes *modes,
|
||||||
|
__GLXcontext *baseShareContext)
|
||||||
|
{
|
||||||
|
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||||
|
__GLXDRIcontext *context, *shareContext;
|
||||||
|
__DRIcontext *driShare;
|
||||||
|
|
||||||
|
shareContext = (__GLXDRIcontext *) baseShareContext;
|
||||||
|
if (shareContext)
|
||||||
|
driShare = &shareContext->driContext;
|
||||||
|
else
|
||||||
|
driShare = NULL;
|
||||||
|
|
||||||
|
context = xalloc(sizeof *context);
|
||||||
|
if (context == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
memset(context, 0, sizeof *context);
|
||||||
|
context->base.destroy = __glXDRIcontextDestroy;
|
||||||
|
context->base.makeCurrent = __glXDRIcontextMakeCurrent;
|
||||||
|
context->base.loseCurrent = __glXDRIcontextLoseCurrent;
|
||||||
|
context->base.copy = __glXDRIcontextCopy;
|
||||||
|
context->base.forceCurrent = __glXDRIcontextForceCurrent;
|
||||||
|
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
|
||||||
|
|
||||||
|
if (drmCreateContext(screen->fd, &context->hwContext))
|
||||||
|
return GL_FALSE;
|
||||||
|
|
||||||
|
context->driContext.private =
|
||||||
|
screen->driScreen.createNewContext(&screen->driScreen,
|
||||||
|
modes,
|
||||||
|
0, /* render type */
|
||||||
|
driShare,
|
||||||
|
context->hwContext,
|
||||||
|
&context->driContext);
|
||||||
|
|
||||||
|
return &context->base;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __GLXdrawable *
|
||||||
|
__glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
||||||
|
DrawablePtr pDraw,
|
||||||
|
int type,
|
||||||
|
XID drawId,
|
||||||
|
__GLcontextModes *modes)
|
||||||
|
{
|
||||||
|
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
|
||||||
|
__GLXDRIdrawable *private;
|
||||||
|
GLboolean retval;
|
||||||
|
drm_drawable_t hwDrawable;
|
||||||
|
|
||||||
|
private = xalloc(sizeof *private);
|
||||||
|
if (private == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
memset(private, 0, sizeof *private);
|
||||||
|
|
||||||
|
if (!__glXDrawableInit(&private->base, screen,
|
||||||
|
pDraw, type, drawId, modes)) {
|
||||||
|
xfree(private);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
private->base.destroy = __glXDRIdrawableDestroy;
|
||||||
|
private->base.resize = __glXDRIdrawableResize;
|
||||||
|
private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
|
||||||
|
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
|
||||||
|
|
||||||
|
retval = DRI2CreateDrawable(screen->pScreen, pDraw, &hwDrawable);
|
||||||
|
|
||||||
|
private->driDrawable.private =
|
||||||
|
(driScreen->driScreen.createNewDrawable)(&driScreen->driScreen,
|
||||||
|
modes,
|
||||||
|
&private->driDrawable,
|
||||||
|
hwDrawable, 0, NULL);
|
||||||
|
|
||||||
|
return &private->base;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
getUST(int64_t *ust)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
|
if (ust == NULL)
|
||||||
|
return -EFAULT;
|
||||||
|
|
||||||
|
if (gettimeofday(&tv, NULL) == 0) {
|
||||||
|
ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __glXReportDamage(__DRIdrawable *driDraw,
|
||||||
|
int x, int y,
|
||||||
|
drm_clip_rect_t *rects, int num_rects,
|
||||||
|
GLboolean front_buffer)
|
||||||
|
{
|
||||||
|
__GLXDRIdrawable *drawable =
|
||||||
|
containerOf(driDraw, __GLXDRIdrawable, driDrawable);
|
||||||
|
DrawablePtr pDraw = drawable->base.pDraw;
|
||||||
|
RegionRec region;
|
||||||
|
|
||||||
|
REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, num_rects);
|
||||||
|
REGION_TRANSLATE(pScreen, ®ion, pDraw->x, pDraw->y);
|
||||||
|
DamageDamageRegion(pDraw, ®ion);
|
||||||
|
REGION_UNINIT(pDraw->pScreen, ®ion);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Table of functions that we export to the driver. */
|
||||||
|
static const __DRIinterfaceMethods interface_methods = {
|
||||||
|
_gl_context_modes_create,
|
||||||
|
_gl_context_modes_destroy,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
getUST,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
__glXReportDamage,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char dri_driver_path[] = DRI_DRIVER_PATH;
|
||||||
|
|
||||||
|
static Bool
|
||||||
|
glxDRIEnterVT (int index, int flags)
|
||||||
|
{
|
||||||
|
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||||
|
glxGetScreen(screenInfo.screens[index]);
|
||||||
|
|
||||||
|
LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
|
||||||
|
|
||||||
|
if (!(*screen->enterVT) (index, flags))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
glxResumeClients();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
glxDRILeaveVT (int index, int flags)
|
||||||
|
{
|
||||||
|
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||||
|
glxGetScreen(screenInfo.screens[index]);
|
||||||
|
|
||||||
|
LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
|
||||||
|
|
||||||
|
glxSuspendClients();
|
||||||
|
|
||||||
|
return (*screen->leaveVT) (index, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
initializeExtensions(__GLXDRIscreen *screen)
|
||||||
|
{
|
||||||
|
const __DRIextension **extensions;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
extensions = screen->driScreen.getExtensions(&screen->driScreen);
|
||||||
|
for (i = 0; extensions[i]; i++) {
|
||||||
|
#ifdef __DRI_COPY_SUB_BUFFER
|
||||||
|
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
|
||||||
|
screen->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
|
||||||
|
__glXEnableExtension(screen->glx_enable_bits,
|
||||||
|
"GLX_MESA_copy_sub_buffer");
|
||||||
|
|
||||||
|
LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __DRI_SWAP_CONTROL
|
||||||
|
if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
|
||||||
|
screen->swapControl = (__DRIswapControlExtension *) extensions[i];
|
||||||
|
__glXEnableExtension(screen->glx_enable_bits,
|
||||||
|
"GLX_SGI_swap_control");
|
||||||
|
__glXEnableExtension(screen->glx_enable_bits,
|
||||||
|
"GLX_MESA_swap_control");
|
||||||
|
|
||||||
|
LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __DRI_TEX_BUFFER
|
||||||
|
if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
|
||||||
|
screen->texBuffer = (__DRItexBufferExtension *) extensions[i];
|
||||||
|
/* GLX_EXT_texture_from_pixmap is always enabled. */
|
||||||
|
LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* Ignore unknown extensions */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static __GLXscreen *
|
||||||
|
__glXDRIscreenProbe(ScreenPtr pScreen)
|
||||||
|
{
|
||||||
|
__DRI2_CREATE_NEW_SCREEN_FUNC *createNewScreen;
|
||||||
|
__DRIversion ddx_version;
|
||||||
|
__DRIversion dri_version;
|
||||||
|
__DRIversion drm_version;
|
||||||
|
drmVersionPtr version;
|
||||||
|
const char *driverName;
|
||||||
|
__GLXDRIscreen *screen;
|
||||||
|
char filename[128];
|
||||||
|
size_t buffer_size;
|
||||||
|
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||||
|
unsigned int sareaHandle;
|
||||||
|
|
||||||
|
screen = xalloc(sizeof *screen);
|
||||||
|
if (screen == NULL)
|
||||||
|
return NULL;
|
||||||
|
memset(screen, 0, sizeof *screen);
|
||||||
|
|
||||||
|
if (!xf86LoaderCheckSymbol("DRI2Connect") ||
|
||||||
|
!DRI2Connect(pScreen,
|
||||||
|
&screen->fd,
|
||||||
|
&driverName,
|
||||||
|
&ddx_version.major,
|
||||||
|
&ddx_version.minor,
|
||||||
|
&ddx_version.patch,
|
||||||
|
&sareaHandle)) {
|
||||||
|
LogMessage(X_INFO,
|
||||||
|
"AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
screen->base.destroy = __glXDRIscreenDestroy;
|
||||||
|
screen->base.createContext = __glXDRIscreenCreateContext;
|
||||||
|
screen->base.createDrawable = __glXDRIscreenCreateDrawable;
|
||||||
|
screen->base.swapInterval = __glXDRIdrawableSwapInterval;
|
||||||
|
screen->base.pScreen = pScreen;
|
||||||
|
|
||||||
|
__glXInitExtensionEnableBits(screen->glx_enable_bits);
|
||||||
|
|
||||||
|
/* DRI protocol version. */
|
||||||
|
dri_version.major = XF86DRI_MAJOR_VERSION;
|
||||||
|
dri_version.minor = XF86DRI_MINOR_VERSION;
|
||||||
|
dri_version.patch = XF86DRI_PATCH_VERSION;
|
||||||
|
|
||||||
|
version = drmGetVersion(screen->fd);
|
||||||
|
if (version) {
|
||||||
|
drm_version.major = version->version_major;
|
||||||
|
drm_version.minor = version->version_minor;
|
||||||
|
drm_version.patch = version->version_patchlevel;
|
||||||
|
drmFreeVersion(version);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drm_version.major = -1;
|
||||||
|
drm_version.minor = -1;
|
||||||
|
drm_version.patch = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(filename, sizeof filename, "%s/%s_dri.so",
|
||||||
|
dri_driver_path, driverName);
|
||||||
|
|
||||||
|
screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
|
||||||
|
if (screen->driver == NULL) {
|
||||||
|
LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n",
|
||||||
|
filename, dlerror());
|
||||||
|
goto handle_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
createNewScreen = dlsym(screen->driver, CREATE_NEW_SCREEN_FUNC);
|
||||||
|
if (createNewScreen == NULL) {
|
||||||
|
LogMessage(X_ERROR, "AIGLX error: dlsym for %s failed (%s)\n",
|
||||||
|
CREATE_NEW_SCREEN_FUNC, dlerror());
|
||||||
|
goto handle_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
screen->driScreen.private =
|
||||||
|
(*createNewScreen)(pScreen->myNum,
|
||||||
|
&screen->driScreen,
|
||||||
|
&ddx_version,
|
||||||
|
&dri_version,
|
||||||
|
&drm_version,
|
||||||
|
screen->fd,
|
||||||
|
sareaHandle,
|
||||||
|
&interface_methods,
|
||||||
|
&screen->base.fbconfigs);
|
||||||
|
|
||||||
|
if (screen->driScreen.private == NULL) {
|
||||||
|
LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed");
|
||||||
|
goto handle_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
initializeExtensions(screen);
|
||||||
|
|
||||||
|
__glXScreenInit(&screen->base, pScreen);
|
||||||
|
|
||||||
|
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
|
||||||
|
if (buffer_size > 0) {
|
||||||
|
if (screen->base.GLXextensions != NULL) {
|
||||||
|
xfree(screen->base.GLXextensions);
|
||||||
|
}
|
||||||
|
|
||||||
|
screen->base.GLXextensions = xnfalloc(buffer_size);
|
||||||
|
(void) __glXGetExtensionString(screen->glx_enable_bits,
|
||||||
|
screen->base.GLXextensions);
|
||||||
|
}
|
||||||
|
|
||||||
|
screen->enterVT = pScrn->EnterVT;
|
||||||
|
pScrn->EnterVT = glxDRIEnterVT;
|
||||||
|
screen->leaveVT = pScrn->LeaveVT;
|
||||||
|
pScrn->LeaveVT = glxDRILeaveVT;
|
||||||
|
|
||||||
|
LogMessage(X_INFO,
|
||||||
|
"AIGLX: Loaded and initialized %s\n", filename);
|
||||||
|
|
||||||
|
return &screen->base;
|
||||||
|
|
||||||
|
handle_error:
|
||||||
|
if (screen->driver)
|
||||||
|
dlclose(screen->driver);
|
||||||
|
|
||||||
|
xfree(screen);
|
||||||
|
|
||||||
|
LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
__GLXprovider __glXDRI2Provider = {
|
||||||
|
__glXDRIscreenProbe,
|
||||||
|
"DRI2",
|
||||||
|
NULL
|
||||||
|
};
|
|
@ -280,6 +280,30 @@ void GlxSetVisualConfigs(int nconfigs,
|
||||||
* call it. */
|
* call it. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
filterOutNativeConfigs(__GLXscreen *pGlxScreen)
|
||||||
|
{
|
||||||
|
__GLcontextModes *m, *next, *native_modes, **last;
|
||||||
|
ScreenPtr pScreen = pGlxScreen->pScreen;
|
||||||
|
int i, depth;
|
||||||
|
|
||||||
|
last = &pGlxScreen->fbconfigs;
|
||||||
|
for (m = pGlxScreen->fbconfigs; m != NULL; m = next) {
|
||||||
|
next = m->next;
|
||||||
|
depth = m->redBits + m->blueBits + m->greenBits;
|
||||||
|
|
||||||
|
for (i = 0; i < pScreen->numVisuals; i++) {
|
||||||
|
if (pScreen->visuals[i].nplanes == depth) {
|
||||||
|
*last = m;
|
||||||
|
last = &m->next;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*last = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static XID
|
static XID
|
||||||
findVisualForConfig(ScreenPtr pScreen, __GLcontextModes *m)
|
findVisualForConfig(ScreenPtr pScreen, __GLcontextModes *m)
|
||||||
{
|
{
|
||||||
|
@ -513,6 +537,8 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
|
||||||
pGlxScreen->CloseScreen = pScreen->CloseScreen;
|
pGlxScreen->CloseScreen = pScreen->CloseScreen;
|
||||||
pScreen->CloseScreen = glxCloseScreen;
|
pScreen->CloseScreen = glxCloseScreen;
|
||||||
|
|
||||||
|
filterOutNativeConfigs(pGlxScreen);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) {
|
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) {
|
||||||
m->fbconfigID = FakeClientID(0);
|
m->fbconfigID = FakeClientID(0);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,832 +0,0 @@
|
||||||
/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (C) Copyright IBM Corporation 2005
|
|
||||||
* 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
|
|
||||||
* IBM,
|
|
||||||
* AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
||||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#include "glxserver.h"
|
|
||||||
#include "glxbyteorder.h"
|
|
||||||
#include "indirect_size.h"
|
|
||||||
#include "indirect_reqsize.h"
|
|
||||||
|
|
||||||
#define __GLX_PAD(x) (((x) + 3) & ~3)
|
|
||||||
|
|
||||||
#if defined(__CYGWIN__) || defined(__MINGW32__)
|
|
||||||
# undef HAVE_ALIAS
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_ALIAS
|
|
||||||
# define ALIAS2(from,to) \
|
|
||||||
GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \
|
|
||||||
__attribute__ ((alias( # to )));
|
|
||||||
# define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize )
|
|
||||||
#else
|
|
||||||
# define ALIAS(from,to) \
|
|
||||||
GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \
|
|
||||||
{ return __glX ## to ## ReqSize( pc, swap ); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXCallListsReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei n = *(GLsizei *) (pc + 0);
|
|
||||||
GLenum type = *(GLenum *) (pc + 4);
|
|
||||||
GLsizei compsize;
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
n = bswap_32(n);
|
|
||||||
type = bswap_32(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
compsize = __glCallLists_size(type);
|
|
||||||
return __GLX_PAD((compsize * n));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXBitmapReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = 0;
|
|
||||||
GLint skip_images = 0;
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 8);
|
|
||||||
GLint alignment = *(GLint *) (pc + 16);
|
|
||||||
GLsizei width = *(GLsizei *) (pc + 20);
|
|
||||||
GLsizei height = *(GLsizei *) (pc + 24);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
width = bswap_32(width);
|
|
||||||
height = bswap_32(height);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, width, height, 1,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXFogfvReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLenum pname = *(GLenum *) (pc + 0);
|
|
||||||
GLsizei compsize;
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
pname = bswap_32(pname);
|
|
||||||
}
|
|
||||||
|
|
||||||
compsize = __glFogfv_size(pname);
|
|
||||||
return __GLX_PAD((compsize * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXLightfvReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLenum pname = *(GLenum *) (pc + 4);
|
|
||||||
GLsizei compsize;
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
pname = bswap_32(pname);
|
|
||||||
}
|
|
||||||
|
|
||||||
compsize = __glLightfv_size(pname);
|
|
||||||
return __GLX_PAD((compsize * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXLightModelfvReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLenum pname = *(GLenum *) (pc + 0);
|
|
||||||
GLsizei compsize;
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
pname = bswap_32(pname);
|
|
||||||
}
|
|
||||||
|
|
||||||
compsize = __glLightModelfv_size(pname);
|
|
||||||
return __GLX_PAD((compsize * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXMaterialfvReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLenum pname = *(GLenum *) (pc + 4);
|
|
||||||
GLsizei compsize;
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
pname = bswap_32(pname);
|
|
||||||
}
|
|
||||||
|
|
||||||
compsize = __glMaterialfv_size(pname);
|
|
||||||
return __GLX_PAD((compsize * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXPolygonStippleReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = 0;
|
|
||||||
GLint skip_images = 0;
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 8);
|
|
||||||
GLint alignment = *(GLint *) (pc + 16);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, 32, 32, 1,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXTexParameterfvReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLenum pname = *(GLenum *) (pc + 4);
|
|
||||||
GLsizei compsize;
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
pname = bswap_32(pname);
|
|
||||||
}
|
|
||||||
|
|
||||||
compsize = __glTexParameterfv_size(pname);
|
|
||||||
return __GLX_PAD((compsize * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXTexImage1DReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = 0;
|
|
||||||
GLint skip_images = 0;
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 8);
|
|
||||||
GLint alignment = *(GLint *) (pc + 16);
|
|
||||||
GLenum target = *(GLenum *) (pc + 20);
|
|
||||||
GLsizei width = *(GLsizei *) (pc + 32);
|
|
||||||
GLenum format = *(GLenum *) (pc + 44);
|
|
||||||
GLenum type = *(GLenum *) (pc + 48);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
target = bswap_32(target);
|
|
||||||
width = bswap_32(width);
|
|
||||||
format = bswap_32(format);
|
|
||||||
type = bswap_32(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(format, type, target, width, 1, 1,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXTexImage2DReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = 0;
|
|
||||||
GLint skip_images = 0;
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 8);
|
|
||||||
GLint alignment = *(GLint *) (pc + 16);
|
|
||||||
GLenum target = *(GLenum *) (pc + 20);
|
|
||||||
GLsizei width = *(GLsizei *) (pc + 32);
|
|
||||||
GLsizei height = *(GLsizei *) (pc + 36);
|
|
||||||
GLenum format = *(GLenum *) (pc + 44);
|
|
||||||
GLenum type = *(GLenum *) (pc + 48);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
target = bswap_32(target);
|
|
||||||
width = bswap_32(width);
|
|
||||||
height = bswap_32(height);
|
|
||||||
format = bswap_32(format);
|
|
||||||
type = bswap_32(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(format, type, target, width, height, 1,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXTexEnvfvReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLenum pname = *(GLenum *) (pc + 4);
|
|
||||||
GLsizei compsize;
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
pname = bswap_32(pname);
|
|
||||||
}
|
|
||||||
|
|
||||||
compsize = __glTexEnvfv_size(pname);
|
|
||||||
return __GLX_PAD((compsize * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXTexGendvReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLenum pname = *(GLenum *) (pc + 4);
|
|
||||||
GLsizei compsize;
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
pname = bswap_32(pname);
|
|
||||||
}
|
|
||||||
|
|
||||||
compsize = __glTexGendv_size(pname);
|
|
||||||
return __GLX_PAD((compsize * 8));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXTexGenfvReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLenum pname = *(GLenum *) (pc + 4);
|
|
||||||
GLsizei compsize;
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
pname = bswap_32(pname);
|
|
||||||
}
|
|
||||||
|
|
||||||
compsize = __glTexGenfv_size(pname);
|
|
||||||
return __GLX_PAD((compsize * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXPixelMapfvReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei mapsize = *(GLsizei *) (pc + 4);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
mapsize = bswap_32(mapsize);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD((mapsize * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXPixelMapusvReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei mapsize = *(GLsizei *) (pc + 4);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
mapsize = bswap_32(mapsize);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD((mapsize * 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXDrawPixelsReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = 0;
|
|
||||||
GLint skip_images = 0;
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 8);
|
|
||||||
GLint alignment = *(GLint *) (pc + 16);
|
|
||||||
GLsizei width = *(GLsizei *) (pc + 20);
|
|
||||||
GLsizei height = *(GLsizei *) (pc + 24);
|
|
||||||
GLenum format = *(GLenum *) (pc + 28);
|
|
||||||
GLenum type = *(GLenum *) (pc + 32);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
width = bswap_32(width);
|
|
||||||
height = bswap_32(height);
|
|
||||||
format = bswap_32(format);
|
|
||||||
type = bswap_32(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(format, type, 0, width, height, 1,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei n = *(GLsizei *) (pc + 0);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
n = bswap_32(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD((n * 4) + (n * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = 0;
|
|
||||||
GLint skip_images = 0;
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 8);
|
|
||||||
GLint alignment = *(GLint *) (pc + 16);
|
|
||||||
GLenum target = *(GLenum *) (pc + 20);
|
|
||||||
GLsizei width = *(GLsizei *) (pc + 36);
|
|
||||||
GLenum format = *(GLenum *) (pc + 44);
|
|
||||||
GLenum type = *(GLenum *) (pc + 48);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
target = bswap_32(target);
|
|
||||||
width = bswap_32(width);
|
|
||||||
format = bswap_32(format);
|
|
||||||
type = bswap_32(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(format, type, target, width, 1, 1,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = 0;
|
|
||||||
GLint skip_images = 0;
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 8);
|
|
||||||
GLint alignment = *(GLint *) (pc + 16);
|
|
||||||
GLenum target = *(GLenum *) (pc + 20);
|
|
||||||
GLsizei width = *(GLsizei *) (pc + 36);
|
|
||||||
GLsizei height = *(GLsizei *) (pc + 40);
|
|
||||||
GLenum format = *(GLenum *) (pc + 44);
|
|
||||||
GLenum type = *(GLenum *) (pc + 48);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
target = bswap_32(target);
|
|
||||||
width = bswap_32(width);
|
|
||||||
height = bswap_32(height);
|
|
||||||
format = bswap_32(format);
|
|
||||||
type = bswap_32(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(format, type, target, width, height, 1,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXColorTableReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = 0;
|
|
||||||
GLint skip_images = 0;
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 8);
|
|
||||||
GLint alignment = *(GLint *) (pc + 16);
|
|
||||||
GLenum target = *(GLenum *) (pc + 20);
|
|
||||||
GLsizei width = *(GLsizei *) (pc + 28);
|
|
||||||
GLenum format = *(GLenum *) (pc + 32);
|
|
||||||
GLenum type = *(GLenum *) (pc + 36);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
target = bswap_32(target);
|
|
||||||
width = bswap_32(width);
|
|
||||||
format = bswap_32(format);
|
|
||||||
type = bswap_32(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(format, type, target, width, 1, 1,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLenum pname = *(GLenum *) (pc + 4);
|
|
||||||
GLsizei compsize;
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
pname = bswap_32(pname);
|
|
||||||
}
|
|
||||||
|
|
||||||
compsize = __glColorTableParameterfv_size(pname);
|
|
||||||
return __GLX_PAD((compsize * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXColorSubTableReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = 0;
|
|
||||||
GLint skip_images = 0;
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 8);
|
|
||||||
GLint alignment = *(GLint *) (pc + 16);
|
|
||||||
GLenum target = *(GLenum *) (pc + 20);
|
|
||||||
GLsizei count = *(GLsizei *) (pc + 28);
|
|
||||||
GLenum format = *(GLenum *) (pc + 32);
|
|
||||||
GLenum type = *(GLenum *) (pc + 36);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
target = bswap_32(target);
|
|
||||||
count = bswap_32(count);
|
|
||||||
format = bswap_32(format);
|
|
||||||
type = bswap_32(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(format, type, target, count, 1, 1,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = 0;
|
|
||||||
GLint skip_images = 0;
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 8);
|
|
||||||
GLint alignment = *(GLint *) (pc + 16);
|
|
||||||
GLenum target = *(GLenum *) (pc + 20);
|
|
||||||
GLsizei width = *(GLsizei *) (pc + 28);
|
|
||||||
GLenum format = *(GLenum *) (pc + 36);
|
|
||||||
GLenum type = *(GLenum *) (pc + 40);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
target = bswap_32(target);
|
|
||||||
width = bswap_32(width);
|
|
||||||
format = bswap_32(format);
|
|
||||||
type = bswap_32(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(format, type, target, width, 1, 1,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = 0;
|
|
||||||
GLint skip_images = 0;
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 8);
|
|
||||||
GLint alignment = *(GLint *) (pc + 16);
|
|
||||||
GLenum target = *(GLenum *) (pc + 20);
|
|
||||||
GLsizei width = *(GLsizei *) (pc + 28);
|
|
||||||
GLsizei height = *(GLsizei *) (pc + 32);
|
|
||||||
GLenum format = *(GLenum *) (pc + 36);
|
|
||||||
GLenum type = *(GLenum *) (pc + 40);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
target = bswap_32(target);
|
|
||||||
width = bswap_32(width);
|
|
||||||
height = bswap_32(height);
|
|
||||||
format = bswap_32(format);
|
|
||||||
type = bswap_32(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(format, type, target, width, height, 1,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLenum pname = *(GLenum *) (pc + 4);
|
|
||||||
GLsizei compsize;
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
pname = bswap_32(pname);
|
|
||||||
}
|
|
||||||
|
|
||||||
compsize = __glConvolutionParameterfv_size(pname);
|
|
||||||
return __GLX_PAD((compsize * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXTexImage3DReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = *(GLint *) (pc + 8);
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 16);
|
|
||||||
GLint skip_images = *(GLint *) (pc + 20);
|
|
||||||
GLint alignment = *(GLint *) (pc + 32);
|
|
||||||
GLenum target = *(GLenum *) (pc + 36);
|
|
||||||
GLsizei width = *(GLsizei *) (pc + 48);
|
|
||||||
GLsizei height = *(GLsizei *) (pc + 52);
|
|
||||||
GLsizei depth = *(GLsizei *) (pc + 56);
|
|
||||||
GLenum format = *(GLenum *) (pc + 68);
|
|
||||||
GLenum type = *(GLenum *) (pc + 72);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
image_height = bswap_32(image_height);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
skip_images = bswap_32(skip_images);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
target = bswap_32(target);
|
|
||||||
width = bswap_32(width);
|
|
||||||
height = bswap_32(height);
|
|
||||||
depth = bswap_32(depth);
|
|
||||||
format = bswap_32(format);
|
|
||||||
type = bswap_32(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(format, type, target, width, height, depth,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLint row_length = *(GLint *) (pc + 4);
|
|
||||||
GLint image_height = *(GLint *) (pc + 8);
|
|
||||||
GLint skip_rows = *(GLint *) (pc + 16);
|
|
||||||
GLint skip_images = *(GLint *) (pc + 20);
|
|
||||||
GLint alignment = *(GLint *) (pc + 32);
|
|
||||||
GLenum target = *(GLenum *) (pc + 36);
|
|
||||||
GLsizei width = *(GLsizei *) (pc + 60);
|
|
||||||
GLsizei height = *(GLsizei *) (pc + 64);
|
|
||||||
GLsizei depth = *(GLsizei *) (pc + 68);
|
|
||||||
GLenum format = *(GLenum *) (pc + 76);
|
|
||||||
GLenum type = *(GLenum *) (pc + 80);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
row_length = bswap_32(row_length);
|
|
||||||
image_height = bswap_32(image_height);
|
|
||||||
skip_rows = bswap_32(skip_rows);
|
|
||||||
skip_images = bswap_32(skip_images);
|
|
||||||
alignment = bswap_32(alignment);
|
|
||||||
target = bswap_32(target);
|
|
||||||
width = bswap_32(width);
|
|
||||||
height = bswap_32(height);
|
|
||||||
depth = bswap_32(depth);
|
|
||||||
format = bswap_32(format);
|
|
||||||
type = bswap_32(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __glXImageSize(format, type, target, width, height, depth,
|
|
||||||
image_height, row_length, skip_images,
|
|
||||||
skip_rows, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei imageSize = *(GLsizei *) (pc + 20);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
imageSize = bswap_32(imageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD(imageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei imageSize = *(GLsizei *) (pc + 24);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
imageSize = bswap_32(imageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD(imageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei imageSize = *(GLsizei *) (pc + 28);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
imageSize = bswap_32(imageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD(imageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei imageSize = *(GLsizei *) (pc + 36);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
imageSize = bswap_32(imageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD(imageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXProgramStringARBReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei len = *(GLsizei *) (pc + 8);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
len = bswap_32(len);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD(len);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei n = *(GLsizei *) (pc + 0);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
n = bswap_32(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD((n * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLenum pname = *(GLenum *) (pc + 0);
|
|
||||||
GLsizei compsize;
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
pname = bswap_32(pname);
|
|
||||||
}
|
|
||||||
|
|
||||||
compsize = __glPointParameterfvEXT_size(pname);
|
|
||||||
return __GLX_PAD((compsize * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLuint num = *(GLuint *) (pc + 8);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
num = bswap_32(num);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD((num * 32));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLuint num = *(GLuint *) (pc + 8);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
num = bswap_32(num);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD((num * 16));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei n = *(GLsizei *) (pc + 4);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
n = bswap_32(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD((n * 8));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei n = *(GLsizei *) (pc + 4);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
n = bswap_32(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD((n * 16));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei n = *(GLsizei *) (pc + 4);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
n = bswap_32(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD((n * 24));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei n = *(GLsizei *) (pc + 4);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
n = bswap_32(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD((n * 12));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei n = *(GLsizei *) (pc + 4);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
n = bswap_32(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD((n * 6));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei n = *(GLsizei *) (pc + 4);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
n = bswap_32(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD((n * 32));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap)
|
|
||||||
{
|
|
||||||
GLsizei len = *(GLsizei *) (pc + 4);
|
|
||||||
|
|
||||||
if (swap) {
|
|
||||||
len = bswap_32(len);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __GLX_PAD(len);
|
|
||||||
}
|
|
||||||
|
|
||||||
ALIAS(Fogiv, Fogfv)
|
|
||||||
ALIAS(Lightiv, Lightfv)
|
|
||||||
ALIAS(LightModeliv, LightModelfv)
|
|
||||||
ALIAS(Materialiv, Materialfv)
|
|
||||||
ALIAS(TexParameteriv, TexParameterfv)
|
|
||||||
ALIAS(TexEnviv, TexEnvfv)
|
|
||||||
ALIAS(TexGeniv, TexGenfv)
|
|
||||||
ALIAS(PixelMapuiv, PixelMapfv)
|
|
||||||
ALIAS(ColorTableParameteriv, ColorTableParameterfv)
|
|
||||||
ALIAS(ConvolutionParameteriv, ConvolutionParameterfv)
|
|
||||||
ALIAS(CompressedTexSubImage1DARB, CompressedTexImage1DARB)
|
|
||||||
ALIAS(CompressedTexSubImage2DARB, CompressedTexImage3DARB)
|
|
||||||
ALIAS(LoadProgramNV, ProgramStringARB)
|
|
||||||
ALIAS(RequestResidentProgramsNV, DrawBuffersARB)
|
|
||||||
ALIAS(VertexAttribs1fvNV, PixelMapfv)
|
|
||||||
ALIAS(VertexAttribs1svNV, PixelMapusv)
|
|
||||||
ALIAS(VertexAttribs2fvNV, VertexAttribs1dvNV)
|
|
||||||
ALIAS(VertexAttribs2svNV, PixelMapfv)
|
|
||||||
ALIAS(VertexAttribs4fvNV, VertexAttribs2dvNV)
|
|
||||||
ALIAS(VertexAttribs4svNV, VertexAttribs1dvNV)
|
|
||||||
ALIAS(VertexAttribs4ubvNV, PixelMapfv)
|
|
||||||
ALIAS(PointParameterivNV, PointParameterfvEXT)
|
|
||||||
ALIAS(ProgramNamedParameter4dvNV, CompressedTexSubImage3DARB)
|
|
||||||
ALIAS(DeleteFramebuffersEXT, DrawBuffersARB)
|
|
||||||
ALIAS(DeleteRenderbuffersEXT, DrawBuffersARB)
|
|
|
@ -1,121 +0,0 @@
|
||||||
/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (C) Copyright IBM Corporation 2005
|
|
||||||
* 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
|
|
||||||
* IBM,
|
|
||||||
* AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
||||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined( _INDIRECT_REQSIZE_H_ )
|
|
||||||
# define _INDIRECT_REQSIZE_H_
|
|
||||||
|
|
||||||
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
|
|
||||||
# define HIDDEN __attribute__((visibility("hidden")))
|
|
||||||
# else
|
|
||||||
# define HIDDEN
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
|
||||||
# define PURE __attribute__((pure))
|
|
||||||
# else
|
|
||||||
# define PURE
|
|
||||||
# endif
|
|
||||||
|
|
||||||
extern PURE HIDDEN int __glXCallListsReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXBitmapReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXFogfvReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXFogivReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXLightfvReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXLightivReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXLightModelfvReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXLightModelivReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXMaterialfvReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXMaterialivReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXPolygonStippleReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexParameterfvReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexParameterivReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexImage1DReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexImage2DReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexEnvfvReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexEnvivReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexGendvReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexGenfvReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexGenivReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXMap1dReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXMap1fReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXMap2dReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXMap2fReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXPixelMapfvReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXPixelMapuivReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXPixelMapusvReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXDrawPixelsReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXDrawArraysReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXColorTableReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXColorTableParameterivReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXColorSubTableReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexImage3DReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXLoadProgramNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXRequestResidentProgramsNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs1fvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs1svNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs2fvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs2svNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXPointParameterivNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap);
|
|
||||||
|
|
||||||
# undef HIDDEN
|
|
||||||
# undef PURE
|
|
||||||
|
|
||||||
#endif /* !defined( _INDIRECT_REQSIZE_H_ ) */
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,102 +0,0 @@
|
||||||
/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (C) Copyright IBM Corporation 2004
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* 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
|
|
||||||
* IBM,
|
|
||||||
* AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
||||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined( _INDIRECT_SIZE_GET_H_ )
|
|
||||||
# define _INDIRECT_SIZE_GET_H_
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file
|
|
||||||
* Prototypes for functions used to determine the number of data elements in
|
|
||||||
* various GLX protocol messages.
|
|
||||||
*
|
|
||||||
* \author Ian Romanick <idr@us.ibm.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
|
||||||
# define PURE __attribute__((pure))
|
|
||||||
# else
|
|
||||||
# define PURE
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
|
|
||||||
# define FASTCALL __attribute__((fastcall))
|
|
||||||
# else
|
|
||||||
# define FASTCALL
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
|
|
||||||
# define INTERNAL __attribute__((visibility("internal")))
|
|
||||||
# else
|
|
||||||
# define INTERNAL
|
|
||||||
# endif
|
|
||||||
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetBooleanv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetDoublev_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetFloatv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetIntegerv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetLightfv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetLightiv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetMaterialfv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetMaterialiv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetTexEnvfv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetTexEnviv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetTexGendv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetTexGenfv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetTexGeniv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetTexParameterfv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetTexParameteriv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameterfv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameteriv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameterfv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameteriv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint
|
|
||||||
__glGetConvolutionParameterfv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint
|
|
||||||
__glGetConvolutionParameteriv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameterfv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameteriv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetMinmaxParameterfv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetMinmaxParameteriv_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetProgramivARB_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvARB_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvARB_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivARB_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectivARB_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectuivARB_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetQueryivARB_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetProgramivNV_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvNV_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvNV_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivNV_size(GLenum);
|
|
||||||
extern INTERNAL PURE FASTCALL GLint
|
|
||||||
__glGetFramebufferAttachmentParameterivEXT_size(GLenum);
|
|
||||||
|
|
||||||
# undef PURE
|
|
||||||
# undef FASTCALL
|
|
||||||
# undef INTERNAL
|
|
||||||
|
|
||||||
#endif /* !defined( _INDIRECT_SIZE_GET_H_ ) */
|
|
File diff suppressed because it is too large
Load Diff
|
@ -229,6 +229,14 @@ symlink_glx() {
|
||||||
action indirect_size.h
|
action indirect_size.h
|
||||||
action glcontextmodes.c
|
action glcontextmodes.c
|
||||||
action glcontextmodes.h
|
action glcontextmodes.h
|
||||||
|
action indirect_dispatch.c
|
||||||
|
action indirect_dispatch.h
|
||||||
|
action indirect_dispatch_swap.c
|
||||||
|
action indirect_reqsize.c
|
||||||
|
action indirect_reqsize.h
|
||||||
|
action indirect_size_get.c
|
||||||
|
action indirect_size_get.h
|
||||||
|
action indirect_table.c
|
||||||
|
|
||||||
src_dir src/mesa/glapi
|
src_dir src/mesa/glapi
|
||||||
|
|
||||||
|
|
262
Xext/panoramiX.c
262
Xext/panoramiX.c
|
@ -81,9 +81,6 @@ static DepthPtr PanoramiXDepths;
|
||||||
static int PanoramiXNumVisuals;
|
static int PanoramiXNumVisuals;
|
||||||
static VisualPtr PanoramiXVisuals;
|
static VisualPtr PanoramiXVisuals;
|
||||||
|
|
||||||
/* We support at most 256 visuals */
|
|
||||||
_X_EXPORT XID *PanoramiXVisualTable = NULL;
|
|
||||||
|
|
||||||
_X_EXPORT unsigned long XRC_DRAWABLE;
|
_X_EXPORT unsigned long XRC_DRAWABLE;
|
||||||
_X_EXPORT unsigned long XRT_WINDOW;
|
_X_EXPORT unsigned long XRT_WINDOW;
|
||||||
_X_EXPORT unsigned long XRT_PIXMAP;
|
_X_EXPORT unsigned long XRT_PIXMAP;
|
||||||
|
@ -463,10 +460,8 @@ void PanoramiXExtensionInit(int argc, char *argv[])
|
||||||
ProcPanoramiXDispatch,
|
ProcPanoramiXDispatch,
|
||||||
SProcPanoramiXDispatch, PanoramiXResetProc,
|
SProcPanoramiXDispatch, PanoramiXResetProc,
|
||||||
StandardMinorOpcode);
|
StandardMinorOpcode);
|
||||||
if (!extEntry) {
|
if (!extEntry)
|
||||||
ErrorF("PanoramiXExtensionInit(): failed to AddExtension\n");
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First make sure all the basic allocations succeed. If not,
|
* First make sure all the basic allocations succeed. If not,
|
||||||
|
@ -514,7 +509,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
noPanoramiXExtension = TRUE;
|
noPanoramiXExtension = TRUE;
|
||||||
ErrorF("%s Extension failed to initialize\n", PANORAMIX_PROTOCOL_NAME);
|
ErrorF(PANORAMIX_PROTOCOL_NAME " extension failed to initialize\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,14 +599,14 @@ Bool PanoramiXCreateConnectionBlock(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!PanoramiXNumDepths) {
|
if(!PanoramiXNumDepths) {
|
||||||
ErrorF("PanoramiX error: Incompatible screens. No common visuals\n");
|
ErrorF("Xinerama error: No common visuals\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 1; i < screenInfo.numScreens; i++) {
|
for(i = 1; i < screenInfo.numScreens; i++) {
|
||||||
pScreen = screenInfo.screens[i];
|
pScreen = screenInfo.screens[i];
|
||||||
if(pScreen->rootDepth != screenInfo.screens[0]->rootDepth) {
|
if(pScreen->rootDepth != screenInfo.screens[0]->rootDepth) {
|
||||||
ErrorF("PanoramiX error: Incompatible screens. Root window depths differ\n");
|
ErrorF("Xinerama error: Root window depths differ\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if(pScreen->backingStoreSupport != screenInfo.screens[0]->backingStoreSupport)
|
if(pScreen->backingStoreSupport != screenInfo.screens[0]->backingStoreSupport)
|
||||||
|
@ -704,143 +699,133 @@ Bool PanoramiXCreateConnectionBlock(void)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern
|
/*
|
||||||
void PanoramiXConsolidate(void)
|
* This isn't just memcmp(), bitsPerRGBValue is skipped. markv made that
|
||||||
|
* change way back before xf86 4.0, but the comment for _why_ is a bit
|
||||||
|
* opaque, so I'm not going to question it for now.
|
||||||
|
*
|
||||||
|
* This is probably better done as a screen hook so DBE/EVI/GLX can add
|
||||||
|
* their own tests, and adding privates to VisualRec so they don't have to
|
||||||
|
* do their own back-mapping.
|
||||||
|
*/
|
||||||
|
static Bool
|
||||||
|
VisualsEqual(VisualPtr a, VisualPtr b)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
return ((a->class == b->class) &&
|
||||||
VisualPtr pVisual, pVisual2;
|
(a->ColormapEntries == b->ColormapEntries) &&
|
||||||
ScreenPtr pScreen, pScreen2;
|
(a->nplanes == b->nplanes) &&
|
||||||
DepthPtr pDepth, pDepth2;
|
(a->redMask == b->redMask) &&
|
||||||
PanoramiXRes *root, *defmap, *saver;
|
(a->greenMask == b->greenMask) &&
|
||||||
Bool foundDepth, missingDepth;
|
(a->blueMask == b->blueMask) &&
|
||||||
|
(a->offsetRed == b->offsetRed) &&
|
||||||
|
(a->offsetGreen == b->offsetGreen) &&
|
||||||
|
(a->offsetBlue == b->offsetBlue));
|
||||||
|
}
|
||||||
|
|
||||||
if(!PanoramiXVisualTable)
|
static void
|
||||||
PanoramiXVisualTable = xcalloc(256 * MAXSCREENS, sizeof(XID));
|
PanoramiXMaybeAddDepth(DepthPtr pDepth)
|
||||||
|
{
|
||||||
|
ScreenPtr pScreen;
|
||||||
|
int j, k;
|
||||||
|
Bool found = FALSE;
|
||||||
|
|
||||||
pScreen = screenInfo.screens[0];
|
for (j = 1; j < PanoramiXNumScreens; j++) {
|
||||||
pVisual = pScreen->visuals;
|
pScreen = screenInfo.screens[j];
|
||||||
pDepth = pScreen->allowedDepths;
|
for (k = 0; k < pScreen->numDepths; k++) {
|
||||||
|
if (pScreen->allowedDepths[k].depth == pDepth->depth) {
|
||||||
PanoramiXNumDepths = 0;
|
found = TRUE;
|
||||||
PanoramiXDepths = xcalloc(pScreen->numDepths,sizeof(DepthRec));
|
break;
|
||||||
PanoramiXNumVisuals = 0;
|
}
|
||||||
PanoramiXVisuals = xcalloc(pScreen->numVisuals,sizeof(VisualRec));
|
}
|
||||||
|
|
||||||
for (i = 0; i < pScreen->numDepths; i++, pDepth++) {
|
|
||||||
missingDepth = FALSE;
|
|
||||||
for (j = 1; j < PanoramiXNumScreens; j++) {
|
|
||||||
pScreen2 = screenInfo.screens[j];
|
|
||||||
pDepth2 = pScreen2->allowedDepths;
|
|
||||||
|
|
||||||
foundDepth = FALSE;
|
|
||||||
for (k = 0; k < pScreen2->numDepths; k++, pDepth2++) {
|
|
||||||
if(pDepth2->depth == pDepth->depth) {
|
|
||||||
foundDepth = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!foundDepth) {
|
|
||||||
missingDepth = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!missingDepth) {
|
|
||||||
PanoramiXDepths[PanoramiXNumDepths].depth = pDepth->depth;
|
|
||||||
PanoramiXDepths[PanoramiXNumDepths].numVids = 0;
|
|
||||||
if(pDepth->numVids)
|
|
||||||
PanoramiXDepths[PanoramiXNumDepths].vids =
|
|
||||||
xalloc(sizeof(VisualID) * pDepth->numVids);
|
|
||||||
else
|
|
||||||
PanoramiXDepths[PanoramiXNumDepths].vids = NULL;
|
|
||||||
PanoramiXNumDepths++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
|
if (!found)
|
||||||
PanoramiXVisualTable[pVisual->vid * MAXSCREENS] = pVisual->vid;
|
return;
|
||||||
|
|
||||||
/* check if the visual exists on all screens */
|
j = PanoramiXNumDepths;
|
||||||
for (j = 1; j < PanoramiXNumScreens; j++) {
|
PanoramiXNumDepths++;
|
||||||
pScreen2 = screenInfo.screens[j];
|
PanoramiXDepths = xrealloc(PanoramiXDepths,
|
||||||
|
PanoramiXNumDepths * sizeof(DepthRec));
|
||||||
|
PanoramiXDepths[j].depth = pDepth->depth;
|
||||||
|
PanoramiXDepths[j].numVids = 0;
|
||||||
|
/* XXX suboptimal, should grow these dynamically */
|
||||||
|
if(pDepth->numVids)
|
||||||
|
PanoramiXDepths[j].vids = xalloc(sizeof(VisualID) * pDepth->numVids);
|
||||||
|
else
|
||||||
|
PanoramiXDepths[j].vids = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
PanoramiXMaybeAddVisual(VisualPtr pVisual)
|
||||||
|
{
|
||||||
|
ScreenPtr pScreen;
|
||||||
|
VisualPtr candidate = NULL;
|
||||||
|
int j, k;
|
||||||
|
Bool found = FALSE;
|
||||||
|
|
||||||
|
for (j = 1; j < PanoramiXNumScreens; j++) {
|
||||||
|
pScreen = screenInfo.screens[j];
|
||||||
|
found = FALSE;
|
||||||
|
|
||||||
|
candidate = pScreen->visuals;
|
||||||
|
for (k = 0; k < pScreen->numVisuals; k++) {
|
||||||
|
candidate++;
|
||||||
|
if (VisualsEqual(pVisual, candidate)
|
||||||
#ifdef GLXPROXY
|
#ifdef GLXPROXY
|
||||||
pVisual2 = glxMatchVisual(pScreen, pVisual, pScreen2);
|
&& glxMatchVisual(screenInfo.screens[0], pVisual, pScreen)
|
||||||
if (pVisual2) {
|
|
||||||
PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] =
|
|
||||||
pVisual2->vid;
|
|
||||||
continue;
|
|
||||||
} else if (glxMatchVisual(pScreen, pVisual, pScreen)) {
|
|
||||||
PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
pVisual2 = pScreen2->visuals;
|
) {
|
||||||
|
found = TRUE;
|
||||||
for (k = 0; k < pScreen2->numVisuals; k++, pVisual2++) {
|
|
||||||
if ((pVisual->class == pVisual2->class) &&
|
|
||||||
(pVisual->ColormapEntries == pVisual2->ColormapEntries) &&
|
|
||||||
(pVisual->nplanes == pVisual2->nplanes) &&
|
|
||||||
(pVisual->redMask == pVisual2->redMask) &&
|
|
||||||
(pVisual->greenMask == pVisual2->greenMask) &&
|
|
||||||
(pVisual->blueMask == pVisual2->blueMask) &&
|
|
||||||
(pVisual->offsetRed == pVisual2->offsetRed) &&
|
|
||||||
(pVisual->offsetGreen == pVisual2->offsetGreen) &&
|
|
||||||
(pVisual->offsetBlue == pVisual2->offsetBlue))
|
|
||||||
{
|
|
||||||
/* We merely assign the first visual that matches. OpenGL
|
|
||||||
will need to get involved at some point if you want
|
|
||||||
match GLX visuals */
|
|
||||||
PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] =
|
|
||||||
pVisual2->vid;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if it doesn't exist on all screens we can't use it */
|
|
||||||
for (j = 0; j < PanoramiXNumScreens; j++) {
|
|
||||||
if (!PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j]) {
|
|
||||||
PanoramiXVisualTable[pVisual->vid * MAXSCREENS] = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if it does, make sure it's in the list of supported depths and visuals */
|
if (!found)
|
||||||
if(PanoramiXVisualTable[pVisual->vid * MAXSCREENS]) {
|
return;
|
||||||
PanoramiXVisuals[PanoramiXNumVisuals].vid = pVisual->vid;
|
}
|
||||||
PanoramiXVisuals[PanoramiXNumVisuals].class = pVisual->class;
|
|
||||||
PanoramiXVisuals[PanoramiXNumVisuals].bitsPerRGBValue = pVisual->bitsPerRGBValue;
|
|
||||||
PanoramiXVisuals[PanoramiXNumVisuals].ColormapEntries = pVisual->ColormapEntries;
|
|
||||||
PanoramiXVisuals[PanoramiXNumVisuals].nplanes = pVisual->nplanes;
|
|
||||||
PanoramiXVisuals[PanoramiXNumVisuals].redMask = pVisual->redMask;
|
|
||||||
PanoramiXVisuals[PanoramiXNumVisuals].greenMask = pVisual->greenMask;
|
|
||||||
PanoramiXVisuals[PanoramiXNumVisuals].blueMask = pVisual->blueMask;
|
|
||||||
PanoramiXVisuals[PanoramiXNumVisuals].offsetRed = pVisual->offsetRed;
|
|
||||||
PanoramiXVisuals[PanoramiXNumVisuals].offsetGreen = pVisual->offsetGreen;
|
|
||||||
PanoramiXVisuals[PanoramiXNumVisuals].offsetBlue = pVisual->offsetBlue;
|
|
||||||
PanoramiXNumVisuals++;
|
|
||||||
|
|
||||||
for (j = 0; j < PanoramiXNumDepths; j++) {
|
/* found a matching visual on all screens, add it to the subset list */
|
||||||
if (PanoramiXDepths[j].depth == pVisual->nplanes) {
|
j = PanoramiXNumVisuals;
|
||||||
PanoramiXDepths[j].vids[PanoramiXDepths[j].numVids] = pVisual->vid;
|
PanoramiXNumVisuals++;
|
||||||
PanoramiXDepths[j].numVids++;
|
PanoramiXVisuals = xrealloc(PanoramiXVisuals,
|
||||||
break;
|
PanoramiXNumVisuals * sizeof(VisualRec));
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
memcpy(&PanoramiXVisuals[j], pVisual, sizeof(VisualRec));
|
||||||
|
|
||||||
root = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes));
|
for (k = 0; k < PanoramiXNumDepths; k++) {
|
||||||
|
if (PanoramiXDepths[k].depth == pVisual->nplanes) {
|
||||||
|
PanoramiXDepths[k].vids[PanoramiXDepths[k].numVids] = pVisual->vid;
|
||||||
|
PanoramiXDepths[k].numVids++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void
|
||||||
|
PanoramiXConsolidate(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
PanoramiXRes *root, *defmap, *saver;
|
||||||
|
ScreenPtr pScreen = screenInfo.screens[0];
|
||||||
|
DepthPtr pDepth = pScreen->allowedDepths;
|
||||||
|
VisualPtr pVisual = pScreen->visuals;
|
||||||
|
|
||||||
|
PanoramiXNumDepths = 0;
|
||||||
|
PanoramiXNumVisuals = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < pScreen->numDepths; i++)
|
||||||
|
PanoramiXMaybeAddDepth(pDepth++);
|
||||||
|
|
||||||
|
for (i = 0; i < pScreen->numVisuals; i++)
|
||||||
|
PanoramiXMaybeAddVisual(pVisual++);
|
||||||
|
|
||||||
|
root = xalloc(sizeof(PanoramiXRes));
|
||||||
root->type = XRT_WINDOW;
|
root->type = XRT_WINDOW;
|
||||||
defmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes));
|
defmap = xalloc(sizeof(PanoramiXRes));
|
||||||
defmap->type = XRT_COLORMAP;
|
defmap->type = XRT_COLORMAP;
|
||||||
saver = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes));
|
saver = xalloc(sizeof(PanoramiXRes));
|
||||||
saver->type = XRT_WINDOW;
|
saver->type = XRT_WINDOW;
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < PanoramiXNumScreens; i++) {
|
for (i = 0; i < PanoramiXNumScreens; i++) {
|
||||||
root->info[i].id = WindowTable[i]->drawable.id;
|
root->info[i].id = WindowTable[i]->drawable.id;
|
||||||
root->u.win.class = InputOutput;
|
root->u.win.class = InputOutput;
|
||||||
|
@ -856,6 +841,31 @@ void PanoramiXConsolidate(void)
|
||||||
AddResource(defmap->info[0].id, XRT_COLORMAP, defmap);
|
AddResource(defmap->info[0].id, XRT_COLORMAP, defmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_X_EXPORT VisualID
|
||||||
|
PanoramiXTranslateVisualID(int screen, VisualID orig)
|
||||||
|
{
|
||||||
|
VisualPtr pVisual = NULL;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < PanoramiXNumVisuals; i++) {
|
||||||
|
if (orig == PanoramiXVisuals[i].vid) {
|
||||||
|
pVisual = &PanoramiXVisuals[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pVisual)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* found the original, now translate it relative to the backend screen */
|
||||||
|
for (i = 0; i < PanoramiXNumScreens; i++)
|
||||||
|
for (j = 0; j < screenInfo.screens[i]->numVisuals; j++)
|
||||||
|
if (VisualsEqual(pVisual, &screenInfo.screens[i]->visuals[j]))
|
||||||
|
return screenInfo.screens[i]->visuals[j].vid;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PanoramiXResetProc()
|
* PanoramiXResetProc()
|
||||||
|
|
|
@ -150,7 +150,7 @@ int PanoramiXCreateWindow(ClientPtr client)
|
||||||
if (cmap)
|
if (cmap)
|
||||||
*((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id;
|
*((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id;
|
||||||
if ( orig_visual != CopyFromParent )
|
if ( orig_visual != CopyFromParent )
|
||||||
stuff->visual = PanoramiXVisualTable[(orig_visual*MAXSCREENS) + j];
|
stuff->visual = PanoramiXTranslateVisualID(j, orig_visual);
|
||||||
result = (*SavedProcVector[X_CreateWindow])(client);
|
result = (*SavedProcVector[X_CreateWindow])(client);
|
||||||
if(result != Success) break;
|
if(result != Success) break;
|
||||||
}
|
}
|
||||||
|
@ -2077,9 +2077,6 @@ int PanoramiXCreateColormap(ClientPtr client)
|
||||||
client, stuff->window, XRT_WINDOW, DixReadAccess)))
|
client, stuff->window, XRT_WINDOW, DixReadAccess)))
|
||||||
return BadWindow;
|
return BadWindow;
|
||||||
|
|
||||||
if(!stuff->visual || (stuff->visual > 255))
|
|
||||||
return BadValue;
|
|
||||||
|
|
||||||
if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
|
if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
|
@ -2092,7 +2089,7 @@ int PanoramiXCreateColormap(ClientPtr client)
|
||||||
FOR_NSCREENS_BACKWARD(j){
|
FOR_NSCREENS_BACKWARD(j){
|
||||||
stuff->mid = newCmap->info[j].id;
|
stuff->mid = newCmap->info[j].id;
|
||||||
stuff->window = win->info[j].id;
|
stuff->window = win->info[j].id;
|
||||||
stuff->visual = PanoramiXVisualTable[(orig_visual * MAXSCREENS) + j];
|
stuff->visual = PanoramiXTranslateVisualID(j, orig_visual);
|
||||||
result = (* SavedProcVector[X_CreateColormap])(client);
|
result = (* SavedProcVector[X_CreateColormap])(client);
|
||||||
if(result != Success) break;
|
if(result != Success) break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ extern int PanoramiXNumScreens;
|
||||||
extern PanoramiXData *panoramiXdataPtr;
|
extern PanoramiXData *panoramiXdataPtr;
|
||||||
extern int PanoramiXPixWidth;
|
extern int PanoramiXPixWidth;
|
||||||
extern int PanoramiXPixHeight;
|
extern int PanoramiXPixHeight;
|
||||||
extern XID *PanoramiXVisualTable;
|
|
||||||
|
|
||||||
|
extern VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
|
||||||
extern void PanoramiXConsolidate(void);
|
extern void PanoramiXConsolidate(void);
|
||||||
extern Bool PanoramiXCreateConnectionBlock(void);
|
extern Bool PanoramiXCreateConnectionBlock(void);
|
||||||
extern PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int);
|
extern PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int);
|
||||||
|
|
|
@ -1346,8 +1346,7 @@ ProcScreenSaverSetAttributes (ClientPtr client)
|
||||||
*((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[i].id;
|
*((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[i].id;
|
||||||
|
|
||||||
if (orig_visual != CopyFromParent)
|
if (orig_visual != CopyFromParent)
|
||||||
stuff->visualID =
|
stuff->visualID = PanoramiXTranslateVisualID(i, orig_visual);
|
||||||
PanoramiXVisualTable[(orig_visual*MAXSCREENS) + i];
|
|
||||||
|
|
||||||
status = ScreenSaverSetAttributes(client);
|
status = ScreenSaverSetAttributes(client);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,9 @@ in this Software without prior written authorization from The Open Group.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
|
#include "inputstr.h"
|
||||||
|
#include "windowstr.h"
|
||||||
|
#include "propertyst.h"
|
||||||
#include "colormapst.h"
|
#include "colormapst.h"
|
||||||
#include "privates.h"
|
#include "privates.h"
|
||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
|
@ -67,10 +70,19 @@ static char *SecurityUntrustedExtensions[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Access modes that untrusted clients can do to trusted stuff */
|
/*
|
||||||
static const Mask SecurityAllowedMask =
|
* Access modes that untrusted clients are allowed on trusted objects.
|
||||||
DixGetAttrAccess | DixListPropAccess | DixGetPropAccess |
|
*/
|
||||||
DixGetFocusAccess | DixListAccess | DixReceiveAccess;
|
static const Mask SecurityResourceMask =
|
||||||
|
DixGetAttrAccess | DixReceiveAccess | DixListPropAccess |
|
||||||
|
DixGetPropAccess | DixListAccess;
|
||||||
|
static const Mask SecurityRootWindowExtraMask =
|
||||||
|
DixReceiveAccess | DixSendAccess | DixAddAccess | DixRemoveAccess;
|
||||||
|
static const Mask SecurityDeviceMask =
|
||||||
|
DixGetAttrAccess | DixReceiveAccess | DixGetFocusAccess |
|
||||||
|
DixGrabAccess | DixSetAttrAccess | DixUseAccess;
|
||||||
|
static const Mask SecurityServerMask = DixGetAttrAccess | DixGrabAccess;
|
||||||
|
static const Mask SecurityClientMask = DixGetAttrAccess;
|
||||||
|
|
||||||
|
|
||||||
/* SecurityAudit
|
/* SecurityAudit
|
||||||
|
@ -748,11 +760,15 @@ SecurityDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
XaceDeviceAccessRec *rec = calldata;
|
XaceDeviceAccessRec *rec = calldata;
|
||||||
SecurityStateRec *subj, *obj;
|
SecurityStateRec *subj, *obj;
|
||||||
Mask requested = rec->access_mode;
|
Mask requested = rec->access_mode;
|
||||||
Mask allowed = SecurityAllowedMask;
|
Mask allowed = SecurityDeviceMask;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
||||||
obj = dixLookupPrivate(&serverClient->devPrivates, stateKey);
|
obj = dixLookupPrivate(&serverClient->devPrivates, stateKey);
|
||||||
|
|
||||||
|
if (rec->dev != inputInfo.keyboard)
|
||||||
|
/* this extension only supports the core keyboard */
|
||||||
|
allowed = requested;
|
||||||
|
|
||||||
if (SecurityDoCheck(subj, obj, requested, allowed) != Success) {
|
if (SecurityDoCheck(subj, obj, requested, allowed) != Success) {
|
||||||
SecurityAudit("Security denied client %d keyboard access on request "
|
SecurityAudit("Security denied client %d keyboard access on request "
|
||||||
"%s\n", rec->client->index,
|
"%s\n", rec->client->index,
|
||||||
|
@ -789,20 +805,29 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
SecurityStateRec *subj, *obj;
|
SecurityStateRec *subj, *obj;
|
||||||
int cid = CLIENT_ID(rec->id);
|
int cid = CLIENT_ID(rec->id);
|
||||||
Mask requested = rec->access_mode;
|
Mask requested = rec->access_mode;
|
||||||
Mask allowed = SecurityAllowedMask;
|
Mask allowed = SecurityResourceMask;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
||||||
obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey);
|
obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey);
|
||||||
|
|
||||||
|
/* disable background None for untrusted windows */
|
||||||
|
if ((requested & DixCreateAccess) && (rec->rtype == RT_WINDOW))
|
||||||
|
if (subj->haveState && subj->trustLevel != XSecurityClientTrusted)
|
||||||
|
((WindowPtr)rec->res)->forcedBG = TRUE;
|
||||||
|
|
||||||
/* special checks for server-owned resources */
|
/* special checks for server-owned resources */
|
||||||
if (cid == 0) {
|
if (cid == 0) {
|
||||||
if (rec->rtype & RC_DRAWABLE)
|
if (rec->rtype & RC_DRAWABLE)
|
||||||
/* additional operations allowed on root windows */
|
/* additional operations allowed on root windows */
|
||||||
allowed |= DixReadAccess|DixSendAccess;
|
allowed |= SecurityRootWindowExtraMask;
|
||||||
|
|
||||||
else if (rec->rtype == RT_COLORMAP)
|
else if (rec->rtype == RT_COLORMAP)
|
||||||
/* allow access to default colormaps */
|
/* allow access to default colormaps */
|
||||||
allowed = requested;
|
allowed = requested;
|
||||||
|
|
||||||
|
else
|
||||||
|
/* allow read access to other server-owned resources */
|
||||||
|
allowed |= DixReadAccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SecurityDoCheck(subj, obj, requested, allowed) == Success)
|
if (SecurityDoCheck(subj, obj, requested, allowed) == Success)
|
||||||
|
@ -813,9 +838,10 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SecurityAudit("Security: denied client %d access to resource 0x%x "
|
SecurityAudit("Security: denied client %d access %x to resource 0x%x "
|
||||||
"of client %d on request %s\n", rec->client->index, rec->id,
|
"of client %d on request %s\n", rec->client->index,
|
||||||
cid, SecurityLookupRequestName(rec->client));
|
requested, rec->id, cid,
|
||||||
|
SecurityLookupRequestName(rec->client));
|
||||||
rec->status = BadAccess; /* deny access */
|
rec->status = BadAccess; /* deny access */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,7 +873,7 @@ SecurityServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
XaceServerAccessRec *rec = calldata;
|
XaceServerAccessRec *rec = calldata;
|
||||||
SecurityStateRec *subj, *obj;
|
SecurityStateRec *subj, *obj;
|
||||||
Mask requested = rec->access_mode;
|
Mask requested = rec->access_mode;
|
||||||
Mask allowed = SecurityAllowedMask;
|
Mask allowed = SecurityServerMask;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
||||||
obj = dixLookupPrivate(&serverClient->devPrivates, stateKey);
|
obj = dixLookupPrivate(&serverClient->devPrivates, stateKey);
|
||||||
|
@ -866,7 +892,7 @@ SecurityClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
XaceClientAccessRec *rec = calldata;
|
XaceClientAccessRec *rec = calldata;
|
||||||
SecurityStateRec *subj, *obj;
|
SecurityStateRec *subj, *obj;
|
||||||
Mask requested = rec->access_mode;
|
Mask requested = rec->access_mode;
|
||||||
Mask allowed = SecurityAllowedMask;
|
Mask allowed = SecurityClientMask;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
||||||
obj = dixLookupPrivate(&rec->target->devPrivates, stateKey);
|
obj = dixLookupPrivate(&rec->target->devPrivates, stateKey);
|
||||||
|
@ -886,7 +912,7 @@ SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
SecurityStateRec *subj, *obj;
|
SecurityStateRec *subj, *obj;
|
||||||
ATOM name = rec->pProp->propertyName;
|
ATOM name = rec->pProp->propertyName;
|
||||||
Mask requested = rec->access_mode;
|
Mask requested = rec->access_mode;
|
||||||
Mask allowed = SecurityAllowedMask | DixReadAccess;
|
Mask allowed = SecurityResourceMask | DixReadAccess;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
||||||
obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey);
|
obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey);
|
||||||
|
@ -1079,6 +1105,8 @@ SecurityExtensionInit(INITARGS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RTEventClient |= RC_NEVERRETAIN;
|
RTEventClient |= RC_NEVERRETAIN;
|
||||||
|
RegisterResourceName(SecurityAuthorizationResType, "SecurityAuthorization");
|
||||||
|
RegisterResourceName(RTEventClient, "SecurityEventClient");
|
||||||
|
|
||||||
/* Allocate the private storage */
|
/* Allocate the private storage */
|
||||||
if (!dixRequestPrivate(stateKey, sizeof(SecurityStateRec)))
|
if (!dixRequestPrivate(stateKey, sizeof(SecurityStateRec)))
|
||||||
|
|
42
Xext/xace.c
42
Xext/xace.c
|
@ -23,6 +23,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
|
#include "extnsionst.h"
|
||||||
|
#include "pixmapstr.h"
|
||||||
|
#include "regionstr.h"
|
||||||
|
#include "gcstruct.h"
|
||||||
#include "xacestr.h"
|
#include "xacestr.h"
|
||||||
|
|
||||||
CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0};
|
CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0};
|
||||||
|
@ -51,6 +55,21 @@ int XaceHookDispatch(ClientPtr client, int major)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
|
||||||
|
PropertyPtr pProp, Mask access_mode)
|
||||||
|
{
|
||||||
|
XacePropertyAccessRec rec = { client, pWin, pProp, access_mode, Success };
|
||||||
|
CallCallbacks(&XaceHooks[XACE_PROPERTY_ACCESS], &rec);
|
||||||
|
return rec.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
int XaceHookSelectionAccess(ClientPtr client, Atom name, Mask access_mode)
|
||||||
|
{
|
||||||
|
XaceSelectionAccessRec rec = { client, name, access_mode, Success };
|
||||||
|
CallCallbacks(&XaceHooks[XACE_SELECTION_ACCESS], &rec);
|
||||||
|
return rec.status;
|
||||||
|
}
|
||||||
|
|
||||||
void XaceHookAuditEnd(ClientPtr ptr, int result)
|
void XaceHookAuditEnd(ClientPtr ptr, int result)
|
||||||
{
|
{
|
||||||
XaceAuditRec rec = { ptr, result };
|
XaceAuditRec rec = { ptr, result };
|
||||||
|
@ -100,18 +119,6 @@ int XaceHook(int hook, ...)
|
||||||
prv = &rec.status;
|
prv = &rec.status;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case XACE_PROPERTY_ACCESS: {
|
|
||||||
XacePropertyAccessRec rec = {
|
|
||||||
va_arg(ap, ClientPtr),
|
|
||||||
va_arg(ap, WindowPtr),
|
|
||||||
va_arg(ap, PropertyPtr),
|
|
||||||
va_arg(ap, Mask),
|
|
||||||
Success /* default allow */
|
|
||||||
};
|
|
||||||
calldata = &rec;
|
|
||||||
prv = &rec.status;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case XACE_SEND_ACCESS: {
|
case XACE_SEND_ACCESS: {
|
||||||
XaceSendAccessRec rec = {
|
XaceSendAccessRec rec = {
|
||||||
va_arg(ap, ClientPtr),
|
va_arg(ap, ClientPtr),
|
||||||
|
@ -169,17 +176,6 @@ int XaceHook(int hook, ...)
|
||||||
prv = &rec.status;
|
prv = &rec.status;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case XACE_SELECTION_ACCESS: {
|
|
||||||
XaceSelectionAccessRec rec = {
|
|
||||||
va_arg(ap, ClientPtr),
|
|
||||||
va_arg(ap, Atom),
|
|
||||||
va_arg(ap, Mask),
|
|
||||||
Success /* default allow */
|
|
||||||
};
|
|
||||||
calldata = &rec;
|
|
||||||
prv = &rec.status;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case XACE_SCREEN_ACCESS:
|
case XACE_SCREEN_ACCESS:
|
||||||
case XACE_SCREENSAVER_ACCESS: {
|
case XACE_SCREENSAVER_ACCESS: {
|
||||||
XaceScreenAccessRec rec = {
|
XaceScreenAccessRec rec = {
|
||||||
|
|
18
Xext/xace.h
18
Xext/xace.h
|
@ -25,11 +25,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#define XACE_MAJOR_VERSION 2
|
#define XACE_MAJOR_VERSION 2
|
||||||
#define XACE_MINOR_VERSION 0
|
#define XACE_MINOR_VERSION 0
|
||||||
|
|
||||||
#include "pixmap.h" /* for DrawablePtr */
|
#include "pixmap.h"
|
||||||
#include "regionstr.h" /* for RegionPtr */
|
#include "region.h"
|
||||||
|
#include "window.h"
|
||||||
|
#include "property.h"
|
||||||
|
|
||||||
/* Default window background */
|
/* Default window background */
|
||||||
#define XaceBackgroundNoneState None
|
#define XaceBackgroundNoneState(w) ((w)->forcedBG ? BackgroundPixel : None)
|
||||||
|
|
||||||
/* security hooks */
|
/* security hooks */
|
||||||
/* Constants used to identify the available security hooks
|
/* Constants used to identify the available security hooks
|
||||||
|
@ -65,6 +67,10 @@ extern int XaceHook(
|
||||||
/* Special-cased hook functions
|
/* Special-cased hook functions
|
||||||
*/
|
*/
|
||||||
extern int XaceHookDispatch(ClientPtr ptr, int major);
|
extern int XaceHookDispatch(ClientPtr ptr, int major);
|
||||||
|
extern int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
|
||||||
|
PropertyPtr pProp, Mask access_mode);
|
||||||
|
extern int XaceHookSelectionAccess(ClientPtr ptr, Atom name,
|
||||||
|
Mask access_mode);
|
||||||
extern void XaceHookAuditEnd(ClientPtr ptr, int result);
|
extern void XaceHookAuditEnd(ClientPtr ptr, int result);
|
||||||
|
|
||||||
/* Register a callback for a given hook.
|
/* Register a callback for a given hook.
|
||||||
|
@ -94,18 +100,22 @@ extern void XaceCensorImage(
|
||||||
#else /* XACE */
|
#else /* XACE */
|
||||||
|
|
||||||
/* Default window background */
|
/* Default window background */
|
||||||
#define XaceBackgroundNoneState None
|
#define XaceBackgroundNoneState(w) None
|
||||||
|
|
||||||
/* Define calls away when XACE is not being built. */
|
/* Define calls away when XACE is not being built. */
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define XaceHook(args...) Success
|
#define XaceHook(args...) Success
|
||||||
#define XaceHookDispatch(args...) Success
|
#define XaceHookDispatch(args...) Success
|
||||||
|
#define XaceHookPropertyAccess(args...) Success
|
||||||
|
#define XaceHookSelectionAccess(args...) Success
|
||||||
#define XaceHookAuditEnd(args...) { ; }
|
#define XaceHookAuditEnd(args...) { ; }
|
||||||
#define XaceCensorImage(args...) { ; }
|
#define XaceCensorImage(args...) { ; }
|
||||||
#else
|
#else
|
||||||
#define XaceHook(...) Success
|
#define XaceHook(...) Success
|
||||||
#define XaceHookDispatch(...) Success
|
#define XaceHookDispatch(...) Success
|
||||||
|
#define XaceHookPropertyAccess(...) Success
|
||||||
|
#define XaceHookSelectionAccess(...) Success
|
||||||
#define XaceHookAuditEnd(...) { ; }
|
#define XaceHookAuditEnd(...) { ; }
|
||||||
#define XaceCensorImage(...) { ; }
|
#define XaceCensorImage(...) { ; }
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,13 +20,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#ifndef _XACESTR_H
|
#ifndef _XACESTR_H
|
||||||
#define _XACESTR_H
|
#define _XACESTR_H
|
||||||
|
|
||||||
#include "dixstruct.h"
|
#include "dix.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "extnsionst.h"
|
#include "extnsionst.h"
|
||||||
#include "gcstruct.h"
|
#include "window.h"
|
||||||
#include "windowstr.h"
|
#include "input.h"
|
||||||
#include "inputstr.h"
|
#include "property.h"
|
||||||
#include "propertyst.h"
|
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "xace.h"
|
#include "xace.h"
|
||||||
|
|
||||||
|
|
|
@ -236,15 +236,15 @@ shmalloc(
|
||||||
size = (size + pagesize-1) & -pagesize;
|
size = (size + pagesize-1) & -pagesize;
|
||||||
shmid = shmget(IPC_PRIVATE, size, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
|
shmid = shmget(IPC_PRIVATE, size, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
|
||||||
if (shmid == -1) {
|
if (shmid == -1) {
|
||||||
ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, errno = %d\n",
|
ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, %s\n",
|
||||||
size, errno);
|
size, strerror(errno));
|
||||||
xfree(pDesc);
|
xfree(pDesc);
|
||||||
return (ShmDescPtr) NULL;
|
return (ShmDescPtr) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((addr = shmat(shmid, 0, 0)) == (char *)-1) {
|
if ((addr = shmat(shmid, 0, 0)) == (char *)-1) {
|
||||||
ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, errno = %d\n",
|
ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, %s\n",
|
||||||
size, errno);
|
size, strerror(errno));
|
||||||
shmctl(shmid, IPC_RMID, (void *) 0);
|
shmctl(shmid, IPC_RMID, (void *) 0);
|
||||||
xfree(pDesc);
|
xfree(pDesc);
|
||||||
return (ShmDescPtr) NULL;
|
return (ShmDescPtr) NULL;
|
||||||
|
|
360
Xext/xselinux.c
360
Xext/xselinux.c
|
@ -22,21 +22,28 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
#include <dix-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include <selinux/selinux.h>
|
#include <selinux/selinux.h>
|
||||||
#include <selinux/label.h>
|
#include <selinux/label.h>
|
||||||
#include <selinux/avc.h>
|
#include <selinux/avc.h>
|
||||||
|
|
||||||
#include <libaudit.h>
|
#include <libaudit.h>
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "privates.h"
|
#include "privates.h"
|
||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
#include "dixstruct.h"
|
#include "dixstruct.h"
|
||||||
|
#include "inputstr.h"
|
||||||
|
#include "windowstr.h"
|
||||||
|
#include "propertyst.h"
|
||||||
#include "extnsionst.h"
|
#include "extnsionst.h"
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
|
@ -46,8 +53,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#define TRANS_SERVER
|
#define TRANS_SERVER
|
||||||
#include <X11/Xtrans/Xtrans.h>
|
#include <X11/Xtrans/Xtrans.h>
|
||||||
#include "../os/osdep.h"
|
#include "../os/osdep.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include "modinit.h"
|
#include "modinit.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +61,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* private state record */
|
/* private state record */
|
||||||
static DevPrivateKey stateKey = &stateKey;
|
static DevPrivateKey subjectKey = &subjectKey;
|
||||||
|
static DevPrivateKey objectKey = &objectKey;
|
||||||
|
|
||||||
/* This is what we store for security state */
|
/* This is what we store for security state */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -64,7 +70,12 @@ typedef struct {
|
||||||
struct avc_entry_ref aeref;
|
struct avc_entry_ref aeref;
|
||||||
char *command;
|
char *command;
|
||||||
int privileged;
|
int privileged;
|
||||||
} SELinuxStateRec;
|
} SELinuxSubjectRec;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
security_id_t sid;
|
||||||
|
int poly;
|
||||||
|
} SELinuxObjectRec;
|
||||||
|
|
||||||
/* selection manager */
|
/* selection manager */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -81,6 +92,7 @@ static int audit_fd;
|
||||||
/* structure passed to auditing callback */
|
/* structure passed to auditing callback */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ClientPtr client; /* client */
|
ClientPtr client; /* client */
|
||||||
|
DeviceIntPtr dev; /* device */
|
||||||
char *command; /* client's executable path */
|
char *command; /* client's executable path */
|
||||||
unsigned id; /* resource id, if any */
|
unsigned id; /* resource id, if any */
|
||||||
int restype; /* resource type, if any */
|
int restype; /* resource type, if any */
|
||||||
|
@ -122,11 +134,11 @@ static struct security_class_mapping map[] = {
|
||||||
{ "x_gc", { "", "", "destroy", "create", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "use", NULL }},
|
{ "x_gc", { "", "", "destroy", "create", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "use", NULL }},
|
||||||
{ "x_font", { "", "", "destroy", "create", "getattr", "", "", "", "", "", "", "", "add_glyph", "remove_glyph", "", "", "", "", "", "", "", "", "", "", "use", NULL }},
|
{ "x_font", { "", "", "destroy", "create", "getattr", "", "", "", "", "", "", "", "add_glyph", "remove_glyph", "", "", "", "", "", "", "", "", "", "", "use", NULL }},
|
||||||
{ "x_colormap", { "read", "write", "destroy", "create", "getattr", "", "", "", "", "", "", "", "add_color", "remove_color", "", "", "", "", "", "", "install", "uninstall", "", "", "use", NULL }},
|
{ "x_colormap", { "read", "write", "destroy", "create", "getattr", "", "", "", "", "", "", "", "add_color", "remove_color", "", "", "", "", "", "", "install", "uninstall", "", "", "use", NULL }},
|
||||||
{ "x_property", { "read", "write", "destroy", "create", NULL }},
|
{ "x_property", { "read", "write", "destroy", "create", "getattr", "setattr", NULL }},
|
||||||
{ "x_selection", { "read", "", "", "", "getattr", "setattr", NULL }},
|
{ "x_selection", { "read", "", "", "", "getattr", "setattr", NULL }},
|
||||||
{ "x_cursor", { "read", "write", "destroy", "create", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "use", NULL }},
|
{ "x_cursor", { "read", "write", "destroy", "create", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "use", NULL }},
|
||||||
{ "x_client", { "", "", "destroy", "", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "manage", NULL }},
|
{ "x_client", { "", "", "destroy", "", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "manage", NULL }},
|
||||||
{ "x_device", { "read", "write", "", "", "getattr", "setattr", "", "", "", "getfocus", "setfocus", "", "", "", "", "", "", "grab", "freeze", "force_cursor", "", "", "", "", "", "manage", "", "bell", NULL }},
|
{ "x_device", { "read", "write", "", "", "getattr", "setattr", "", "", "", "getfocus", "setfocus", "", "", "", "", "", "", "grab", "freeze", "force_cursor", "", "", "", "", "use", "manage", "", "bell", NULL }},
|
||||||
{ "x_server", { "record", "", "", "", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "grab", "", "", "", "", "", "", "", "manage", "debug", NULL }},
|
{ "x_server", { "record", "", "", "", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "grab", "", "", "", "", "", "", "", "manage", "debug", NULL }},
|
||||||
{ "x_extension", { "", "", "", "", "query", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "use", NULL }},
|
{ "x_extension", { "", "", "", "", "query", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "use", NULL }},
|
||||||
{ "x_event", { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "send", "receive", NULL }},
|
{ "x_event", { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "send", "receive", NULL }},
|
||||||
|
@ -150,7 +162,7 @@ static pointer truep = (pointer)1;
|
||||||
* Looks up the SID corresponding to the given selection atom
|
* Looks up the SID corresponding to the given selection atom
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
SELinuxSelectionToSID(Atom selection, SELinuxStateRec *sid_return)
|
SELinuxSelectionToSID(Atom selection, SELinuxObjectRec *sid_return)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
unsigned i, size;
|
unsigned i, size;
|
||||||
|
@ -197,7 +209,7 @@ SELinuxSelectionToSID(Atom selection, SELinuxStateRec *sid_return)
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
|
SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
|
||||||
SELinuxStateRec *sid_return)
|
SELinuxObjectRec *sid_return)
|
||||||
{
|
{
|
||||||
const char *name = LookupEventName(type);
|
const char *name = LookupEventName(type);
|
||||||
security_context_t con;
|
security_context_t con;
|
||||||
|
@ -288,7 +300,7 @@ SELinuxTypeToClass(RESTYPE type)
|
||||||
* Performs an SELinux permission check.
|
* Performs an SELinux permission check.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
SELinuxDoCheck(SELinuxStateRec *subj, SELinuxStateRec *obj,
|
SELinuxDoCheck(SELinuxSubjectRec *subj, SELinuxObjectRec *obj,
|
||||||
security_class_t class, Mask mode, SELinuxAuditRec *auditdata)
|
security_class_t class, Mask mode, SELinuxAuditRec *auditdata)
|
||||||
{
|
{
|
||||||
/* serverClient requests OK */
|
/* serverClient requests OK */
|
||||||
|
@ -300,9 +312,11 @@ SELinuxDoCheck(SELinuxStateRec *subj, SELinuxStateRec *obj,
|
||||||
|
|
||||||
if (avc_has_perm(subj->sid, obj->sid, class, mode, &subj->aeref,
|
if (avc_has_perm(subj->sid, obj->sid, class, mode, &subj->aeref,
|
||||||
auditdata) < 0) {
|
auditdata) < 0) {
|
||||||
|
if (mode == DixUnknownAccess)
|
||||||
|
return Success; /* DixUnknownAccess requests OK ... for now */
|
||||||
if (errno == EACCES)
|
if (errno == EACCES)
|
||||||
return BadAccess;
|
return BadAccess;
|
||||||
ErrorF("ServerPerm: unexpected error %d\n", errno);
|
ErrorF("SELinux: avc_has_perm: unexpected error %d\n", errno);
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,11 +330,14 @@ static void
|
||||||
SELinuxLabelClient(ClientPtr client)
|
SELinuxLabelClient(ClientPtr client)
|
||||||
{
|
{
|
||||||
XtransConnInfo ci = ((OsCommPtr)client->osPrivate)->trans_conn;
|
XtransConnInfo ci = ((OsCommPtr)client->osPrivate)->trans_conn;
|
||||||
SELinuxStateRec *state;
|
SELinuxSubjectRec *subj;
|
||||||
|
SELinuxObjectRec *obj;
|
||||||
security_context_t ctx;
|
security_context_t ctx;
|
||||||
|
|
||||||
state = dixLookupPrivate(&client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&client->devPrivates, subjectKey);
|
||||||
sidput(state->sid);
|
sidput(subj->sid);
|
||||||
|
obj = dixLookupPrivate(&client->devPrivates, objectKey);
|
||||||
|
sidput(obj->sid);
|
||||||
|
|
||||||
if (_XSERVTransIsLocal(ci)) {
|
if (_XSERVTransIsLocal(ci)) {
|
||||||
int fd = _XSERVTransGetConnectionNumber(ci);
|
int fd = _XSERVTransGetConnectionNumber(ci);
|
||||||
|
@ -331,7 +348,7 @@ SELinuxLabelClient(ClientPtr client)
|
||||||
|
|
||||||
/* For local clients, can get context from the socket */
|
/* For local clients, can get context from the socket */
|
||||||
if (getpeercon(fd, &ctx) < 0)
|
if (getpeercon(fd, &ctx) < 0)
|
||||||
FatalError("Client %d: couldn't get context from socket\n",
|
FatalError("SELinux: client %d: couldn't get context from socket\n",
|
||||||
client->index);
|
client->index);
|
||||||
|
|
||||||
/* Try and determine the client's executable name */
|
/* Try and determine the client's executable name */
|
||||||
|
@ -349,24 +366,25 @@ SELinuxLabelClient(ClientPtr client)
|
||||||
if (bytes <= 0)
|
if (bytes <= 0)
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
state->command = xalloc(bytes);
|
subj->command = xalloc(bytes);
|
||||||
if (!state->command)
|
if (!subj->command)
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
memcpy(state->command, path, bytes);
|
memcpy(subj->command, path, bytes);
|
||||||
state->command[bytes - 1] = 0;
|
subj->command[bytes - 1] = 0;
|
||||||
} else
|
} else
|
||||||
/* For remote clients, need to use a default context */
|
/* For remote clients, need to use a default context */
|
||||||
if (selabel_lookup(label_hnd, &ctx, NULL, SELABEL_X_CLIENT) < 0)
|
if (selabel_lookup(label_hnd, &ctx, NULL, SELABEL_X_CLIENT) < 0)
|
||||||
FatalError("Client %d: couldn't get default remote context\n",
|
FatalError("SELinux: failed to look up remote-client context\n");
|
||||||
client->index);
|
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
/* Get a SID from the context */
|
/* Get a SID from the context */
|
||||||
if (avc_context_to_sid(ctx, &state->sid) < 0)
|
if (avc_context_to_sid(ctx, &subj->sid) < 0)
|
||||||
FatalError("Client %d: context_to_sid(%s) failed\n",
|
FatalError("SELinux: client %d: context_to_sid(%s) failed\n",
|
||||||
client->index, ctx);
|
client->index, ctx);
|
||||||
|
|
||||||
|
sidget(subj->sid);
|
||||||
|
obj->sid = subj->sid;
|
||||||
freecon(ctx);
|
freecon(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,23 +396,27 @@ SELinuxLabelInitial(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
XaceScreenAccessRec srec;
|
XaceScreenAccessRec srec;
|
||||||
SELinuxStateRec *state;
|
SELinuxSubjectRec *subj;
|
||||||
|
SELinuxObjectRec *obj;
|
||||||
security_context_t ctx;
|
security_context_t ctx;
|
||||||
pointer unused;
|
pointer unused;
|
||||||
|
|
||||||
/* Do the serverClient */
|
/* Do the serverClient */
|
||||||
state = dixLookupPrivate(&serverClient->devPrivates, stateKey);
|
subj = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
|
||||||
state->privileged = 1;
|
obj = dixLookupPrivate(&serverClient->devPrivates, objectKey);
|
||||||
sidput(state->sid);
|
subj->privileged = 1;
|
||||||
|
sidput(subj->sid);
|
||||||
|
|
||||||
/* Use the context of the X server process for the serverClient */
|
/* Use the context of the X server process for the serverClient */
|
||||||
if (getcon(&ctx) < 0)
|
if (getcon(&ctx) < 0)
|
||||||
FatalError("Couldn't get context of X server process\n");
|
FatalError("SELinux: couldn't get context of X server process\n");
|
||||||
|
|
||||||
/* Get a SID from the context */
|
/* Get a SID from the context */
|
||||||
if (avc_context_to_sid(ctx, &state->sid) < 0)
|
if (avc_context_to_sid(ctx, &subj->sid) < 0)
|
||||||
FatalError("serverClient: context_to_sid(%s) failed\n", ctx);
|
FatalError("SELinux: serverClient: context_to_sid(%s) failed\n", ctx);
|
||||||
|
|
||||||
|
sidget(subj->sid);
|
||||||
|
obj->sid = subj->sid;
|
||||||
freecon(ctx);
|
freecon(ctx);
|
||||||
|
|
||||||
srec.client = serverClient;
|
srec.client = serverClient;
|
||||||
|
@ -441,11 +463,15 @@ SELinuxAudit(void *auditdata,
|
||||||
propertyName = audit->property ? NameForAtom(audit->property) : NULL;
|
propertyName = audit->property ? NameForAtom(audit->property) : NULL;
|
||||||
selectionName = audit->selection ? NameForAtom(audit->selection) : NULL;
|
selectionName = audit->selection ? NameForAtom(audit->selection) : NULL;
|
||||||
|
|
||||||
return snprintf(msgbuf, msgbufsize, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
|
return snprintf(msgbuf, msgbufsize,
|
||||||
|
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
|
||||||
(major >= 0) ? "request=" : "",
|
(major >= 0) ? "request=" : "",
|
||||||
(major >= 0) ? LookupRequestName(major, minor) : "",
|
(major >= 0) ? LookupRequestName(major, minor) : "",
|
||||||
audit->command ? " comm=" : "",
|
audit->command ? " comm=" : "",
|
||||||
audit->command ? audit->command : "",
|
audit->command ? audit->command : "",
|
||||||
|
audit->dev ? " xdevice=\"" : "",
|
||||||
|
audit->dev ? audit->dev->name : "",
|
||||||
|
audit->dev ? "\"" : "",
|
||||||
audit->id ? " resid=" : "",
|
audit->id ? " resid=" : "",
|
||||||
audit->id ? idNum : "",
|
audit->id ? idNum : "",
|
||||||
audit->restype ? " restype=" : "",
|
audit->restype ? " restype=" : "",
|
||||||
|
@ -482,20 +508,27 @@ static void
|
||||||
SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
XaceDeviceAccessRec *rec = calldata;
|
XaceDeviceAccessRec *rec = calldata;
|
||||||
SELinuxStateRec *subj, *obj;
|
SELinuxSubjectRec *subj;
|
||||||
SELinuxAuditRec auditdata = { .client = rec->client };
|
SELinuxObjectRec *obj;
|
||||||
|
SELinuxAuditRec auditdata = { .client = rec->client, .dev = rec->dev };
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
|
||||||
obj = dixLookupPrivate(&rec->dev->devPrivates, stateKey);
|
obj = dixLookupPrivate(&rec->dev->devPrivates, objectKey);
|
||||||
|
|
||||||
/* If this is a new object that needs labeling, do it now */
|
/* If this is a new object that needs labeling, do it now */
|
||||||
if (rec->access_mode & DixCreateAccess) {
|
if (rec->access_mode & DixCreateAccess) {
|
||||||
|
SELinuxSubjectRec *dsubj;
|
||||||
|
dsubj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
|
||||||
|
|
||||||
|
sidput(dsubj->sid);
|
||||||
sidput(obj->sid);
|
sidput(obj->sid);
|
||||||
|
|
||||||
/* Label the device directly with the process SID */
|
/* Label the device directly with the process SID */
|
||||||
sidget(subj->sid);
|
sidget(subj->sid);
|
||||||
obj->sid = subj->sid;
|
obj->sid = subj->sid;
|
||||||
|
sidget(subj->sid);
|
||||||
|
dsubj->sid = subj->sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DEVICE, rec->access_mode,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DEVICE, rec->access_mode,
|
||||||
|
@ -508,17 +541,18 @@ static void
|
||||||
SELinuxSend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxSend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
XaceSendAccessRec *rec = calldata;
|
XaceSendAccessRec *rec = calldata;
|
||||||
SELinuxStateRec *subj, *obj, ev_sid;
|
SELinuxSubjectRec *subj;
|
||||||
SELinuxAuditRec auditdata = { .client = rec->client };
|
SELinuxObjectRec *obj, ev_sid;
|
||||||
|
SELinuxAuditRec auditdata = { .client = rec->client, .dev = rec->dev };
|
||||||
security_class_t class;
|
security_class_t class;
|
||||||
int rc, i, type;
|
int rc, i, type;
|
||||||
|
|
||||||
if (rec->dev)
|
if (rec->dev)
|
||||||
subj = dixLookupPrivate(&rec->dev->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
|
||||||
else
|
else
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
|
||||||
|
|
||||||
obj = dixLookupPrivate(&rec->pWin->devPrivates, stateKey);
|
obj = dixLookupPrivate(&rec->pWin->devPrivates, objectKey);
|
||||||
|
|
||||||
/* Check send permission on window */
|
/* Check send permission on window */
|
||||||
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DRAWABLE, DixSendAccess,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DRAWABLE, DixSendAccess,
|
||||||
|
@ -549,13 +583,14 @@ static void
|
||||||
SELinuxReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
XaceReceiveAccessRec *rec = calldata;
|
XaceReceiveAccessRec *rec = calldata;
|
||||||
SELinuxStateRec *subj, *obj, ev_sid;
|
SELinuxSubjectRec *subj;
|
||||||
|
SELinuxObjectRec *obj, ev_sid;
|
||||||
SELinuxAuditRec auditdata = { .client = NULL };
|
SELinuxAuditRec auditdata = { .client = NULL };
|
||||||
security_class_t class;
|
security_class_t class;
|
||||||
int rc, i, type;
|
int rc, i, type;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
|
||||||
obj = dixLookupPrivate(&rec->pWin->devPrivates, stateKey);
|
obj = dixLookupPrivate(&rec->pWin->devPrivates, objectKey);
|
||||||
|
|
||||||
/* Check receive permission on window */
|
/* Check receive permission on window */
|
||||||
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DRAWABLE, DixReceiveAccess,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DRAWABLE, DixReceiveAccess,
|
||||||
|
@ -586,12 +621,13 @@ static void
|
||||||
SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
XaceExtAccessRec *rec = calldata;
|
XaceExtAccessRec *rec = calldata;
|
||||||
SELinuxStateRec *subj, *obj, *serv;
|
SELinuxSubjectRec *subj, *serv;
|
||||||
|
SELinuxObjectRec *obj;
|
||||||
SELinuxAuditRec auditdata = { .client = rec->client };
|
SELinuxAuditRec auditdata = { .client = rec->client };
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
|
||||||
obj = dixLookupPrivate(&rec->ext->devPrivates, stateKey);
|
obj = dixLookupPrivate(&rec->ext->devPrivates, objectKey);
|
||||||
|
|
||||||
/* If this is a new object that needs labeling, do it now */
|
/* If this is a new object that needs labeling, do it now */
|
||||||
/* XXX there should be a separate callback for this */
|
/* XXX there should be a separate callback for this */
|
||||||
|
@ -600,9 +636,9 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
security_context_t con;
|
security_context_t con;
|
||||||
security_id_t sid;
|
security_id_t sid;
|
||||||
|
|
||||||
serv = dixLookupPrivate(&serverClient->devPrivates, stateKey);
|
serv = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
|
||||||
|
|
||||||
/* Look in the mappings of property names to contexts */
|
/* Look in the mappings of extension names to contexts */
|
||||||
if (selabel_lookup(label_hnd, &con, name, SELABEL_X_EXT) < 0) {
|
if (selabel_lookup(label_hnd, &con, name, SELABEL_X_EXT) < 0) {
|
||||||
ErrorF("SELinux: a property label lookup failed!\n");
|
ErrorF("SELinux: a property label lookup failed!\n");
|
||||||
rec->status = BadValue;
|
rec->status = BadValue;
|
||||||
|
@ -640,12 +676,13 @@ static void
|
||||||
SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
XacePropertyAccessRec *rec = calldata;
|
XacePropertyAccessRec *rec = calldata;
|
||||||
SELinuxStateRec *subj, *obj;
|
SELinuxSubjectRec *subj;
|
||||||
|
SELinuxObjectRec *obj;
|
||||||
SELinuxAuditRec auditdata = { .client = rec->client };
|
SELinuxAuditRec auditdata = { .client = rec->client };
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
|
||||||
obj = dixLookupPrivate(&rec->pProp->devPrivates, stateKey);
|
obj = dixLookupPrivate(&rec->pProp->devPrivates, objectKey);
|
||||||
|
|
||||||
/* If this is a new object that needs labeling, do it now */
|
/* If this is a new object that needs labeling, do it now */
|
||||||
if (rec->access_mode & DixCreateAccess) {
|
if (rec->access_mode & DixCreateAccess) {
|
||||||
|
@ -691,13 +728,15 @@ static void
|
||||||
SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
XaceResourceAccessRec *rec = calldata;
|
XaceResourceAccessRec *rec = calldata;
|
||||||
SELinuxStateRec *subj, *obj, *pobj;
|
SELinuxSubjectRec *subj;
|
||||||
|
SELinuxObjectRec *obj, *sobj, *pobj;
|
||||||
SELinuxAuditRec auditdata = { .client = rec->client };
|
SELinuxAuditRec auditdata = { .client = rec->client };
|
||||||
PrivateRec **privatePtr;
|
PrivateRec **privatePtr;
|
||||||
security_class_t class;
|
security_class_t class;
|
||||||
int rc, offset;
|
int rc, offset;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
|
||||||
|
sobj = dixLookupPrivate(&rec->client->devPrivates, objectKey);
|
||||||
|
|
||||||
/* Determine if the resource object has a devPrivates field */
|
/* Determine if the resource object has a devPrivates field */
|
||||||
offset = dixLookupPrivateOffset(rec->rtype);
|
offset = dixLookupPrivateOffset(rec->rtype);
|
||||||
|
@ -705,12 +744,12 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
/* No: use the SID of the owning client */
|
/* No: use the SID of the owning client */
|
||||||
class = SECCLASS_X_RESOURCE;
|
class = SECCLASS_X_RESOURCE;
|
||||||
privatePtr = &clients[CLIENT_ID(rec->id)]->devPrivates;
|
privatePtr = &clients[CLIENT_ID(rec->id)]->devPrivates;
|
||||||
obj = dixLookupPrivate(privatePtr, stateKey);
|
obj = dixLookupPrivate(privatePtr, objectKey);
|
||||||
} else {
|
} else {
|
||||||
/* Yes: use the SID from the resource object itself */
|
/* Yes: use the SID from the resource object itself */
|
||||||
class = SELinuxTypeToClass(rec->rtype);
|
class = SELinuxTypeToClass(rec->rtype);
|
||||||
privatePtr = DEVPRIV_AT(rec->res, offset);
|
privatePtr = DEVPRIV_AT(rec->res, offset);
|
||||||
obj = dixLookupPrivate(privatePtr, stateKey);
|
obj = dixLookupPrivate(privatePtr, objectKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this is a new object that needs labeling, do it now */
|
/* If this is a new object that needs labeling, do it now */
|
||||||
|
@ -719,10 +758,10 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
offset = dixLookupPrivateOffset(rec->ptype);
|
offset = dixLookupPrivateOffset(rec->ptype);
|
||||||
if (rec->parent && offset >= 0)
|
if (rec->parent && offset >= 0)
|
||||||
/* Use the SID of the parent object in the labeling operation */
|
/* Use the SID of the parent object in the labeling operation */
|
||||||
pobj = dixLookupPrivate(DEVPRIV_AT(rec->parent, offset), stateKey);
|
pobj = dixLookupPrivate(DEVPRIV_AT(rec->parent, offset), objectKey);
|
||||||
else
|
else
|
||||||
/* Use the SID of the subject */
|
/* Use the SID of the subject */
|
||||||
pobj = subj;
|
pobj = sobj;
|
||||||
|
|
||||||
sidput(obj->sid);
|
sidput(obj->sid);
|
||||||
|
|
||||||
|
@ -746,13 +785,14 @@ static void
|
||||||
SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata)
|
SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata)
|
||||||
{
|
{
|
||||||
XaceScreenAccessRec *rec = calldata;
|
XaceScreenAccessRec *rec = calldata;
|
||||||
SELinuxStateRec *subj, *obj;
|
SELinuxSubjectRec *subj;
|
||||||
|
SELinuxObjectRec *obj;
|
||||||
SELinuxAuditRec auditdata = { .client = rec->client };
|
SELinuxAuditRec auditdata = { .client = rec->client };
|
||||||
Mask access_mode = rec->access_mode;
|
Mask access_mode = rec->access_mode;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
|
||||||
obj = dixLookupPrivate(&rec->screen->devPrivates, stateKey);
|
obj = dixLookupPrivate(&rec->screen->devPrivates, objectKey);
|
||||||
|
|
||||||
/* If this is a new object that needs labeling, do it now */
|
/* If this is a new object that needs labeling, do it now */
|
||||||
if (access_mode & DixCreateAccess) {
|
if (access_mode & DixCreateAccess) {
|
||||||
|
@ -779,12 +819,13 @@ static void
|
||||||
SELinuxClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
XaceClientAccessRec *rec = calldata;
|
XaceClientAccessRec *rec = calldata;
|
||||||
SELinuxStateRec *subj, *obj;
|
SELinuxSubjectRec *subj;
|
||||||
|
SELinuxObjectRec *obj;
|
||||||
SELinuxAuditRec auditdata = { .client = rec->client };
|
SELinuxAuditRec auditdata = { .client = rec->client };
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
|
||||||
obj = dixLookupPrivate(&rec->target->devPrivates, stateKey);
|
obj = dixLookupPrivate(&rec->target->devPrivates, objectKey);
|
||||||
|
|
||||||
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_CLIENT, rec->access_mode,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_CLIENT, rec->access_mode,
|
||||||
&auditdata);
|
&auditdata);
|
||||||
|
@ -796,12 +837,13 @@ static void
|
||||||
SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
XaceServerAccessRec *rec = calldata;
|
XaceServerAccessRec *rec = calldata;
|
||||||
SELinuxStateRec *subj, *obj;
|
SELinuxSubjectRec *subj;
|
||||||
|
SELinuxObjectRec *obj;
|
||||||
SELinuxAuditRec auditdata = { .client = rec->client };
|
SELinuxAuditRec auditdata = { .client = rec->client };
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
|
||||||
obj = dixLookupPrivate(&serverClient->devPrivates, stateKey);
|
obj = dixLookupPrivate(&serverClient->devPrivates, objectKey);
|
||||||
|
|
||||||
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SERVER, rec->access_mode,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SERVER, rec->access_mode,
|
||||||
&auditdata);
|
&auditdata);
|
||||||
|
@ -813,11 +855,12 @@ static void
|
||||||
SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
XaceSelectionAccessRec *rec = (XaceSelectionAccessRec *)calldata;
|
XaceSelectionAccessRec *rec = (XaceSelectionAccessRec *)calldata;
|
||||||
SELinuxStateRec *subj, sel_sid;
|
SELinuxSubjectRec *subj;
|
||||||
|
SELinuxObjectRec sel_sid;
|
||||||
SELinuxAuditRec auditdata = { .client = rec->client };
|
SELinuxAuditRec auditdata = { .client = rec->client };
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
|
||||||
|
|
||||||
rc = SELinuxSelectionToSID(rec->name, &sel_sid);
|
rc = SELinuxSelectionToSID(rec->name, &sel_sid);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
|
@ -864,18 +907,19 @@ static void
|
||||||
SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
ResourceStateInfoRec *rec = calldata;
|
ResourceStateInfoRec *rec = calldata;
|
||||||
SELinuxStateRec *state;
|
SELinuxSubjectRec *subj;
|
||||||
|
SELinuxObjectRec *obj;
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
|
|
||||||
if (rec->type != RT_WINDOW)
|
if (rec->type != RT_WINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pWin = (WindowPtr)rec->value;
|
pWin = (WindowPtr)rec->value;
|
||||||
state = dixLookupPrivate(&wClient(pWin)->devPrivates, stateKey);
|
subj = dixLookupPrivate(&wClient(pWin)->devPrivates, subjectKey);
|
||||||
|
|
||||||
if (state->sid) {
|
if (subj->sid) {
|
||||||
security_context_t ctx;
|
security_context_t ctx;
|
||||||
int rc = avc_sid_to_context(state->sid, &ctx);
|
int rc = avc_sid_to_context(subj->sid, &ctx);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
FatalError("SELinux: Failed to get security context!\n");
|
FatalError("SELinux: Failed to get security context!\n");
|
||||||
rc = dixChangeWindowProperty(serverClient,
|
rc = dixChangeWindowProperty(serverClient,
|
||||||
|
@ -887,11 +931,11 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
} else
|
} else
|
||||||
FatalError("SELinux: Unexpected unlabeled client found\n");
|
FatalError("SELinux: Unexpected unlabeled client found\n");
|
||||||
|
|
||||||
state = dixLookupPrivate(&pWin->devPrivates, stateKey);
|
obj = dixLookupPrivate(&pWin->devPrivates, objectKey);
|
||||||
|
|
||||||
if (state->sid) {
|
if (obj->sid) {
|
||||||
security_context_t ctx;
|
security_context_t ctx;
|
||||||
int rc = avc_sid_to_context(state->sid, &ctx);
|
int rc = avc_sid_to_context(obj->sid, &ctx);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
FatalError("SELinux: Failed to get security context!\n");
|
FatalError("SELinux: Failed to get security context!\n");
|
||||||
rc = dixChangeWindowProperty(serverClient,
|
rc = dixChangeWindowProperty(serverClient,
|
||||||
|
@ -908,41 +952,11 @@ static void
|
||||||
SELinuxSelectionState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxSelectionState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
SelectionInfoRec *rec = calldata;
|
SelectionInfoRec *rec = calldata;
|
||||||
SELinuxStateRec *subj, *obj;
|
|
||||||
|
|
||||||
switch (rec->kind) {
|
switch (rec->kind) {
|
||||||
case SelectionSetOwner:
|
case SelectionSetOwner:
|
||||||
/* save off the "real" owner of the selection */
|
|
||||||
rec->selection->alt_client = rec->selection->client;
|
|
||||||
rec->selection->alt_window = rec->selection->window;
|
|
||||||
|
|
||||||
/* figure out the new label for the content */
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
|
||||||
obj = dixLookupPrivate(&rec->selection->devPrivates, stateKey);
|
|
||||||
sidput(obj->sid);
|
|
||||||
|
|
||||||
if (avc_compute_create(subj->sid, subj->sid, SECCLASS_X_SELECTION,
|
|
||||||
&obj->sid) < 0) {
|
|
||||||
ErrorF("SELinux: a compute_create call failed!\n");
|
|
||||||
obj->sid = unlabeled_sid;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SelectionGetOwner:
|
case SelectionGetOwner:
|
||||||
/* restore the real owner */
|
|
||||||
rec->selection->window = rec->selection->alt_window;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SelectionConvertSelection:
|
case SelectionConvertSelection:
|
||||||
/* redirect the convert request if necessary */
|
|
||||||
if (securityManager && securityManager != rec->client) {
|
|
||||||
rec->selection->client = securityManager;
|
|
||||||
rec->selection->window = securityWindow;
|
|
||||||
} else {
|
|
||||||
rec->selection->client = rec->selection->alt_client;
|
|
||||||
rec->selection->window = rec->selection->alt_window;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -954,27 +968,47 @@ SELinuxSelectionState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SELinuxStateInit(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxSubjectInit(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
PrivateCallbackRec *rec = calldata;
|
PrivateCallbackRec *rec = calldata;
|
||||||
SELinuxStateRec *state = *rec->value;
|
SELinuxSubjectRec *subj = *rec->value;
|
||||||
|
|
||||||
sidget(unlabeled_sid);
|
sidget(unlabeled_sid);
|
||||||
state->sid = unlabeled_sid;
|
subj->sid = unlabeled_sid;
|
||||||
|
|
||||||
avc_entry_ref_init(&state->aeref);
|
avc_entry_ref_init(&subj->aeref);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SELinuxStateFree(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SELinuxSubjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
PrivateCallbackRec *rec = calldata;
|
PrivateCallbackRec *rec = calldata;
|
||||||
SELinuxStateRec *state = *rec->value;
|
SELinuxSubjectRec *subj = *rec->value;
|
||||||
|
|
||||||
xfree(state->command);
|
xfree(subj->command);
|
||||||
|
|
||||||
if (avc_active)
|
if (avc_active)
|
||||||
sidput(state->sid);
|
sidput(subj->sid);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
SELinuxObjectInit(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
|
{
|
||||||
|
PrivateCallbackRec *rec = calldata;
|
||||||
|
SELinuxObjectRec *obj = *rec->value;
|
||||||
|
|
||||||
|
sidget(unlabeled_sid);
|
||||||
|
obj->sid = unlabeled_sid;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
SELinuxObjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
|
{
|
||||||
|
PrivateCallbackRec *rec = calldata;
|
||||||
|
SELinuxObjectRec *obj = *rec->value;
|
||||||
|
|
||||||
|
if (avc_active)
|
||||||
|
sidput(obj->sid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1065,7 +1099,8 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
|
||||||
char *ctx;
|
char *ctx;
|
||||||
security_id_t sid;
|
security_id_t sid;
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
SELinuxStateRec *state;
|
SELinuxSubjectRec *subj;
|
||||||
|
SELinuxObjectRec *obj;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(SELinuxSetContextReq);
|
REQUEST(SELinuxSetContextReq);
|
||||||
|
@ -1083,9 +1118,13 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
state = dixLookupPrivate(&dev->devPrivates, stateKey);
|
subj = dixLookupPrivate(&dev->devPrivates, subjectKey);
|
||||||
sidput(state->sid);
|
sidput(subj->sid);
|
||||||
state->sid = sid;
|
subj->sid = sid;
|
||||||
|
obj = dixLookupPrivate(&dev->devPrivates, objectKey);
|
||||||
|
sidput(obj->sid);
|
||||||
|
obj->sid = sid;
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1094,7 +1133,7 @@ ProcSELinuxGetDeviceContext(ClientPtr client)
|
||||||
{
|
{
|
||||||
char *ctx;
|
char *ctx;
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
SELinuxStateRec *state;
|
SELinuxSubjectRec *subj;
|
||||||
SELinuxGetContextReply rep;
|
SELinuxGetContextReply rep;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -1105,8 +1144,8 @@ ProcSELinuxGetDeviceContext(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
state = dixLookupPrivate(&dev->devPrivates, stateKey);
|
subj = dixLookupPrivate(&dev->devPrivates, subjectKey);
|
||||||
rc = avc_sid_to_context(state->sid, &ctx);
|
rc = avc_sid_to_context(subj->sid, &ctx);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
|
@ -1146,7 +1185,7 @@ ProcSELinuxGetPropertyContext(ClientPtr client)
|
||||||
char *ctx;
|
char *ctx;
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
PropertyPtr pProp;
|
PropertyPtr pProp;
|
||||||
SELinuxStateRec *state;
|
SELinuxObjectRec *obj;
|
||||||
SELinuxGetContextReply rep;
|
SELinuxGetContextReply rep;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -1166,12 +1205,12 @@ ProcSELinuxGetPropertyContext(ClientPtr client)
|
||||||
if (!pProp)
|
if (!pProp)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
rc = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp, DixGetAttrAccess);
|
rc = XaceHookPropertyAccess(client, pWin, pProp, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
state = dixLookupPrivate(&pProp->devPrivates, stateKey);
|
obj = dixLookupPrivate(&pProp->devPrivates, objectKey);
|
||||||
rc = avc_sid_to_context(state->sid, &ctx);
|
rc = avc_sid_to_context(obj->sid, &ctx);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
|
@ -1210,7 +1249,7 @@ ProcSELinuxGetWindowContext(ClientPtr client)
|
||||||
{
|
{
|
||||||
char *ctx;
|
char *ctx;
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
SELinuxStateRec *state;
|
SELinuxObjectRec *obj;
|
||||||
SELinuxGetContextReply rep;
|
SELinuxGetContextReply rep;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -1221,8 +1260,8 @@ ProcSELinuxGetWindowContext(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
state = dixLookupPrivate(&pWin->devPrivates, stateKey);
|
obj = dixLookupPrivate(&pWin->devPrivates, objectKey);
|
||||||
rc = avc_sid_to_context(state->sid, &ctx);
|
rc = avc_sid_to_context(obj->sid, &ctx);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
|
@ -1244,6 +1283,24 @@ ProcSELinuxGetWindowContext(ClientPtr client)
|
||||||
return client->noClientException;
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
ProcSELinuxSetSelectionCreateContext(ClientPtr client)
|
||||||
|
{
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
ProcSELinuxGetSelectionCreateContext(ClientPtr client)
|
||||||
|
{
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
ProcSELinuxGetSelectionContext(ClientPtr client)
|
||||||
|
{
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcSELinuxDispatch(ClientPtr client)
|
ProcSELinuxDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -1275,6 +1332,12 @@ ProcSELinuxDispatch(ClientPtr client)
|
||||||
return ProcSELinuxGetWindowCreateContext(client);
|
return ProcSELinuxGetWindowCreateContext(client);
|
||||||
case X_SELinuxGetWindowContext:
|
case X_SELinuxGetWindowContext:
|
||||||
return ProcSELinuxGetWindowContext(client);
|
return ProcSELinuxGetWindowContext(client);
|
||||||
|
case X_SELinuxSetSelectionCreateContext:
|
||||||
|
return ProcSELinuxSetSelectionCreateContext(client);
|
||||||
|
case X_SELinuxGetSelectionCreateContext:
|
||||||
|
return ProcSELinuxGetSelectionCreateContext(client);
|
||||||
|
case X_SELinuxGetSelectionContext:
|
||||||
|
return ProcSELinuxGetSelectionContext(client);
|
||||||
default:
|
default:
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
}
|
}
|
||||||
|
@ -1382,6 +1445,28 @@ SProcSELinuxGetWindowContext(ClientPtr client)
|
||||||
return ProcSELinuxGetWindowContext(client);
|
return ProcSELinuxGetWindowContext(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
SProcSELinuxSetSelectionCreateContext(ClientPtr client)
|
||||||
|
{
|
||||||
|
REQUEST(SELinuxSetCreateContextReq);
|
||||||
|
int n;
|
||||||
|
|
||||||
|
REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq);
|
||||||
|
swaps(&stuff->context_len, n);
|
||||||
|
return ProcSELinuxSetSelectionCreateContext(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
SProcSELinuxGetSelectionContext(ClientPtr client)
|
||||||
|
{
|
||||||
|
REQUEST(SELinuxGetContextReq);
|
||||||
|
int n;
|
||||||
|
|
||||||
|
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
|
||||||
|
swapl(&stuff->id, n);
|
||||||
|
return ProcSELinuxGetSelectionContext(client);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcSELinuxDispatch(ClientPtr client)
|
SProcSELinuxDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -1417,6 +1502,12 @@ SProcSELinuxDispatch(ClientPtr client)
|
||||||
return ProcSELinuxGetWindowCreateContext(client);
|
return ProcSELinuxGetWindowCreateContext(client);
|
||||||
case X_SELinuxGetWindowContext:
|
case X_SELinuxGetWindowContext:
|
||||||
return SProcSELinuxGetWindowContext(client);
|
return SProcSELinuxGetWindowContext(client);
|
||||||
|
case X_SELinuxSetSelectionCreateContext:
|
||||||
|
return SProcSELinuxSetSelectionCreateContext(client);
|
||||||
|
case X_SELinuxGetSelectionCreateContext:
|
||||||
|
return ProcSELinuxGetSelectionCreateContext(client);
|
||||||
|
case X_SELinuxGetSelectionContext:
|
||||||
|
return SProcSELinuxGetSelectionContext(client);
|
||||||
default:
|
default:
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
}
|
}
|
||||||
|
@ -1516,7 +1607,8 @@ SELinuxExtensionInit(INITARGS)
|
||||||
FatalError("SELinux: Failed to open the system audit log\n");
|
FatalError("SELinux: Failed to open the system audit log\n");
|
||||||
|
|
||||||
/* Allocate private storage */
|
/* Allocate private storage */
|
||||||
if (!dixRequestPrivate(stateKey, sizeof(SELinuxStateRec)))
|
if (!dixRequestPrivate(subjectKey, sizeof(SELinuxSubjectRec)) ||
|
||||||
|
!dixRequestPrivate(objectKey, sizeof(SELinuxObjectRec)))
|
||||||
FatalError("SELinux: Failed to allocate private storage.\n");
|
FatalError("SELinux: Failed to allocate private storage.\n");
|
||||||
|
|
||||||
/* Create atoms for doing window labeling */
|
/* Create atoms for doing window labeling */
|
||||||
|
@ -1528,8 +1620,10 @@ SELinuxExtensionInit(INITARGS)
|
||||||
FatalError("SELinux: Failed to create atom\n");
|
FatalError("SELinux: Failed to create atom\n");
|
||||||
|
|
||||||
/* Register callbacks */
|
/* Register callbacks */
|
||||||
ret &= dixRegisterPrivateInitFunc(stateKey, SELinuxStateInit, NULL);
|
ret &= dixRegisterPrivateInitFunc(subjectKey, SELinuxSubjectInit, NULL);
|
||||||
ret &= dixRegisterPrivateDeleteFunc(stateKey, SELinuxStateFree, NULL);
|
ret &= dixRegisterPrivateDeleteFunc(subjectKey, SELinuxSubjectFree, NULL);
|
||||||
|
ret &= dixRegisterPrivateInitFunc(objectKey, SELinuxObjectInit, NULL);
|
||||||
|
ret &= dixRegisterPrivateDeleteFunc(objectKey, SELinuxObjectFree, NULL);
|
||||||
|
|
||||||
ret &= AddCallback(&ClientStateCallback, SELinuxClientState, NULL);
|
ret &= AddCallback(&ClientStateCallback, SELinuxClientState, NULL);
|
||||||
ret &= AddCallback(&ResourceStateCallback, SELinuxResourceState, NULL);
|
ret &= AddCallback(&ResourceStateCallback, SELinuxResourceState, NULL);
|
||||||
|
|
|
@ -43,6 +43,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#define X_SELinuxSetWindowCreateContext 10
|
#define X_SELinuxSetWindowCreateContext 10
|
||||||
#define X_SELinuxGetWindowCreateContext 11
|
#define X_SELinuxGetWindowCreateContext 11
|
||||||
#define X_SELinuxGetWindowContext 12
|
#define X_SELinuxGetWindowContext 12
|
||||||
|
#define X_SELinuxSetSelectionCreateContext 13
|
||||||
|
#define X_SELinuxGetSelectionCreateContext 14
|
||||||
|
#define X_SELinuxGetSelectionContext 15
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CARD8 reqType;
|
CARD8 reqType;
|
||||||
|
|
37
Xi/chgdctl.c
37
Xi/chgdctl.c
|
@ -77,11 +77,46 @@ int
|
||||||
SProcXChangeDeviceControl(ClientPtr client)
|
SProcXChangeDeviceControl(ClientPtr client)
|
||||||
{
|
{
|
||||||
char n;
|
char n;
|
||||||
|
xDeviceCtl *ctl;
|
||||||
|
xDeviceAbsCalibCtl *calib;
|
||||||
|
xDeviceAbsAreaCtl *area;
|
||||||
|
|
||||||
REQUEST(xChangeDeviceControlReq);
|
REQUEST(xChangeDeviceControlReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
|
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
|
||||||
swaps(&stuff->control, n);
|
swaps(&stuff->control, n);
|
||||||
|
ctl = (xDeviceCtl*)&stuff[1];
|
||||||
|
swaps(&ctl->control, n);
|
||||||
|
swaps(&ctl->length, n);
|
||||||
|
switch(stuff->control) {
|
||||||
|
case DEVICE_ABS_CALIB:
|
||||||
|
calib = (xDeviceAbsCalibCtl*)ctl;
|
||||||
|
swaps(&calib->length, n);
|
||||||
|
swapl(&calib->min_x, n);
|
||||||
|
swapl(&calib->max_x, n);
|
||||||
|
swapl(&calib->min_y, n);
|
||||||
|
swapl(&calib->max_y, n);
|
||||||
|
swapl(&calib->flip_x, n);
|
||||||
|
swapl(&calib->flip_y, n);
|
||||||
|
swapl(&calib->rotation, n);
|
||||||
|
swapl(&calib->button_threshold, n);
|
||||||
|
break;
|
||||||
|
case DEVICE_ABS_AREA:
|
||||||
|
area = (xDeviceAbsAreaCtl*)ctl;
|
||||||
|
swapl(&area->offset_x, n);
|
||||||
|
swapl(&area->offset_y, n);
|
||||||
|
swapl(&area->width, n);
|
||||||
|
swapl(&area->height, n);
|
||||||
|
swapl(&area->screen, n);
|
||||||
|
swapl(&area->following, n);
|
||||||
|
break;
|
||||||
|
case DEVICE_CORE:
|
||||||
|
case DEVICE_ENABLE:
|
||||||
|
case DEVICE_RESOLUTION:
|
||||||
|
/* hmm. beer. *drool* */
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
return (ProcXChangeDeviceControl(client));
|
return (ProcXChangeDeviceControl(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +146,7 @@ ProcXChangeDeviceControl(ClientPtr client)
|
||||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
|
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
|
||||||
|
|
||||||
len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2);
|
len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2);
|
||||||
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
|
@ -444,7 +444,7 @@ ProcXChangeFeedbackControl(ClientPtr client)
|
||||||
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
|
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
|
||||||
|
|
||||||
len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2);
|
len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2);
|
||||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ ProcXChangeDeviceKeyMapping(ClientPtr client)
|
||||||
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
|
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
|
||||||
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
|
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
|
||||||
|
|
||||||
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2);
|
len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2);
|
||||||
|
|
|
@ -146,7 +146,7 @@ ProcXCloseDevice(ClientPtr client)
|
||||||
REQUEST(xCloseDeviceReq);
|
REQUEST(xCloseDeviceReq);
|
||||||
REQUEST_SIZE_MATCH(xCloseDeviceReq);
|
REQUEST_SIZE_MATCH(xCloseDeviceReq);
|
||||||
|
|
||||||
rc = dixLookupDevice(&d, stuff->deviceid, client, DixGetAttrAccess);
|
rc = dixLookupDevice(&d, stuff->deviceid, client, DixUseAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,8 @@ ProcXOpenDevice(ClientPtr client)
|
||||||
REQUEST(xOpenDeviceReq);
|
REQUEST(xOpenDeviceReq);
|
||||||
REQUEST_SIZE_MATCH(xOpenDeviceReq);
|
REQUEST_SIZE_MATCH(xOpenDeviceReq);
|
||||||
|
|
||||||
status = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess);
|
status = dixLookupDevice(&dev, stuff->deviceid, client, DixUseAccess);
|
||||||
|
|
||||||
if (status == BadDevice) { /* not open */
|
if (status == BadDevice) { /* not open */
|
||||||
for (dev = inputInfo.off_devices; dev; dev = dev->next)
|
for (dev = inputInfo.off_devices; dev; dev = dev->next)
|
||||||
if (dev->id == stuff->deviceid)
|
if (dev->id == stuff->deviceid)
|
||||||
|
|
|
@ -109,7 +109,7 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.status = MappingSuccess;
|
rep.status = MappingSuccess;
|
||||||
|
|
||||||
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
|
||||||
REQUEST(xSetDeviceModifierMappingReq);
|
REQUEST(xSetDeviceModifierMappingReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
|
REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
|
||||||
|
|
||||||
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,29 @@ compCheckRedirect (WindowPtr pWin)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
updateOverlayWindow(ScreenPtr pScreen)
|
||||||
|
{
|
||||||
|
CompScreenPtr cs;
|
||||||
|
WindowPtr pWin; /* overlay window */
|
||||||
|
XID vlist[2];
|
||||||
|
|
||||||
|
cs = GetCompScreen(pScreen);
|
||||||
|
if ((pWin = cs->pOverlayWin) != NULL) {
|
||||||
|
if ((pWin->drawable.width == pScreen->width) &&
|
||||||
|
(pWin->drawable.height == pScreen->height))
|
||||||
|
return Success;
|
||||||
|
|
||||||
|
/* Let's resize the overlay window. */
|
||||||
|
vlist[0] = pScreen->width;
|
||||||
|
vlist[1] = pScreen->height;
|
||||||
|
return ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Let's be on the safe side and not assume an overlay window is always allocated. */
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
compPositionWindow (WindowPtr pWin, int x, int y)
|
compPositionWindow (WindowPtr pWin, int x, int y)
|
||||||
{
|
{
|
||||||
|
@ -203,6 +226,8 @@ compPositionWindow (WindowPtr pWin, int x, int y)
|
||||||
cs->PositionWindow = pScreen->PositionWindow;
|
cs->PositionWindow = pScreen->PositionWindow;
|
||||||
pScreen->PositionWindow = compPositionWindow;
|
pScreen->PositionWindow = compPositionWindow;
|
||||||
compCheckTree (pWin->drawable.pScreen);
|
compCheckTree (pWin->drawable.pScreen);
|
||||||
|
if (updateOverlayWindow(pScreen) != Success)
|
||||||
|
ret = FALSE;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
configure.ac
16
configure.ac
|
@ -368,6 +368,7 @@ AM_CONDITIONAL(PPC_VIDEO, [test "x$PPC_VIDEO" = xyes])
|
||||||
AM_CONDITIONAL(SPARC64_VIDEO, [test "x$SPARC64_VIDEO" = xyes])
|
AM_CONDITIONAL(SPARC64_VIDEO, [test "x$SPARC64_VIDEO" = xyes])
|
||||||
|
|
||||||
DRI=no
|
DRI=no
|
||||||
|
DRI2=no
|
||||||
KDRIVE_HW=no
|
KDRIVE_HW=no
|
||||||
dnl it would be nice to autodetect these *CONS_SUPPORTs
|
dnl it would be nice to autodetect these *CONS_SUPPORTs
|
||||||
case $host_os in
|
case $host_os in
|
||||||
|
@ -380,6 +381,7 @@ case $host_os in
|
||||||
AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
|
AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
|
||||||
AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console])
|
AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console])
|
||||||
DRI=yes
|
DRI=yes
|
||||||
|
DRI2=yes
|
||||||
;;
|
;;
|
||||||
*netbsd*)
|
*netbsd*)
|
||||||
AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
|
AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
|
||||||
|
@ -387,6 +389,7 @@ case $host_os in
|
||||||
AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
|
AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
|
||||||
AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
|
AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
|
||||||
DRI=yes
|
DRI=yes
|
||||||
|
DRI2=yes
|
||||||
;;
|
;;
|
||||||
*openbsd*)
|
*openbsd*)
|
||||||
AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
|
AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
|
||||||
|
@ -395,6 +398,7 @@ case $host_os in
|
||||||
;;
|
;;
|
||||||
*linux*)
|
*linux*)
|
||||||
DRI=yes
|
DRI=yes
|
||||||
|
DRI2=yes
|
||||||
KDRIVE_HW=yes
|
KDRIVE_HW=yes
|
||||||
;;
|
;;
|
||||||
*solaris*)
|
*solaris*)
|
||||||
|
@ -526,7 +530,7 @@ AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Compo
|
||||||
AC_ARG_ENABLE(mitshm, AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
|
AC_ARG_ENABLE(mitshm, AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
|
||||||
AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
|
AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
|
||||||
AC_ARG_ENABLE(xtrap, AS_HELP_STRING([--disable-xtrap], [Build XTrap extension (default: enabled)]), [XTRAP=$enableval], [XTRAP=yes])
|
AC_ARG_ENABLE(xtrap, AS_HELP_STRING([--disable-xtrap], [Build XTrap extension (default: enabled)]), [XTRAP=$enableval], [XTRAP=yes])
|
||||||
AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
|
AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: disabled)]), [RECORD=$enableval], [RECORD=no])
|
||||||
AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
|
AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
|
||||||
AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
|
AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
|
||||||
AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
|
AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
|
||||||
|
@ -535,6 +539,7 @@ AC_ARG_ENABLE(xdmcp, AS_HELP_STRING([--disable-xdmcp], [Build XDMCP ext
|
||||||
AC_ARG_ENABLE(xdm-auth-1, AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
|
AC_ARG_ENABLE(xdm-auth-1, AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
|
||||||
AC_ARG_ENABLE(glx, AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes])
|
AC_ARG_ENABLE(glx, AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes])
|
||||||
AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
|
AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
|
||||||
|
AC_ARG_ENABLE(dri2, AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval])
|
||||||
AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
|
AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
|
||||||
AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
|
AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
|
||||||
AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: auto)]), [XF86MISC=$enableval], [XF86MISC=auto])
|
AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: auto)]), [XF86MISC=$enableval], [XF86MISC=auto])
|
||||||
|
@ -857,6 +862,14 @@ if test "x$DRI" = xyes; then
|
||||||
AC_SUBST(GL_CFLAGS)
|
AC_SUBST(GL_CFLAGS)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
|
||||||
|
if test "x$DRI2" = xyes; then
|
||||||
|
# FIXME: Bump the versions once we have releases of these.
|
||||||
|
AC_DEFINE(DRI2, 1, [Build DRI2 extension])
|
||||||
|
PKG_CHECK_MODULES([DRIPROTO], [xf86driproto >= 2.0.3])
|
||||||
|
PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.1])
|
||||||
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
|
AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
|
||||||
if test "x$XINERAMA" = xyes; then
|
if test "x$XINERAMA" = xyes; then
|
||||||
AC_DEFINE(XINERAMA, 1, [Support Xinerama extension])
|
AC_DEFINE(XINERAMA, 1, [Support Xinerama extension])
|
||||||
|
@ -2129,6 +2142,7 @@ hw/xfree86/doc/devel/Makefile
|
||||||
hw/xfree86/doc/man/Makefile
|
hw/xfree86/doc/man/Makefile
|
||||||
hw/xfree86/doc/sgml/Makefile
|
hw/xfree86/doc/sgml/Makefile
|
||||||
hw/xfree86/dri/Makefile
|
hw/xfree86/dri/Makefile
|
||||||
|
hw/xfree86/dri2/Makefile
|
||||||
hw/xfree86/dummylib/Makefile
|
hw/xfree86/dummylib/Makefile
|
||||||
hw/xfree86/exa/Makefile
|
hw/xfree86/exa/Makefile
|
||||||
hw/xfree86/fbdevhw/Makefile
|
hw/xfree86/fbdevhw/Makefile
|
||||||
|
|
|
@ -743,7 +743,6 @@ FreeDeviceClass(int type, pointer *class)
|
||||||
xfree((*p));
|
xfree((*p));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
*class = NULL;
|
*class = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1623,7 +1622,7 @@ DoSetModifierMapping(ClientPtr client, KeyCode *inputMap,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixSetAttrAccess);
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -1762,7 +1761,7 @@ ProcChangeKeyboardMapping(ClientPtr client)
|
||||||
|
|
||||||
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
|
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
|
||||||
if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
|
if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
|
||||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixSetAttrAccess);
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -1797,7 +1796,7 @@ DoSetPointerMapping(ClientPtr client, DeviceIntPtr device, BYTE *map, int n)
|
||||||
|
|
||||||
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
||||||
if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
|
if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
|
||||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixSetAttrAccess);
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -2142,7 +2141,7 @@ ProcChangeKeyboardControl (ClientPtr client)
|
||||||
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
|
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
|
||||||
if ((pDev->coreEvents || pDev == inputInfo.keyboard) &&
|
if ((pDev->coreEvents || pDev == inputInfo.keyboard) &&
|
||||||
pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
|
pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
|
||||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixSetAttrAccess);
|
ret = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -2298,7 +2297,7 @@ ProcChangePointerControl(ClientPtr client)
|
||||||
for (mouse = inputInfo.devices; mouse; mouse = mouse->next) {
|
for (mouse = inputInfo.devices; mouse; mouse = mouse->next) {
|
||||||
if ((mouse->coreEvents || mouse == inputInfo.pointer) &&
|
if ((mouse->coreEvents || mouse == inputInfo.pointer) &&
|
||||||
mouse->ptrfeed && mouse->ptrfeed->CtrlProc) {
|
mouse->ptrfeed && mouse->ptrfeed->CtrlProc) {
|
||||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixSetAttrAccess);
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixManageAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -417,17 +417,18 @@ Dispatch(void)
|
||||||
}
|
}
|
||||||
isItTimeToYield = FALSE;
|
isItTimeToYield = FALSE;
|
||||||
|
|
||||||
|
#ifdef XPRINT
|
||||||
requestingClient = client;
|
requestingClient = client;
|
||||||
|
#endif
|
||||||
#ifdef SMART_SCHEDULE
|
#ifdef SMART_SCHEDULE
|
||||||
start_tick = SmartScheduleTime;
|
start_tick = SmartScheduleTime;
|
||||||
#endif
|
#endif
|
||||||
while (!isItTimeToYield)
|
while (!isItTimeToYield)
|
||||||
{
|
{
|
||||||
if (*icheck[0] != *icheck[1])
|
if (*icheck[0] != *icheck[1])
|
||||||
{
|
|
||||||
ProcessInputEvents();
|
ProcessInputEvents();
|
||||||
FlushIfCriticalOutputPending();
|
|
||||||
}
|
FlushIfCriticalOutputPending();
|
||||||
#ifdef SMART_SCHEDULE
|
#ifdef SMART_SCHEDULE
|
||||||
if (!SmartScheduleDisable &&
|
if (!SmartScheduleDisable &&
|
||||||
(SmartScheduleTime - start_tick) >= SmartScheduleSlice)
|
(SmartScheduleTime - start_tick) >= SmartScheduleSlice)
|
||||||
|
@ -483,9 +484,6 @@ Dispatch(void)
|
||||||
client->errorValue, result);
|
client->errorValue, result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef DAMAGEEXT
|
|
||||||
FlushIfCriticalOutputPending ();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
FlushAllOutput();
|
FlushAllOutput();
|
||||||
#ifdef SMART_SCHEDULE
|
#ifdef SMART_SCHEDULE
|
||||||
|
@ -493,7 +491,9 @@ Dispatch(void)
|
||||||
if (client)
|
if (client)
|
||||||
client->smart_stop_tick = SmartScheduleTime;
|
client->smart_stop_tick = SmartScheduleTime;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef XPRINT
|
||||||
requestingClient = NULL;
|
requestingClient = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
dispatchException &= ~DE_PRIORITYCHANGE;
|
dispatchException &= ~DE_PRIORITYCHANGE;
|
||||||
}
|
}
|
||||||
|
@ -995,8 +995,8 @@ ProcSetSelectionOwner(ClientPtr client)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
rc = XaceHook(XACE_SELECTION_ACCESS, client, stuff->selection,
|
rc = XaceHookSelectionAccess(client, stuff->selection,
|
||||||
DixSetAttrAccess);
|
DixSetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -1082,8 +1082,7 @@ ProcGetSelectionOwner(ClientPtr client)
|
||||||
int rc, i;
|
int rc, i;
|
||||||
xGetSelectionOwnerReply reply;
|
xGetSelectionOwnerReply reply;
|
||||||
|
|
||||||
rc = XaceHook(XACE_SELECTION_ACCESS, client, stuff->id,
|
rc = XaceHookSelectionAccess(client, stuff->id, DixGetAttrAccess);
|
||||||
DixGetAttrAccess);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -1128,8 +1127,7 @@ ProcConvertSelection(ClientPtr client)
|
||||||
rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
rc = XaceHook(XACE_SELECTION_ACCESS, client, stuff->selection,
|
rc = XaceHookSelectionAccess(client, stuff->selection, DixReadAccess);
|
||||||
DixReadAccess);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -2538,7 +2536,7 @@ ProcFreeColormap(ClientPtr client)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
client->errorValue = stuff->id;
|
client->errorValue = stuff->id;
|
||||||
return rc;
|
return (rc == BadValue) ? BadColor : rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2567,7 +2565,7 @@ ProcCopyColormapAndFree(ClientPtr client)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
client->errorValue = stuff->srcCmap;
|
client->errorValue = stuff->srcCmap;
|
||||||
return rc;
|
return (rc == BadValue) ? BadColor : rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2659,7 +2657,7 @@ ProcListInstalledColormaps(ClientPtr client)
|
||||||
xfree(preply);
|
xfree(preply);
|
||||||
rc = client->noClientException;
|
rc = client->noClientException;
|
||||||
out:
|
out:
|
||||||
return (rc == BadValue) ? BadColor : rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -1644,9 +1644,6 @@ FreeFontPath(FontPathElementPtr *list, int n, Bool force)
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
if (list[i]->refcount != found) {
|
if (list[i]->refcount != found) {
|
||||||
ErrorF("[dix] FreeFontPath: FPE \"%.*s\" refcount is %d, should be %d; fixing.\n",
|
|
||||||
list[i]->name_length, list[i]->name,
|
|
||||||
list[i]->refcount, found);
|
|
||||||
list[i]->refcount = found; /* ensure it will get freed */
|
list[i]->refcount = found; /* ensure it will get freed */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1934,12 +1931,15 @@ GetDefaultPointSize ()
|
||||||
FontResolutionPtr
|
FontResolutionPtr
|
||||||
GetClientResolutions (int *num)
|
GetClientResolutions (int *num)
|
||||||
{
|
{
|
||||||
|
#ifdef XPRINT
|
||||||
if (requestingClient && requestingClient->fontResFunc != NULL &&
|
if (requestingClient && requestingClient->fontResFunc != NULL &&
|
||||||
!requestingClient->clientGone)
|
!requestingClient->clientGone)
|
||||||
{
|
{
|
||||||
return (*requestingClient->fontResFunc)(requestingClient, num);
|
return (*requestingClient->fontResFunc)(requestingClient, num);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
static struct _FontResolution res;
|
static struct _FontResolution res;
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
|
|
||||||
|
|
|
@ -816,16 +816,8 @@ _DeleteCallbackList(
|
||||||
*pcbl = NULL;
|
*pcbl = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CallbackFuncsRec default_cbfuncs =
|
|
||||||
{
|
|
||||||
_AddCallback,
|
|
||||||
_DeleteCallback,
|
|
||||||
_CallCallbacks,
|
|
||||||
_DeleteCallbackList
|
|
||||||
};
|
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs)
|
CreateCallbackList(CallbackListPtr *pcbl)
|
||||||
{
|
{
|
||||||
CallbackListPtr cbl;
|
CallbackListPtr cbl;
|
||||||
int i;
|
int i;
|
||||||
|
@ -833,7 +825,6 @@ CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs)
|
||||||
if (!pcbl) return FALSE;
|
if (!pcbl) return FALSE;
|
||||||
cbl = (CallbackListPtr) xalloc(sizeof(CallbackListRec));
|
cbl = (CallbackListPtr) xalloc(sizeof(CallbackListRec));
|
||||||
if (!cbl) return FALSE;
|
if (!cbl) return FALSE;
|
||||||
cbl->funcs = cbfuncs ? *cbfuncs : default_cbfuncs;
|
|
||||||
cbl->inCallback = 0;
|
cbl->inCallback = 0;
|
||||||
cbl->deleted = FALSE;
|
cbl->deleted = FALSE;
|
||||||
cbl->numDeleted = 0;
|
cbl->numDeleted = 0;
|
||||||
|
@ -864,31 +855,31 @@ AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
||||||
if (!pcbl) return FALSE;
|
if (!pcbl) return FALSE;
|
||||||
if (!*pcbl)
|
if (!*pcbl)
|
||||||
{ /* list hasn't been created yet; go create it */
|
{ /* list hasn't been created yet; go create it */
|
||||||
if (!CreateCallbackList(pcbl, (CallbackFuncsPtr)NULL))
|
if (!CreateCallbackList(pcbl))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return ((*(*pcbl)->funcs.AddCallback) (pcbl, callback, data));
|
return _AddCallback(pcbl, callback, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT Bool
|
_X_EXPORT Bool
|
||||||
DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
||||||
{
|
{
|
||||||
if (!pcbl || !*pcbl) return FALSE;
|
if (!pcbl || !*pcbl) return FALSE;
|
||||||
return ((*(*pcbl)->funcs.DeleteCallback) (pcbl, callback, data));
|
return _DeleteCallback(pcbl, callback, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CallCallbacks(CallbackListPtr *pcbl, pointer call_data)
|
CallCallbacks(CallbackListPtr *pcbl, pointer call_data)
|
||||||
{
|
{
|
||||||
if (!pcbl || !*pcbl) return;
|
if (!pcbl || !*pcbl) return;
|
||||||
(*(*pcbl)->funcs.CallCallbacks) (pcbl, call_data);
|
_CallCallbacks(pcbl, call_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DeleteCallbackList(CallbackListPtr *pcbl)
|
DeleteCallbackList(CallbackListPtr *pcbl)
|
||||||
{
|
{
|
||||||
if (!pcbl || !*pcbl) return;
|
if (!pcbl || !*pcbl) return;
|
||||||
(*(*pcbl)->funcs.DeleteCallbackList) (pcbl);
|
_DeleteCallbackList(pcbl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -358,10 +358,13 @@ clipAxis(DeviceIntPtr pDev, int axisNum, int *val)
|
||||||
{
|
{
|
||||||
AxisInfoPtr axes = pDev->valuator->axes + axisNum;
|
AxisInfoPtr axes = pDev->valuator->axes + axisNum;
|
||||||
|
|
||||||
if (*val < axes->min_value)
|
/* No clipping if the value-range <= 0 */
|
||||||
*val = axes->min_value;
|
if(axes->min_value < axes->min_value) {
|
||||||
if (axes->max_value >= 0 && *val > axes->max_value)
|
if (*val < axes->min_value)
|
||||||
*val = axes->max_value;
|
*val = axes->min_value;
|
||||||
|
if (*val > axes->max_value)
|
||||||
|
*val = axes->max_value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -660,10 +663,6 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
|
||||||
CARD32 ms = 0;
|
CARD32 ms = 0;
|
||||||
deviceKeyButtonPointer *kbp = NULL;
|
deviceKeyButtonPointer *kbp = NULL;
|
||||||
DeviceIntPtr master;
|
DeviceIntPtr master;
|
||||||
|
|
||||||
/* Thanks to a broken lib, we _always_ have to chase DeviceMotionNotifies
|
|
||||||
* with DeviceValuators. */
|
|
||||||
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
|
|
||||||
int x = 0, y = 0;
|
int x = 0, y = 0;
|
||||||
/* The core pointer must not send Xi events. */
|
/* The core pointer must not send Xi events. */
|
||||||
Bool coreOnly = (pDev == inputInfo.pointer);
|
Bool coreOnly = (pDev == inputInfo.pointer);
|
||||||
|
@ -701,7 +700,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do we need to send a DeviceValuator event? */
|
/* Do we need to send a DeviceValuator event? */
|
||||||
if (!coreOnly && sendValuators) {
|
if (!coreOnly && num_valuators) {
|
||||||
if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
|
if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
|
||||||
num_valuators = MAX_VALUATOR_EVENTS * 6;
|
num_valuators = MAX_VALUATOR_EVENTS * 6;
|
||||||
num_events += ((num_valuators - 1) / 6) + 1;
|
num_events += ((num_valuators - 1) / 6) + 1;
|
||||||
|
@ -793,7 +792,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
|
||||||
kbp->root_y = y;
|
kbp->root_y = y;
|
||||||
|
|
||||||
events++;
|
events++;
|
||||||
if (sendValuators) {
|
if (num_valuators) {
|
||||||
kbp->deviceid |= MORE_EVENTS;
|
kbp->deviceid |= MORE_EVENTS;
|
||||||
clipValuators(pDev, first_valuator, num_valuators, valuators);
|
clipValuators(pDev, first_valuator, num_valuators, valuators);
|
||||||
events = getValuatorEvents(events, pDev, first_valuator,
|
events = getValuatorEvents(events, pDev, first_valuator,
|
||||||
|
|
|
@ -143,7 +143,9 @@ Bool loadableFonts = FALSE;
|
||||||
CursorPtr rootCursor;
|
CursorPtr rootCursor;
|
||||||
Bool blackRoot=FALSE;
|
Bool blackRoot=FALSE;
|
||||||
Bool whiteRoot=FALSE;
|
Bool whiteRoot=FALSE;
|
||||||
|
#ifdef XPRINT
|
||||||
ClientPtr requestingClient; /* XXX this should be obsolete now, remove? */
|
ClientPtr requestingClient; /* XXX this should be obsolete now, remove? */
|
||||||
|
#endif
|
||||||
|
|
||||||
_X_EXPORT TimeStamp currentTime;
|
_X_EXPORT TimeStamp currentTime;
|
||||||
_X_EXPORT TimeStamp lastDeviceEventTime;
|
_X_EXPORT TimeStamp lastDeviceEventTime;
|
||||||
|
|
|
@ -137,8 +137,6 @@ _X_EXPORT PaddingInfo PixmapWidthPaddingInfo[33];
|
||||||
|
|
||||||
int connBlockScreenStart;
|
int connBlockScreenStart;
|
||||||
|
|
||||||
static int restart = 0;
|
|
||||||
|
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
NotImplemented(xEvent *from, xEvent *to)
|
NotImplemented(xEvent *from, xEvent *to)
|
||||||
{
|
{
|
||||||
|
@ -264,13 +262,6 @@ main(int argc, char *argv[], char *envp[])
|
||||||
DarwinHandleGUI(argc, argv, envp);
|
DarwinHandleGUI(argc, argv, envp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Notice if we're restarted. Probably this is because we jumped through
|
|
||||||
* an uninitialized pointer */
|
|
||||||
if (restart)
|
|
||||||
FatalError("server restarted. Jumped through uninitialized pointer?\n");
|
|
||||||
else
|
|
||||||
restart = 1;
|
|
||||||
|
|
||||||
CheckUserParameters(argc, argv, envp);
|
CheckUserParameters(argc, argv, envp);
|
||||||
|
|
||||||
CheckUserAuthorization();
|
CheckUserAuthorization();
|
||||||
|
|
|
@ -156,8 +156,8 @@ ProcRotateProperties(ClientPtr client)
|
||||||
xfree(props);
|
xfree(props);
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
rc = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp,
|
rc = XaceHookPropertyAccess(client, pWin, pProp,
|
||||||
DixReadAccess|DixWriteAccess);
|
DixReadAccess|DixWriteAccess);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
xfree(props);
|
xfree(props);
|
||||||
client->errorValue = atoms[i];
|
client->errorValue = atoms[i];
|
||||||
|
@ -276,8 +276,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
||||||
memmove((char *)data, (char *)value, totalSize);
|
memmove((char *)data, (char *)value, totalSize);
|
||||||
pProp->size = len;
|
pProp->size = len;
|
||||||
pProp->devPrivates = NULL;
|
pProp->devPrivates = NULL;
|
||||||
rc = XaceHook(XACE_PROPERTY_ACCESS, pClient, pWin, pProp,
|
rc = XaceHookPropertyAccess(pClient, pWin, pProp,
|
||||||
DixCreateAccess|DixWriteAccess);
|
DixCreateAccess|DixWriteAccess);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
xfree(data);
|
xfree(data);
|
||||||
xfree(pProp);
|
xfree(pProp);
|
||||||
|
@ -289,8 +289,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = XaceHook(XACE_PROPERTY_ACCESS, pClient, pWin, pProp,
|
rc = XaceHookPropertyAccess(pClient, pWin, pProp, DixWriteAccess);
|
||||||
DixWriteAccess);
|
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
pClient->errorValue = property;
|
pClient->errorValue = property;
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -382,8 +381,7 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName)
|
||||||
}
|
}
|
||||||
if (pProp)
|
if (pProp)
|
||||||
{
|
{
|
||||||
rc = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp,
|
rc = XaceHookPropertyAccess(client, pWin, pProp, DixDestroyAccess);
|
||||||
DixDestroyAccess);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -502,7 +500,7 @@ ProcGetProperty(ClientPtr client)
|
||||||
if (stuff->delete)
|
if (stuff->delete)
|
||||||
access_mode |= DixDestroyAccess;
|
access_mode |= DixDestroyAccess;
|
||||||
|
|
||||||
rc = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp, access_mode);
|
rc = XaceHookPropertyAccess(client, pWin, pProp, access_mode);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
client->errorValue = stuff->property;
|
client->errorValue = stuff->property;
|
||||||
return rc;
|
return rc;
|
||||||
|
|
|
@ -535,7 +535,6 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
|
||||||
ResourcePtr *prev, *head;
|
ResourcePtr *prev, *head;
|
||||||
int *eltptr;
|
int *eltptr;
|
||||||
int elements;
|
int elements;
|
||||||
Bool gotOne = FALSE;
|
|
||||||
|
|
||||||
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
|
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
|
||||||
{
|
{
|
||||||
|
@ -563,15 +562,11 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
|
||||||
xfree(res);
|
xfree(res);
|
||||||
if (*eltptr != elements)
|
if (*eltptr != elements)
|
||||||
prev = head; /* prev may no longer be valid */
|
prev = head; /* prev may no longer be valid */
|
||||||
gotOne = TRUE;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
prev = &res->next;
|
prev = &res->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!gotOne)
|
|
||||||
ErrorF("[dix] Freeing resource id=%lX which isn't there.\n",
|
|
||||||
(unsigned long)id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
13
dix/window.c
13
dix/window.c
|
@ -305,9 +305,8 @@ SetWindowToDefaults(WindowPtr pWin)
|
||||||
pWin->deliverableEvents = 0;
|
pWin->deliverableEvents = 0;
|
||||||
pWin->dontPropagate = 0;
|
pWin->dontPropagate = 0;
|
||||||
pWin->forcedBS = FALSE;
|
pWin->forcedBS = FALSE;
|
||||||
#ifdef COMPOSITE
|
|
||||||
pWin->redirectDraw = RedirectDrawNone;
|
pWin->redirectDraw = RedirectDrawNone;
|
||||||
#endif
|
pWin->forcedBG = FALSE;
|
||||||
|
|
||||||
sem = xcalloc(1, sizeof(FocusSemaphoresRec));
|
sem = xcalloc(1, sizeof(FocusSemaphoresRec));
|
||||||
dixSetPrivate(&pWin->devPrivates, FocusPrivatesKey, sem);
|
dixSetPrivate(&pWin->devPrivates, FocusPrivatesKey, sem);
|
||||||
|
@ -734,8 +733,8 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
|
||||||
return NullWindow;
|
return NullWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
pWin->backgroundState = XaceBackgroundNoneState;
|
pWin->backgroundState = XaceBackgroundNoneState(pWin);
|
||||||
pWin->background.pixel = 0;
|
pWin->background.pixel = pScreen->whitePixel;
|
||||||
|
|
||||||
pWin->borderIsPixel = pParent->borderIsPixel;
|
pWin->borderIsPixel = pParent->borderIsPixel;
|
||||||
pWin->border = pParent->border;
|
pWin->border = pParent->border;
|
||||||
|
@ -1066,8 +1065,8 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
|
||||||
if (!pWin->parent)
|
if (!pWin->parent)
|
||||||
MakeRootTile(pWin);
|
MakeRootTile(pWin);
|
||||||
else {
|
else {
|
||||||
pWin->backgroundState = XaceBackgroundNoneState;
|
pWin->backgroundState = XaceBackgroundNoneState(pWin);
|
||||||
pWin->background.pixel = 0;
|
pWin->background.pixel = pScreen->whitePixel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pixID == ParentRelative)
|
else if (pixID == ParentRelative)
|
||||||
|
@ -2205,7 +2204,7 @@ WhereDoIGoInTheStack(
|
||||||
return pWin->nextSib;
|
return pWin->nextSib;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
ErrorF("[dix] Internal error in ConfigureWindow, smode == %d\n",smode );
|
/* should never happen; make something up. */
|
||||||
return pWin->nextSib;
|
return pWin->nextSib;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -587,7 +587,6 @@ exaComposite(CARD8 op,
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
Bool saveSrcRepeat = pSrc->repeat;
|
Bool saveSrcRepeat = pSrc->repeat;
|
||||||
Bool saveMaskRepeat = pMask ? pMask->repeat : 0;
|
Bool saveMaskRepeat = pMask ? pMask->repeat : 0;
|
||||||
PixmapPtr pSrcPixmap = NULL;
|
|
||||||
RegionRec region;
|
RegionRec region;
|
||||||
|
|
||||||
/* We currently don't support acceleration of gradients, or other pictures
|
/* We currently don't support acceleration of gradients, or other pictures
|
||||||
|
@ -624,7 +623,9 @@ exaComposite(CARD8 op,
|
||||||
if (ret == 1)
|
if (ret == 1)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
else if (pSrcPixmap && !pSrc->repeat && !pSrc->transform)
|
else if (pSrc->pDrawable != NULL &&
|
||||||
|
!pSrc->repeat &&
|
||||||
|
!pSrc->transform)
|
||||||
{
|
{
|
||||||
xDst += pDst->pDrawable->x;
|
xDst += pDst->pDrawable->x;
|
||||||
yDst += pDst->pDrawable->y;
|
yDst += pDst->pDrawable->y;
|
||||||
|
@ -644,7 +645,9 @@ exaComposite(CARD8 op,
|
||||||
REGION_UNINIT(pDst->pDrawable->pScreen, ®ion);
|
REGION_UNINIT(pDst->pDrawable->pScreen, ®ion);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
else if (pSrcPixmap && !pSrc->transform &&
|
else if (pSrc->pDrawable != NULL &&
|
||||||
|
pSrc->pDrawable->type == DRAWABLE_PIXMAP &&
|
||||||
|
!pSrc->transform &&
|
||||||
pSrc->repeatType == RepeatNormal)
|
pSrc->repeatType == RepeatNormal)
|
||||||
{
|
{
|
||||||
DDXPointRec srcOrg;
|
DDXPointRec srcOrg;
|
||||||
|
@ -671,10 +674,11 @@ exaComposite(CARD8 op,
|
||||||
width, height))
|
width, height))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
srcOrg.x = (xSrc - xDst) % pSrcPixmap->drawable.width;
|
srcOrg.x = (xSrc - xDst) % pSrc->pDrawable->width;
|
||||||
srcOrg.y = (ySrc - yDst) % pSrcPixmap->drawable.height;
|
srcOrg.y = (ySrc - yDst) % pSrc->pDrawable->height;
|
||||||
|
|
||||||
ret = exaFillRegionTiled(pDst->pDrawable, ®ion, pSrcPixmap,
|
ret = exaFillRegionTiled(pDst->pDrawable, ®ion,
|
||||||
|
(PixmapPtr)pSrc->pDrawable,
|
||||||
&srcOrg, FB_ALLONES, GXcopy);
|
&srcOrg, FB_ALLONES, GXcopy);
|
||||||
|
|
||||||
REGION_UNINIT(pDst->pDrawable->pScreen, ®ion);
|
REGION_UNINIT(pDst->pDrawable->pScreen, ®ion);
|
||||||
|
@ -692,8 +696,6 @@ exaComposite(CARD8 op,
|
||||||
pMask->repeat = 0;
|
pMask->repeat = 0;
|
||||||
|
|
||||||
if (pExaScr->info->PrepareComposite &&
|
if (pExaScr->info->PrepareComposite &&
|
||||||
(!pSrc->repeat || pSrc->repeatType == RepeatNormal) &&
|
|
||||||
(!pMask || !pMask->repeat || pMask->repeatType == RepeatNormal) &&
|
|
||||||
!pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
|
!pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
|
||||||
{
|
{
|
||||||
Bool isSrcSolid;
|
Bool isSrcSolid;
|
||||||
|
|
5
fb/fb.h
5
fb/fb.h
|
@ -2087,11 +2087,6 @@ fbFillRegionSolid (DrawablePtr pDrawable,
|
||||||
FbBits and,
|
FbBits and,
|
||||||
FbBits xor);
|
FbBits xor);
|
||||||
|
|
||||||
void
|
|
||||||
fbFillRegionTiled (DrawablePtr pDrawable,
|
|
||||||
RegionPtr pRegion,
|
|
||||||
PixmapPtr pTile);
|
|
||||||
|
|
||||||
pixman_image_t *image_from_pict (PicturePtr pict,
|
pixman_image_t *image_from_pict (PicturePtr pict,
|
||||||
Bool has_clip);
|
Bool has_clip);
|
||||||
void free_pixman_pict (PicturePtr, pixman_image_t *);
|
void free_pixman_pict (PicturePtr, pixman_image_t *);
|
||||||
|
|
|
@ -250,68 +250,3 @@ fbFillRegionSolid (DrawablePtr pDrawable,
|
||||||
|
|
||||||
fbFinishAccess (pDrawable);
|
fbFinishAccess (pDrawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
|
||||||
#include "panoramiX.h"
|
|
||||||
#include "panoramiXsrv.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
|
||||||
fbFillRegionTiled (DrawablePtr pDrawable,
|
|
||||||
RegionPtr pRegion,
|
|
||||||
PixmapPtr pTile)
|
|
||||||
{
|
|
||||||
FbBits *dst;
|
|
||||||
FbStride dstStride;
|
|
||||||
int dstBpp;
|
|
||||||
int dstXoff, dstYoff;
|
|
||||||
FbBits *tile;
|
|
||||||
FbStride tileStride;
|
|
||||||
int tileBpp;
|
|
||||||
int tileXoff, tileYoff; /* XXX assumed to be zero */
|
|
||||||
int tileWidth, tileHeight;
|
|
||||||
int n = REGION_NUM_RECTS(pRegion);
|
|
||||||
BoxPtr pbox = REGION_RECTS(pRegion);
|
|
||||||
int xRot = pDrawable->x;
|
|
||||||
int yRot = pDrawable->y;
|
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
|
||||||
if(!noPanoramiXExtension)
|
|
||||||
{
|
|
||||||
int index = pDrawable->pScreen->myNum;
|
|
||||||
if(&WindowTable[index]->drawable == pDrawable)
|
|
||||||
{
|
|
||||||
xRot -= panoramiXdataPtr[index].x;
|
|
||||||
yRot -= panoramiXdataPtr[index].y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
|
|
||||||
fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff);
|
|
||||||
tileWidth = pTile->drawable.width;
|
|
||||||
tileHeight = pTile->drawable.height;
|
|
||||||
xRot += dstXoff;
|
|
||||||
yRot += dstYoff;
|
|
||||||
|
|
||||||
while (n--)
|
|
||||||
{
|
|
||||||
fbTile (dst + (pbox->y1 + dstYoff) * dstStride,
|
|
||||||
dstStride,
|
|
||||||
(pbox->x1 + dstXoff) * dstBpp,
|
|
||||||
(pbox->x2 - pbox->x1) * dstBpp,
|
|
||||||
pbox->y2 - pbox->y1,
|
|
||||||
tile,
|
|
||||||
tileStride,
|
|
||||||
tileWidth * dstBpp,
|
|
||||||
tileHeight,
|
|
||||||
GXcopy,
|
|
||||||
FB_ALLONES,
|
|
||||||
dstBpp,
|
|
||||||
xRot * dstBpp,
|
|
||||||
yRot - (pbox->y1 + dstYoff));
|
|
||||||
pbox++;
|
|
||||||
}
|
|
||||||
|
|
||||||
fbFinishAccess (&pTile->drawable);
|
|
||||||
fbFinishAccess (pDrawable);
|
|
||||||
}
|
|
||||||
|
|
|
@ -79,7 +79,6 @@
|
||||||
#define fbExpandDirectColors wfbExpandDirectColors
|
#define fbExpandDirectColors wfbExpandDirectColors
|
||||||
#define fbFill wfbFill
|
#define fbFill wfbFill
|
||||||
#define fbFillRegionSolid wfbFillRegionSolid
|
#define fbFillRegionSolid wfbFillRegionSolid
|
||||||
#define fbFillRegionTiled wfbFillRegionTiled
|
|
||||||
#define fbFillSpans wfbFillSpans
|
#define fbFillSpans wfbFillSpans
|
||||||
#define fbFixCoordModePrevious wfbFixCoordModePrevious
|
#define fbFixCoordModePrevious wfbFixCoordModePrevious
|
||||||
#define fbGCFuncs wfbGCFuncs
|
#define fbGCFuncs wfbGCFuncs
|
||||||
|
|
|
@ -174,7 +174,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("rc = %d, errno = %d (%s)\n", rc, errno, strerror(errno));
|
printf("rc = %d, (%s)\n", rc, strerror(errno));
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#include <X11/extensions/XInput.h>
|
#include <X11/extensions/XInput.h>
|
||||||
#include <X11/extensions/XKB.h>
|
#include <X11/extensions/XKB.h>
|
||||||
#include <X11/extensions/XKBstr.h>
|
#include "xkbstr.h"
|
||||||
#include <X11/extensions/dmxext.h>
|
#include <X11/extensions/dmxext.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#include <X11/extensions/XKB.h>
|
#include <X11/extensions/XKB.h>
|
||||||
#include <X11/extensions/XKBstr.h>
|
#include "xkbstr.h"
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
|
|
@ -66,7 +66,6 @@
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
#include "panoramiXsrv.h"
|
#include "panoramiXsrv.h"
|
||||||
extern XID *PanoramiXVisualTable;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern __GLXFBConfig **__glXFBConfigs;
|
extern __GLXFBConfig **__glXFBConfigs;
|
||||||
|
@ -2824,14 +2823,8 @@ int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
else if (!noPanoramiXExtension) {
|
else if (!noPanoramiXExtension) {
|
||||||
/* convert the associated visualId to the panoramix one */
|
/* convert the associated visualId to the panoramix one */
|
||||||
for (v=0; v<255; v++) {
|
pFBConfig->associatedVisualId =
|
||||||
if ( PanoramiXVisualTable[ v * MAXSCREENS + screen ] ==
|
PanoramiXTranslateVisualID(screen, v);
|
||||||
associatedVisualId ) {
|
|
||||||
associatedVisualId = v;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pFBConfig->associatedVisualId = associatedVisualId;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,7 +385,7 @@ Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
|
||||||
context, hHWContext );
|
context, hHWContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context)
|
GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context)
|
||||||
{
|
{
|
||||||
Display * const dpy = (Display *) ndpy;
|
Display * const dpy = (Display *) ndpy;
|
||||||
XExtDisplayInfo *info = find_display (dpy);
|
XExtDisplayInfo *info = find_display (dpy);
|
||||||
|
@ -406,7 +406,7 @@ Bool XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid conte
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
GLboolean
|
||||||
XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
|
XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
|
||||||
__DRIid drawable, drm_drawable_t * hHWDrawable)
|
__DRIid drawable, drm_drawable_t * hHWDrawable)
|
||||||
{
|
{
|
||||||
|
@ -437,7 +437,7 @@ XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
|
GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
|
||||||
__DRIid drawable )
|
__DRIid drawable )
|
||||||
{
|
{
|
||||||
Display * const dpy = (Display *) ndpy;
|
Display * const dpy = (Display *) ndpy;
|
||||||
|
|
|
@ -841,6 +841,39 @@ miPointerScreenFuncRec ephyrPointerScreenFuncs =
|
||||||
ephyrWarpCursor
|
ephyrWarpCursor
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef XEPHYR_DRI
|
||||||
|
/**
|
||||||
|
* find if the remote window denoted by a_remote
|
||||||
|
* is paired with an internal Window within the Xephyr server.
|
||||||
|
* If the remove window is paired with an internal window, send an
|
||||||
|
* expose event to the client insterested in the internal window expose event.
|
||||||
|
*
|
||||||
|
* Pairing happens when a drawable inside Xephyr is associated with
|
||||||
|
* a GL surface in a DRI environment.
|
||||||
|
* Look at the function ProcXF86DRICreateDrawable in ephyrdriext.c to
|
||||||
|
* know a paired window is created.
|
||||||
|
*
|
||||||
|
* This is useful to make GL drawables (only windows for now) handle
|
||||||
|
* expose events and send those events to clients.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
ephyrExposePairedWindow (int a_remote)
|
||||||
|
{
|
||||||
|
EphyrWindowPair *pair = NULL;
|
||||||
|
RegionRec reg;
|
||||||
|
ScreenPtr screen;
|
||||||
|
|
||||||
|
if (!findWindowPairFromRemote (a_remote, &pair)) {
|
||||||
|
EPHYR_LOG ("did not find a pair for this window\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
screen = pair->local->drawable.pScreen;
|
||||||
|
REGION_NULL (screen, ®);
|
||||||
|
REGION_COPY (screen, ®, &pair->local->clipList);
|
||||||
|
screen->WindowExposures (pair->local, ®, NullRegion);
|
||||||
|
REGION_UNINIT (screen, ®);
|
||||||
|
}
|
||||||
|
#endif /*XEPHYR_DRI*/
|
||||||
|
|
||||||
void
|
void
|
||||||
ephyrPoll(void)
|
ephyrPoll(void)
|
||||||
|
@ -861,9 +894,13 @@ ephyrPoll(void)
|
||||||
if (ephyrCurScreen != ev.data.mouse_motion.screen)
|
if (ephyrCurScreen != ev.data.mouse_motion.screen)
|
||||||
{
|
{
|
||||||
EPHYR_LOG ("warping mouse cursor:%d\n", ephyrCurScreen) ;
|
EPHYR_LOG ("warping mouse cursor:%d\n", ephyrCurScreen) ;
|
||||||
ephyrWarpCursor(screenInfo.screens[ev.data.mouse_motion.screen],
|
if (ev.data.mouse_motion.screen >= 0)
|
||||||
ev.data.mouse_motion.x,
|
{
|
||||||
ev.data.mouse_motion.y );
|
ephyrWarpCursor
|
||||||
|
(screenInfo.screens[ev.data.mouse_motion.screen],
|
||||||
|
ev.data.mouse_motion.x,
|
||||||
|
ev.data.mouse_motion.y );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -913,6 +950,18 @@ ephyrPoll(void)
|
||||||
KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE);
|
KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef XEPHYR_DRI
|
||||||
|
case EPHYR_EV_EXPOSE:
|
||||||
|
/*
|
||||||
|
* We only receive expose events when the expose event have
|
||||||
|
* be generated for a drawable that is a host X window managed
|
||||||
|
* by Xephyr. Host X windows managed by Xephyr exists for instance
|
||||||
|
* when Xephyr is asked to create a GL drawable in a DRI environment.
|
||||||
|
*/
|
||||||
|
ephyrExposePairedWindow (ev.data.expose.window);
|
||||||
|
break;
|
||||||
|
#endif /*XEPHYR_DRI*/
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,10 +59,6 @@
|
||||||
#define _HAVE_XALLOC_DECLS
|
#define _HAVE_XALLOC_DECLS
|
||||||
#include "ephyrlog.h"
|
#include "ephyrlog.h"
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
WindowPtr local ;
|
|
||||||
int remote ;
|
|
||||||
} EphyrWindowPair;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int foo;
|
int foo;
|
||||||
|
@ -950,6 +946,26 @@ findWindowPairFromLocal (WindowPtr a_local,
|
||||||
return FALSE ;
|
return FALSE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
findWindowPairFromRemote (int a_remote,
|
||||||
|
EphyrWindowPair **a_pair)
|
||||||
|
{
|
||||||
|
int i=0 ;
|
||||||
|
|
||||||
|
EPHYR_RETURN_VAL_IF_FAIL (a_pair, FALSE) ;
|
||||||
|
|
||||||
|
for (i=0; i < NUM_WINDOW_PAIRS; i++) {
|
||||||
|
if (window_pairs[i].remote == a_remote) {
|
||||||
|
*a_pair = &window_pairs[i] ;
|
||||||
|
EPHYR_LOG ("found (%p, %d)\n",
|
||||||
|
(*a_pair)->local,
|
||||||
|
(*a_pair)->remote) ;
|
||||||
|
return TRUE ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE ;
|
||||||
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
createHostPeerWindow (const WindowPtr a_win,
|
createHostPeerWindow (const WindowPtr a_win,
|
||||||
int *a_peer_win)
|
int *a_peer_win)
|
||||||
|
|
|
@ -27,6 +27,16 @@
|
||||||
*/
|
*/
|
||||||
#ifndef __EPHYRDRIEXT_H__
|
#ifndef __EPHYRDRIEXT_H__
|
||||||
#define __EPHYRDRIEXT_H__
|
#define __EPHYRDRIEXT_H__
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
WindowPtr local ;
|
||||||
|
int remote ;
|
||||||
|
} EphyrWindowPair;
|
||||||
|
|
||||||
Bool ephyrDRIExtensionInit (ScreenPtr a_screen) ;
|
Bool ephyrDRIExtensionInit (ScreenPtr a_screen) ;
|
||||||
|
|
||||||
|
Bool findWindowPairFromRemote (int a_remote,
|
||||||
|
EphyrWindowPair **a_pair);
|
||||||
|
|
||||||
#endif /*__EPHYRDRIEXT_H__*/
|
#endif /*__EPHYRDRIEXT_H__*/
|
||||||
|
|
||||||
|
|
|
@ -362,7 +362,7 @@ ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc)
|
||||||
ClientPtr client = a_cl->client;
|
ClientPtr client = a_cl->client;
|
||||||
xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) a_pc;
|
xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) a_pc;
|
||||||
xGLXQueryServerStringReply reply;
|
xGLXQueryServerStringReply reply;
|
||||||
char *server_string=NULL ;
|
char *server_string=NULL, *buf=NULL;
|
||||||
int length=0 ;
|
int length=0 ;
|
||||||
|
|
||||||
EPHYR_LOG ("enter\n") ;
|
EPHYR_LOG ("enter\n") ;
|
||||||
|
@ -379,9 +379,15 @@ ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc)
|
||||||
reply.sequenceNumber = client->sequence ;
|
reply.sequenceNumber = client->sequence ;
|
||||||
reply.length = __GLX_PAD (length) >> 2 ;
|
reply.length = __GLX_PAD (length) >> 2 ;
|
||||||
reply.n = length ;
|
reply.n = length ;
|
||||||
|
buf = xcalloc (reply.length << 2, 1);
|
||||||
|
if (!buf) {
|
||||||
|
EPHYR_LOG_ERROR ("failed to allocate string\n;");
|
||||||
|
return BadAlloc;
|
||||||
|
}
|
||||||
|
memcpy (buf, server_string, length);
|
||||||
|
|
||||||
WriteToClient(client, sz_xGLXQueryServerStringReply, (char*)&reply);
|
WriteToClient(client, sz_xGLXQueryServerStringReply, (char*)&reply);
|
||||||
WriteToClient(client, (int)length, server_string);
|
WriteToClient(client, (int)(reply.length << 2), server_string);
|
||||||
|
|
||||||
res = Success ;
|
res = Success ;
|
||||||
|
|
||||||
|
@ -391,6 +397,10 @@ out:
|
||||||
xfree (server_string) ;
|
xfree (server_string) ;
|
||||||
server_string = NULL;
|
server_string = NULL;
|
||||||
}
|
}
|
||||||
|
if (buf) {
|
||||||
|
xfree (buf);
|
||||||
|
buf = NULL;
|
||||||
|
}
|
||||||
return res ;
|
return res ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,7 @@ ephyrHostGLXGetStringFromServer (int a_screen_number,
|
||||||
{
|
{
|
||||||
Bool is_ok=FALSE ;
|
Bool is_ok=FALSE ;
|
||||||
Display *dpy = hostx_get_display () ;
|
Display *dpy = hostx_get_display () ;
|
||||||
|
int default_screen = DefaultScreen (dpy);
|
||||||
xGLXGenericGetStringReq *req=NULL;
|
xGLXGenericGetStringReq *req=NULL;
|
||||||
xGLXSingleReply reply;
|
xGLXSingleReply reply;
|
||||||
int length=0, numbytes=0, major_opcode=0, get_string_op=0;
|
int length=0, numbytes=0, major_opcode=0, get_string_op=0;
|
||||||
|
@ -188,13 +189,17 @@ ephyrHostGLXGetStringFromServer (int a_screen_number,
|
||||||
GetReq (GLXGenericGetString, req);
|
GetReq (GLXGenericGetString, req);
|
||||||
req->reqType = major_opcode;
|
req->reqType = major_opcode;
|
||||||
req->glxCode = get_string_op;
|
req->glxCode = get_string_op;
|
||||||
req->for_whom = DefaultScreen (dpy);
|
req->for_whom = default_screen;
|
||||||
req->name = a_string_name;
|
req->name = a_string_name;
|
||||||
|
|
||||||
_XReply (dpy, (xReply *)&reply, 0, False);
|
_XReply (dpy, (xReply *)&reply, 0, False);
|
||||||
|
|
||||||
length = reply.length * 4;
|
length = reply.length * 4;
|
||||||
numbytes = reply.size;
|
if (!length) {
|
||||||
|
numbytes = 0;
|
||||||
|
} else {
|
||||||
|
numbytes = reply.size;
|
||||||
|
}
|
||||||
EPHYR_LOG ("going to get a string of size:%d\n", numbytes) ;
|
EPHYR_LOG ("going to get a string of size:%d\n", numbytes) ;
|
||||||
|
|
||||||
*a_string = (char *) Xmalloc (numbytes +1);
|
*a_string = (char *) Xmalloc (numbytes +1);
|
||||||
|
|
|
@ -839,16 +839,38 @@ hostx_load_keymap(void)
|
||||||
static struct EphyrHostScreen *
|
static struct EphyrHostScreen *
|
||||||
host_screen_from_window (Window w)
|
host_screen_from_window (Window w)
|
||||||
{
|
{
|
||||||
int index;
|
int index = 0;
|
||||||
|
struct EphyrHostScreen *result = NULL;
|
||||||
|
#if 0
|
||||||
|
unsigned int num_children = 0;
|
||||||
|
Window root = None, parent = None, *children = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (index = 0 ; index < HostX.n_screens ; index++)
|
for (index = 0 ; index < HostX.n_screens ; index++)
|
||||||
{
|
{
|
||||||
if (HostX.screens[index].win == w)
|
if (HostX.screens[index].win == w)
|
||||||
{
|
{
|
||||||
return &HostX.screens[index];
|
result = &HostX.screens[index];
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
#if 0
|
||||||
|
XQueryTree (hostx_get_display (), w, &root, &parent,
|
||||||
|
&children, &num_children);
|
||||||
|
if (parent == root || parent == None)
|
||||||
|
goto out;
|
||||||
|
result = host_screen_from_window (parent);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
out:
|
||||||
|
#if 0
|
||||||
|
if (children)
|
||||||
|
{
|
||||||
|
XFree (children);
|
||||||
|
children = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -870,9 +892,19 @@ hostx_get_event(EphyrHostXEvent *ev)
|
||||||
{
|
{
|
||||||
struct EphyrHostScreen *host_screen =
|
struct EphyrHostScreen *host_screen =
|
||||||
host_screen_from_window (xev.xexpose.window);
|
host_screen_from_window (xev.xexpose.window);
|
||||||
hostx_paint_rect (host_screen->info, 0, 0, 0, 0,
|
if (host_screen)
|
||||||
host_screen->win_width,
|
{
|
||||||
host_screen->win_height);
|
hostx_paint_rect (host_screen->info, 0, 0, 0, 0,
|
||||||
|
host_screen->win_width,
|
||||||
|
host_screen->win_height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EPHYR_LOG_ERROR ("failed to get host screen\n");
|
||||||
|
ev->type = EPHYR_EV_EXPOSE;
|
||||||
|
ev->data.expose.window = xev.xexpose.window;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1113,12 +1145,18 @@ hostx_create_window (int a_screen_number,
|
||||||
visual_info->screen),
|
visual_info->screen),
|
||||||
visual_info->visual,
|
visual_info->visual,
|
||||||
AllocNone) ;
|
AllocNone) ;
|
||||||
winmask = CWColormap;
|
attrs.event_mask = ButtonPressMask
|
||||||
|
|ButtonReleaseMask
|
||||||
|
|PointerMotionMask
|
||||||
|
|KeyPressMask
|
||||||
|
|KeyReleaseMask
|
||||||
|
|ExposureMask;
|
||||||
|
winmask = CWColormap|CWEventMask;
|
||||||
|
|
||||||
win = XCreateWindow (dpy, hostx_get_window (a_screen_number),
|
win = XCreateWindow (dpy, hostx_get_window (a_screen_number),
|
||||||
a_geometry->x, a_geometry->y,
|
a_geometry->x, a_geometry->y,
|
||||||
a_geometry->width, a_geometry->height, 0,
|
a_geometry->width, a_geometry->height, 0,
|
||||||
visual_info->depth, InputOutput,
|
visual_info->depth, CopyFromParent,
|
||||||
visual_info->visual, winmask, &attrs) ;
|
visual_info->visual, winmask, &attrs) ;
|
||||||
if (win == None) {
|
if (win == None) {
|
||||||
EPHYR_LOG_ERROR ("failed to create peer window\n") ;
|
EPHYR_LOG_ERROR ("failed to create peer window\n") ;
|
||||||
|
|
|
@ -47,7 +47,8 @@ typedef enum EphyrHostXEventType
|
||||||
EPHYR_EV_MOUSE_PRESS,
|
EPHYR_EV_MOUSE_PRESS,
|
||||||
EPHYR_EV_MOUSE_RELEASE,
|
EPHYR_EV_MOUSE_RELEASE,
|
||||||
EPHYR_EV_KEY_PRESS,
|
EPHYR_EV_KEY_PRESS,
|
||||||
EPHYR_EV_KEY_RELEASE
|
EPHYR_EV_KEY_RELEASE,
|
||||||
|
EPHYR_EV_EXPOSE
|
||||||
}
|
}
|
||||||
EphyrHostXEventType;
|
EphyrHostXEventType;
|
||||||
|
|
||||||
|
@ -87,6 +88,10 @@ struct EphyrHostXEvent
|
||||||
int scancode;
|
int scancode;
|
||||||
} key_down;
|
} key_down;
|
||||||
|
|
||||||
|
struct expose {
|
||||||
|
int window;
|
||||||
|
} expose;
|
||||||
|
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
int key_state;
|
int key_state;
|
||||||
|
|
|
@ -441,7 +441,7 @@ LinuxFini (void)
|
||||||
memset (&vts, '\0', sizeof (vts)); /* valgrind */
|
memset (&vts, '\0', sizeof (vts)); /* valgrind */
|
||||||
ioctl (fd, VT_GETSTATE, &vts);
|
ioctl (fd, VT_GETSTATE, &vts);
|
||||||
if (ioctl (fd, VT_DISALLOCATE, vtno) < 0)
|
if (ioctl (fd, VT_DISALLOCATE, vtno) < 0)
|
||||||
fprintf (stderr, "Can't deallocate console %d errno %d\n", vtno, errno);
|
fprintf (stderr, "Can't deallocate console %d %s\n", vtno, strerror(errno));
|
||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -996,18 +996,6 @@ kaaFillRegionSolid (DrawablePtr pDrawable,
|
||||||
kaaDrawableDirty (pDrawable);
|
kaaDrawableDirty (pDrawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
kaaFillRegionTiled (DrawablePtr pDrawable,
|
|
||||||
RegionPtr pRegion,
|
|
||||||
Pixmap pTile)
|
|
||||||
{
|
|
||||||
else
|
|
||||||
{
|
|
||||||
kaaWaitSync
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
kaaDrawInit (ScreenPtr pScreen,
|
kaaDrawInit (ScreenPtr pScreen,
|
||||||
KaaScreenInfoPtr pScreenInfo)
|
KaaScreenInfoPtr pScreenInfo)
|
||||||
|
|
|
@ -132,8 +132,8 @@ KdSetMappedMode (CARD32 addr, CARD32 size, int mode)
|
||||||
sentry.type = type;
|
sentry.type = type;
|
||||||
|
|
||||||
if (ioctl (mtrr, MTRRIOC_ADD_ENTRY, &sentry) < 0)
|
if (ioctl (mtrr, MTRRIOC_ADD_ENTRY, &sentry) < 0)
|
||||||
ErrorF ("MTRRIOC_ADD_ENTRY failed 0x%x 0x%x %d (errno %d)\n",
|
ErrorF ("MTRRIOC_ADD_ENTRY failed 0x%x 0x%x %d (%s)\n",
|
||||||
base, bound - base, type, errno);
|
base, bound - base, type, strerror(errno));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -171,8 +171,8 @@ KdResetMappedMode (CARD32 addr, CARD32 size, int mode)
|
||||||
sentry.type = type;
|
sentry.type = type;
|
||||||
|
|
||||||
if (ioctl (mtrr, MTRRIOC_DEL_ENTRY, &sentry) < 0)
|
if (ioctl (mtrr, MTRRIOC_DEL_ENTRY, &sentry) < 0)
|
||||||
ErrorF ("MTRRIOC_DEL_ENTRY failed 0x%x 0x%x %d (errno %d)\n",
|
ErrorF ("MTRRIOC_DEL_ENTRY failed 0x%x 0x%x %d (%s)\n",
|
||||||
base, bound - base, type, errno);
|
base, bound - base, type, strerror(errno));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -567,7 +567,7 @@ vm86_loop(Vm86InfoPtr vi)
|
||||||
if(errno == ENOSYS) {
|
if(errno == ENOSYS) {
|
||||||
ErrorF("No vm86 support. Are you running on AMD64?\n");
|
ErrorF("No vm86 support. Are you running on AMD64?\n");
|
||||||
} else {
|
} else {
|
||||||
ErrorF("vm86 failed (errno = %d).\n", errno);
|
ErrorF("vm86 failed (%s).\n", strerror(errno));
|
||||||
Vm86Debug(vi);
|
Vm86Debug(vi);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -179,8 +179,8 @@ ddxGiveUp()
|
||||||
if (-1 == unlink(vfbScreens[i].mmap_file))
|
if (-1 == unlink(vfbScreens[i].mmap_file))
|
||||||
{
|
{
|
||||||
perror("unlink");
|
perror("unlink");
|
||||||
ErrorF("unlink %s failed, errno %d",
|
ErrorF("unlink %s failed, %s",
|
||||||
vfbScreens[i].mmap_file, errno);
|
vfbScreens[i].mmap_file, strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -196,7 +196,7 @@ ddxGiveUp()
|
||||||
if (-1 == shmdt((char *)vfbScreens[i].pXWDHeader))
|
if (-1 == shmdt((char *)vfbScreens[i].pXWDHeader))
|
||||||
{
|
{
|
||||||
perror("shmdt");
|
perror("shmdt");
|
||||||
ErrorF("shmdt failed, errno %d", errno);
|
ErrorF("shmdt failed, %s", strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -582,7 +582,7 @@ vfbBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
perror("msync");
|
perror("msync");
|
||||||
ErrorF("msync failed, errno %d", errno);
|
ErrorF("msync failed, %s", strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -605,7 +605,7 @@ vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb)
|
||||||
if (-1 == (pvfb->mmap_fd = open(pvfb->mmap_file, O_CREAT|O_RDWR, 0666)))
|
if (-1 == (pvfb->mmap_fd = open(pvfb->mmap_file, O_CREAT|O_RDWR, 0666)))
|
||||||
{
|
{
|
||||||
perror("open");
|
perror("open");
|
||||||
ErrorF("open %s failed, errno %d", pvfb->mmap_file, errno);
|
ErrorF("open %s failed, %s", pvfb->mmap_file, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,7 +621,7 @@ vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb)
|
||||||
if (-1 == write(pvfb->mmap_fd, dummyBuffer, writeThisTime))
|
if (-1 == write(pvfb->mmap_fd, dummyBuffer, writeThisTime))
|
||||||
{
|
{
|
||||||
perror("write");
|
perror("write");
|
||||||
ErrorF("write %s failed, errno %d", pvfb->mmap_file, errno);
|
ErrorF("write %s failed, %s", pvfb->mmap_file, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb)
|
||||||
if (-1 == (long)pvfb->pXWDHeader)
|
if (-1 == (long)pvfb->pXWDHeader)
|
||||||
{
|
{
|
||||||
perror("mmap");
|
perror("mmap");
|
||||||
ErrorF("mmap %s failed, errno %d", pvfb->mmap_file, errno);
|
ErrorF("mmap %s failed, %s", pvfb->mmap_file, strerror(errno));
|
||||||
pvfb->pXWDHeader = NULL;
|
pvfb->pXWDHeader = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -659,7 +659,7 @@ vfbAllocateSharedMemoryFramebuffer(vfbScreenInfoPtr pvfb)
|
||||||
if (pvfb->shmid < 0)
|
if (pvfb->shmid < 0)
|
||||||
{
|
{
|
||||||
perror("shmget");
|
perror("shmget");
|
||||||
ErrorF("shmget %d bytes failed, errno %d", pvfb->sizeInBytes, errno);
|
ErrorF("shmget %d bytes failed, %s", pvfb->sizeInBytes, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,7 +669,7 @@ vfbAllocateSharedMemoryFramebuffer(vfbScreenInfoPtr pvfb)
|
||||||
if (-1 == (long)pvfb->pXWDHeader)
|
if (-1 == (long)pvfb->pXWDHeader)
|
||||||
{
|
{
|
||||||
perror("shmat");
|
perror("shmat");
|
||||||
ErrorF("shmat failed, errno %d", errno);
|
ErrorF("shmat failed, %s", strerror(errno));
|
||||||
pvfb->pXWDHeader = NULL;
|
pvfb->pXWDHeader = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,10 @@ if DRI
|
||||||
DRI_SUBDIR = dri
|
DRI_SUBDIR = dri
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if DRI2
|
||||||
|
DRI2_SUBDIR = dri2
|
||||||
|
endif
|
||||||
|
|
||||||
if XF86UTILS
|
if XF86UTILS
|
||||||
XF86UTILS_SUBDIR = utils
|
XF86UTILS_SUBDIR = utils
|
||||||
endif
|
endif
|
||||||
|
@ -21,11 +25,11 @@ DOC_SUBDIR = doc
|
||||||
SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
|
SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
|
||||||
ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) $(CFB_SUBDIR) \
|
ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) $(CFB_SUBDIR) \
|
||||||
xf8_16bpp loader dixmods exa modes \
|
xf8_16bpp loader dixmods exa modes \
|
||||||
$(DRI_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR)
|
$(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR)
|
||||||
|
|
||||||
DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
|
DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
|
||||||
parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
|
parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
|
||||||
xf8_16bpp xf8_32bpp loader dixmods dri exa modes \
|
xf8_16bpp xf8_32bpp loader dixmods dri dri2 exa modes \
|
||||||
utils doc
|
utils doc
|
||||||
|
|
||||||
bin_PROGRAMS = Xorg
|
bin_PROGRAMS = Xorg
|
||||||
|
|
|
@ -31,7 +31,7 @@ BUILT_SOURCES = xf86DefModeSet.c
|
||||||
AM_LDFLAGS = -r
|
AM_LDFLAGS = -r
|
||||||
libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
|
libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
|
||||||
xf86Cursor.c xf86cvt.c xf86DGA.c xf86DPMS.c \
|
xf86Cursor.c xf86cvt.c xf86DGA.c xf86DPMS.c \
|
||||||
xf86DoProbe.c xf86DoScanPci.c xf86Events.c \
|
xf86DoProbe.c xf86Events.c \
|
||||||
xf86Globals.c xf86AutoConfig.c \
|
xf86Globals.c xf86AutoConfig.c \
|
||||||
xf86MiscExt.c xf86Option.c \
|
xf86MiscExt.c xf86Option.c \
|
||||||
xf86VidMode.c xf86fbman.c xf86cmap.c \
|
xf86VidMode.c xf86fbman.c xf86cmap.c \
|
||||||
|
|
|
@ -337,8 +337,8 @@ int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
|
||||||
pointer value);
|
pointer value);
|
||||||
Bool xf86IsUnblank(int mode);
|
Bool xf86IsUnblank(int mode);
|
||||||
|
|
||||||
void xf86AddModuleInfo(ModuleInfoPtr info, pointer module);
|
_X_DEPRECATED void xf86AddModuleInfo(pointer info, pointer module);
|
||||||
void xf86DeleteModuleInfo(int idx);
|
_X_DEPRECATED void xf86DeleteModuleInfo(int idx);
|
||||||
void xf86getsecs(long *, long *);
|
void xf86getsecs(long *, long *);
|
||||||
|
|
||||||
/* xf86Debug.c */
|
/* xf86Debug.c */
|
||||||
|
|
|
@ -184,7 +184,7 @@ videoPtrToDriverName(struct pci_device *dev)
|
||||||
case 0x3d3d: return "glint";
|
case 0x3d3d: return "glint";
|
||||||
case 0x1023: return "trident";
|
case 0x1023: return "trident";
|
||||||
case 0x100c: return "tseng";
|
case 0x100c: return "tseng";
|
||||||
case 0x1106: return "via";
|
case 0x1106: return "openchrome";
|
||||||
case 0x15ad: return "vmware";
|
case 0x15ad: return "vmware";
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -733,7 +733,6 @@ typedef enum {
|
||||||
FLAG_DISABLEMODINDEV,
|
FLAG_DISABLEMODINDEV,
|
||||||
FLAG_MODINDEVALLOWNONLOCAL,
|
FLAG_MODINDEVALLOWNONLOCAL,
|
||||||
FLAG_ALLOWMOUSEOPENFAIL,
|
FLAG_ALLOWMOUSEOPENFAIL,
|
||||||
FLAG_VTINIT,
|
|
||||||
FLAG_VTSYSREQ,
|
FLAG_VTSYSREQ,
|
||||||
FLAG_XKBDISABLE,
|
FLAG_XKBDISABLE,
|
||||||
FLAG_PCIPROBE1,
|
FLAG_PCIPROBE1,
|
||||||
|
@ -785,8 +784,6 @@ static OptionInfoRec FlagOptions[] = {
|
||||||
{0}, FALSE },
|
{0}, FALSE },
|
||||||
{ FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN,
|
{ FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN,
|
||||||
{0}, FALSE },
|
{0}, FALSE },
|
||||||
{ FLAG_VTINIT, "VTInit", OPTV_STRING,
|
|
||||||
{0}, FALSE },
|
|
||||||
{ FLAG_VTSYSREQ, "VTSysReq", OPTV_BOOLEAN,
|
{ FLAG_VTSYSREQ, "VTSysReq", OPTV_BOOLEAN,
|
||||||
{0}, FALSE },
|
{0}, FALSE },
|
||||||
{ FLAG_XKBDISABLE, "XkbDisable", OPTV_BOOLEAN,
|
{ FLAG_XKBDISABLE, "XkbDisable", OPTV_BOOLEAN,
|
||||||
|
@ -977,8 +974,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
xf86Info.vtinit = xf86GetOptValString(FlagOptions, FLAG_VTINIT);
|
|
||||||
|
|
||||||
if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE1))
|
if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE1))
|
||||||
xf86Info.pciFlags = PCIProbe1;
|
xf86Info.pciFlags = PCIProbe1;
|
||||||
if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE2))
|
if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE2))
|
||||||
|
|
|
@ -1,147 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 1999-2002 by The XFree86 Project, Inc.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
||||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
||||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
* Except as contained in this notice, the name of the copyright holder(s)
|
|
||||||
* and author(s) shall not be used in advertising or otherwise to promote
|
|
||||||
* the sale, use or other dealings in this Software without prior written
|
|
||||||
* authorization from the copyright holder(s) and author(s).
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Finish setting up the server.
|
|
||||||
* Call the functions from the scanpci module.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include <pciaccess.h>
|
|
||||||
#include "os.h"
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86Priv.h"
|
|
||||||
#include "xf86Pci.h"
|
|
||||||
#include "Pci.h"
|
|
||||||
#include "xf86_OSproc.h"
|
|
||||||
|
|
||||||
static void ScanPciDisplayPCICardInfo(void);
|
|
||||||
|
|
||||||
void
|
|
||||||
ScanPciDisplayPCICardInfo(void)
|
|
||||||
{
|
|
||||||
struct pci_id_match match;
|
|
||||||
struct pci_device_iterator *iter;
|
|
||||||
const struct pci_device *dev;
|
|
||||||
|
|
||||||
xf86EnableIO();
|
|
||||||
|
|
||||||
if (! xf86scanpci()) {
|
|
||||||
xf86MsgVerb(X_NONE, 0, "No PCI info available\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
xf86MsgVerb(X_NONE, 0,
|
|
||||||
"Probing for PCI devices (Bus:Device:Function)\n\n");
|
|
||||||
|
|
||||||
iter = pci_id_match_iterator_create(NULL);
|
|
||||||
while ((dev = pci_device_next(iter)) != NULL) {
|
|
||||||
const char *svendorname = NULL, *subsysname = NULL;
|
|
||||||
const char *vendorname = NULL, *devicename = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
xf86MsgVerb(X_NONE, 0, "(%d:%d:%d) ",
|
|
||||||
PCI_MAKE_BUS(dev->domain, dev->bus), dev->dev, dev->func);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Lookup as much as we can about the device.
|
|
||||||
*/
|
|
||||||
match.vendor_id = dev->vendor_id;
|
|
||||||
match.device_id = dev->device_id;
|
|
||||||
match.subvendor_id = (dev->subvendor_id != 0)
|
|
||||||
? dev->subvendor_id : PCI_MATCH_ANY;
|
|
||||||
match.subdevice_id = (dev->subdevice_id != 0)
|
|
||||||
? dev->subdevice_id : PCI_MATCH_ANY;
|
|
||||||
match.device_class = 0;
|
|
||||||
match.device_class_mask = 0;
|
|
||||||
|
|
||||||
pci_get_strings(& match, & vendorname, & devicename,
|
|
||||||
& svendorname, & subsysname);
|
|
||||||
|
|
||||||
if ((dev->subvendor_id != 0) || (dev->subdevice_id != 0)) {
|
|
||||||
xf86MsgVerb(X_NONE, 0, "%s %s (0x%04x / 0x%04x) using ",
|
|
||||||
(svendorname == NULL) ? "unknown vendor" : svendorname,
|
|
||||||
(subsysname == NULL) ? "unknown card" : subsysname,
|
|
||||||
dev->subvendor_id, dev->subdevice_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
xf86MsgVerb(X_NONE, 0, "%s %s (0x%04x / 0x%04x)\n",
|
|
||||||
(vendorname == NULL) ? "unknown vendor" : vendorname,
|
|
||||||
(devicename == NULL) ? "unknown chip" : devicename,
|
|
||||||
dev->vendor_id, dev->device_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
pci_iterator_destroy(iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DoScanPci(int argc, char **argv, int i)
|
|
||||||
{
|
|
||||||
int j,skip,globalVerbose;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* first we need to finish setup of the OS so that we can call other
|
|
||||||
* functions in the server
|
|
||||||
*/
|
|
||||||
OsInit();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The old verbosity processing that was here isn't useful anymore, but
|
|
||||||
* for compatibility purposes, ignore verbosity changes after the -scanpci
|
|
||||||
* flag.
|
|
||||||
*/
|
|
||||||
globalVerbose = xf86Verbose;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* next we process the arguments that are remaining on the command line,
|
|
||||||
* so that things like the module path can be set there
|
|
||||||
*/
|
|
||||||
for ( j = i+1; j < argc; j++ ) {
|
|
||||||
if ((skip = ddxProcessArgument(argc, argv, j)))
|
|
||||||
j += (skip - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Was the verbosity level increased? If so, set it back.
|
|
||||||
*/
|
|
||||||
if (xf86Verbose > globalVerbose)
|
|
||||||
xf86SetVerbosity(globalVerbose);
|
|
||||||
|
|
||||||
ScanPciDisplayPCICardInfo();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* That's it; we really should clean things up, but a simple
|
|
||||||
* exit seems to be all we need.
|
|
||||||
*/
|
|
||||||
exit(0);
|
|
||||||
}
|
|
|
@ -97,7 +97,6 @@ InputInfoPtr xf86InputDevs = NULL;
|
||||||
xf86InfoRec xf86Info = {
|
xf86InfoRec xf86Info = {
|
||||||
-1, /* consoleFd */
|
-1, /* consoleFd */
|
||||||
-1, /* vtno */
|
-1, /* vtno */
|
||||||
NULL, /* vtinit */
|
|
||||||
FALSE, /* vtSysreq */
|
FALSE, /* vtSysreq */
|
||||||
SKWhenNeeded, /* ddxSpecialKeys */
|
SKWhenNeeded, /* ddxSpecialKeys */
|
||||||
NULL, /* pMouse */
|
NULL, /* pMouse */
|
||||||
|
@ -154,8 +153,6 @@ DriverPtr *xf86DriverList = NULL;
|
||||||
int xf86NumDrivers = 0;
|
int xf86NumDrivers = 0;
|
||||||
InputDriverPtr *xf86InputDriverList = NULL;
|
InputDriverPtr *xf86InputDriverList = NULL;
|
||||||
int xf86NumInputDrivers = 0;
|
int xf86NumInputDrivers = 0;
|
||||||
ModuleInfoPtr *xf86ModuleInfoList = NULL;
|
|
||||||
int xf86NumModuleInfos = 0;
|
|
||||||
int xf86NumScreens = 0;
|
int xf86NumScreens = 0;
|
||||||
|
|
||||||
const char *xf86VisualNames[] = {
|
const char *xf86VisualNames[] = {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
|
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -170,37 +169,17 @@ xf86LookupInput(const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ABI stubs of despair */
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
xf86AddModuleInfo(ModuleInfoPtr info, pointer module)
|
xf86AddModuleInfo(pointer info, pointer module)
|
||||||
{
|
{
|
||||||
/* Don't add null entries */
|
|
||||||
if (!module)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (xf86ModuleInfoList == NULL)
|
|
||||||
xf86NumModuleInfos = 0;
|
|
||||||
|
|
||||||
xf86NumModuleInfos++;
|
|
||||||
xf86ModuleInfoList = xnfrealloc(xf86ModuleInfoList,
|
|
||||||
xf86NumModuleInfos * sizeof(ModuleInfoPtr));
|
|
||||||
xf86ModuleInfoList[xf86NumModuleInfos - 1] = xnfalloc(sizeof(ModuleInfoRec));
|
|
||||||
*xf86ModuleInfoList[xf86NumModuleInfos - 1] = *info;
|
|
||||||
xf86ModuleInfoList[xf86NumModuleInfos - 1]->module = module;
|
|
||||||
xf86ModuleInfoList[xf86NumModuleInfos - 1]->refCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
xf86DeleteModuleInfo(int idx)
|
xf86DeleteModuleInfo(int idx)
|
||||||
{
|
{
|
||||||
if (xf86ModuleInfoList[idx]) {
|
|
||||||
if (xf86ModuleInfoList[idx]->module)
|
|
||||||
UnloadModule(xf86ModuleInfoList[idx]->module);
|
|
||||||
xfree(xf86ModuleInfoList[idx]);
|
|
||||||
xf86ModuleInfoList[idx] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Allocate a new ScrnInfoRec in xf86Screens */
|
/* Allocate a new ScrnInfoRec in xf86Screens */
|
||||||
|
|
||||||
_X_EXPORT ScrnInfoPtr
|
_X_EXPORT ScrnInfoPtr
|
||||||
|
@ -1374,7 +1353,7 @@ xf86ErrorF(const char *format, ...)
|
||||||
void
|
void
|
||||||
xf86LogInit()
|
xf86LogInit()
|
||||||
{
|
{
|
||||||
char *lf;
|
char *lf = NULL;
|
||||||
|
|
||||||
#define LOGSUFFIX ".log"
|
#define LOGSUFFIX ".log"
|
||||||
#define LOGOLDSUFFIX ".old"
|
#define LOGOLDSUFFIX ".old"
|
||||||
|
@ -1398,6 +1377,8 @@ xf86LogInit()
|
||||||
|
|
||||||
#undef LOGSUFFIX
|
#undef LOGSUFFIX
|
||||||
#undef LOGOLDSUFFIX
|
#undef LOGOLDSUFFIX
|
||||||
|
|
||||||
|
free(lf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -102,7 +102,6 @@ static void xf86PrintBanner(void);
|
||||||
static void xf86PrintMarkers(void);
|
static void xf86PrintMarkers(void);
|
||||||
static void xf86PrintDefaultModulePath(void);
|
static void xf86PrintDefaultModulePath(void);
|
||||||
static void xf86PrintDefaultLibraryPath(void);
|
static void xf86PrintDefaultLibraryPath(void);
|
||||||
static void xf86RunVtInit(void);
|
|
||||||
|
|
||||||
static Bool probe_devices_from_device_sections(DriverPtr drvp);
|
static Bool probe_devices_from_device_sections(DriverPtr drvp);
|
||||||
static Bool add_matching_devices_to_configure_list(DriverPtr drvp);
|
static Bool add_matching_devices_to_configure_list(DriverPtr drvp);
|
||||||
|
@ -199,13 +198,6 @@ xf86CreateRootWindow(WindowPtr pWin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* InitOutput --
|
|
||||||
* Initialize screenInfo for all actually accessible framebuffers.
|
|
||||||
* That includes vt-manager setup, querying all possible devices and
|
|
||||||
* collecting the pixmap formats.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PostConfigInit(void)
|
PostConfigInit(void)
|
||||||
{
|
{
|
||||||
|
@ -238,9 +230,6 @@ PostConfigInit(void)
|
||||||
xf86OSPMClose = xf86OSPMOpen();
|
xf86OSPMClose = xf86OSPMOpen();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Run an external VT Init program if specified in the config file */
|
|
||||||
xf86RunVtInit();
|
|
||||||
|
|
||||||
/* Do this after XF86Config is read (it's normally in OsInit()) */
|
/* Do this after XF86Config is read (it's normally in OsInit()) */
|
||||||
OsInitColors();
|
OsInitColors();
|
||||||
}
|
}
|
||||||
|
@ -471,7 +460,12 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
|
||||||
return foundScreen;
|
return foundScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* InitOutput --
|
||||||
|
* Initialize screenInfo for all actually accessible framebuffers.
|
||||||
|
* That includes vt-manager setup, querying all possible devices and
|
||||||
|
* collecting the pixmap formats.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -1135,12 +1129,6 @@ InitInput(argc, argv)
|
||||||
for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
|
for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
|
||||||
/* Replace obsolete keyboard driver with kbd */
|
/* Replace obsolete keyboard driver with kbd */
|
||||||
if (!xf86NameCmp((*pDev)->driver, "keyboard")) {
|
if (!xf86NameCmp((*pDev)->driver, "keyboard")) {
|
||||||
xf86MsgVerb(X_WARNING, 0,
|
|
||||||
"*** WARNING the legacy keyboard driver \"%s\" has been removed\n",
|
|
||||||
(*pDev)->driver);
|
|
||||||
xf86MsgVerb(X_WARNING, 0,
|
|
||||||
"*** Using the new \"kbd\" driver for \"%s\".\n",
|
|
||||||
(*pDev)->identifier);
|
|
||||||
strcpy((*pDev)->driver, "kbd");
|
strcpy((*pDev)->driver, "kbd");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1566,15 +1554,6 @@ ddxProcessArgument(int argc, char **argv, int i)
|
||||||
xf86sFlag = TRUE;
|
xf86sFlag = TRUE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!strcmp(argv[i], "-bpp"))
|
|
||||||
{
|
|
||||||
ErrorF("The -bpp option is no longer supported.\n"
|
|
||||||
"\tUse -depth to set the color depth, and use -fbbpp if you really\n"
|
|
||||||
"\tneed to force a non-default framebuffer (hardware) pixel format.\n");
|
|
||||||
if (++i >= argc)
|
|
||||||
return 1;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
if (!strcmp(argv[i], "-pixmap24"))
|
if (!strcmp(argv[i], "-pixmap24"))
|
||||||
{
|
{
|
||||||
xf86Pix24 = Pix24Use24;
|
xf86Pix24 = Pix24Use24;
|
||||||
|
@ -1687,10 +1666,6 @@ ddxProcessArgument(int argc, char **argv, int i)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!strcmp(argv[i], "-scanpci"))
|
|
||||||
{
|
|
||||||
DoScanPci(argc, argv, i);
|
|
||||||
}
|
|
||||||
if (!strcmp(argv[i], "-probe"))
|
if (!strcmp(argv[i], "-probe"))
|
||||||
{
|
{
|
||||||
xf86DoProbe = TRUE;
|
xf86DoProbe = TRUE;
|
||||||
|
@ -1753,7 +1728,6 @@ ddxUseMsg()
|
||||||
ErrorF("-config file specify a configuration file, relative to the\n");
|
ErrorF("-config file specify a configuration file, relative to the\n");
|
||||||
ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n");
|
ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n");
|
||||||
ErrorF("-probeonly probe for devices, then exit\n");
|
ErrorF("-probeonly probe for devices, then exit\n");
|
||||||
ErrorF("-scanpci execute the scanpci module and exit\n");
|
|
||||||
ErrorF("-verbose [n] verbose startup messages\n");
|
ErrorF("-verbose [n] verbose startup messages\n");
|
||||||
ErrorF("-logverbose [n] verbose log messages\n");
|
ErrorF("-logverbose [n] verbose log messages\n");
|
||||||
ErrorF("-quiet minimal startup messages\n");
|
ErrorF("-quiet minimal startup messages\n");
|
||||||
|
@ -1930,44 +1904,6 @@ xf86PrintDefaultLibraryPath(void)
|
||||||
ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
|
ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
xf86RunVtInit(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If VTInit was set, run that program with consoleFd as stdin and stdout
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (xf86Info.vtinit) {
|
|
||||||
switch(fork()) {
|
|
||||||
case -1:
|
|
||||||
FatalError("xf86RunVtInit: fork failed (%s)\n", strerror(errno));
|
|
||||||
break;
|
|
||||||
case 0: /* child */
|
|
||||||
if (setuid(getuid()) == -1) {
|
|
||||||
xf86Msg(X_ERROR, "xf86RunVtInit: setuid failed (%s)\n",
|
|
||||||
strerror(errno));
|
|
||||||
exit(255);
|
|
||||||
}
|
|
||||||
/* set stdin, stdout to the consoleFd */
|
|
||||||
for (i = 0; i < 2; i++) {
|
|
||||||
if (xf86Info.consoleFd != i) {
|
|
||||||
close(i);
|
|
||||||
dup(xf86Info.consoleFd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
execl("/bin/sh", "sh", "-c", xf86Info.vtinit, (void *)NULL);
|
|
||||||
xf86Msg(X_WARNING, "exec of /bin/sh failed for VTInit (%s)\n",
|
|
||||||
strerror(errno));
|
|
||||||
exit(255);
|
|
||||||
break;
|
|
||||||
default: /* parent */
|
|
||||||
wait(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xf86LoadModules iterates over a list that is being passed in.
|
* xf86LoadModules iterates over a list that is being passed in.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -40,9 +40,8 @@
|
||||||
* or for non-video devices unless they're needed by a driver or elsewhere.
|
* or for non-video devices unless they're needed by a driver or elsewhere.
|
||||||
* A comprehensive set of PCI vendor, device and subsystem data is
|
* A comprehensive set of PCI vendor, device and subsystem data is
|
||||||
* auto-generated from the ../etc/pci.ids file using the pciids2c.pl script,
|
* auto-generated from the ../etc/pci.ids file using the pciids2c.pl script,
|
||||||
* and is used in both the scanpci module and the scanpci utility. Don't
|
* and is used in scanpci utility. Don't modify the pci.ids file. If
|
||||||
* modify the pci.ids file. If new/corrected entries are required, add them
|
* new/corrected entries are required, add them to ../etc/extrapci.ids.
|
||||||
* to ../etc/extrapci.ids.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XF86_PCIINFO_H
|
#ifndef _XF86_PCIINFO_H
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997-2002 by The XFree86 Project, Inc.
|
* Copyright (c) 1997-2002 by The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -98,8 +97,6 @@ extern Bool xf86SupportedMouseTypes[];
|
||||||
extern int xf86NumMouseTypes;
|
extern int xf86NumMouseTypes;
|
||||||
|
|
||||||
extern DriverPtr *xf86DriverList;
|
extern DriverPtr *xf86DriverList;
|
||||||
extern ModuleInfoPtr *xf86ModuleInfoList;
|
|
||||||
extern int xf86NumModuleInfos;
|
|
||||||
extern int xf86NumDrivers;
|
extern int xf86NumDrivers;
|
||||||
extern Bool xf86Resetting;
|
extern Bool xf86Resetting;
|
||||||
extern Bool xf86Initialising;
|
extern Bool xf86Initialising;
|
||||||
|
@ -159,10 +156,6 @@ Bool xf86PathIsSafe(const char *path);
|
||||||
|
|
||||||
extern DisplayModeRec xf86DefaultModes [];
|
extern DisplayModeRec xf86DefaultModes [];
|
||||||
|
|
||||||
/* xf86DoScanPci.c */
|
|
||||||
|
|
||||||
void DoScanPci(int argc, char **argv, int i);
|
|
||||||
|
|
||||||
/* xf86DoProbe.c */
|
/* xf86DoProbe.c */
|
||||||
void DoProbe(void);
|
void DoProbe(void);
|
||||||
void DoConfigure(void);
|
void DoConfigure(void);
|
||||||
|
|
|
@ -75,7 +75,6 @@ typedef enum {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int consoleFd;
|
int consoleFd;
|
||||||
int vtno;
|
int vtno;
|
||||||
char * vtinit;
|
|
||||||
Bool vtSysreq;
|
Bool vtSysreq;
|
||||||
SpecialKeysInDDX ddxSpecialKeys;
|
SpecialKeysInDDX ddxSpecialKeys;
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,11 @@ xf86ProcessCommonOptions(LocalDevicePtr local,
|
||||||
|
|
||||||
/* Backwards compatibility. */
|
/* Backwards compatibility. */
|
||||||
local->history_size = GetMotionHistorySize();
|
local->history_size = GetMotionHistorySize();
|
||||||
|
/* Preallocate xEvent store */
|
||||||
|
if (!xf86Events)
|
||||||
|
xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
|
||||||
|
if (!xf86Events)
|
||||||
|
FatalError("Couldn't allocate event store\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -495,6 +500,8 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev)
|
||||||
* convenient functions to post events
|
* convenient functions to post events
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define MAX_VALUATORS 36 /* XXX from comment in dix/getevents.c */
|
||||||
|
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
xf86PostMotionEvent(DeviceIntPtr device,
|
xf86PostMotionEvent(DeviceIntPtr device,
|
||||||
int is_absolute,
|
int is_absolute,
|
||||||
|
@ -504,17 +511,12 @@ xf86PostMotionEvent(DeviceIntPtr device,
|
||||||
{
|
{
|
||||||
va_list var;
|
va_list var;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
static int *valuators = NULL;
|
static int valuators[MAX_VALUATORS];
|
||||||
static int n_valuators = 0;
|
|
||||||
|
|
||||||
if (num_valuators > n_valuators) {
|
if (num_valuators > MAX_VALUATORS) {
|
||||||
xfree (valuators);
|
xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d"
|
||||||
valuators = NULL;
|
" is greater than MAX_VALUATORS\n", num_valuators);
|
||||||
}
|
return;
|
||||||
|
|
||||||
if (!valuators) {
|
|
||||||
valuators = xcalloc(sizeof(int), num_valuators);
|
|
||||||
n_valuators = num_valuators;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
va_start(var, num_valuators);
|
va_start(var, num_valuators);
|
||||||
|
@ -539,6 +541,12 @@ xf86PostMotionEventP(DeviceIntPtr device,
|
||||||
int index;
|
int index;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
|
if (num_valuators > MAX_VALUATORS) {
|
||||||
|
xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d"
|
||||||
|
" is greater than MAX_VALUATORS\n", num_valuators);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_absolute)
|
if (is_absolute)
|
||||||
flags = POINTER_ABSOLUTE;
|
flags = POINTER_ABSOLUTE;
|
||||||
else
|
else
|
||||||
|
@ -592,9 +600,15 @@ xf86PostProximityEvent(DeviceIntPtr device,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
va_list var;
|
va_list var;
|
||||||
int i, nevents, *valuators = NULL;
|
int i, nevents;
|
||||||
|
int valuators[MAX_VALUATORS];
|
||||||
|
|
||||||
valuators = xcalloc(sizeof(int), num_valuators);
|
|
||||||
|
if (num_valuators > MAX_VALUATORS) {
|
||||||
|
xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d"
|
||||||
|
" is greater than MAX_VALUATORS\n", num_valuators);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
va_start(var, num_valuators);
|
va_start(var, num_valuators);
|
||||||
for (i = 0; i < num_valuators; i++)
|
for (i = 0; i < num_valuators; i++)
|
||||||
|
@ -608,7 +622,6 @@ xf86PostProximityEvent(DeviceIntPtr device,
|
||||||
for (i = 0; i < nevents; i++)
|
for (i = 0; i < nevents; i++)
|
||||||
mieqEnqueue(device, (xf86Events + i)->event);
|
mieqEnqueue(device, (xf86Events + i)->event);
|
||||||
|
|
||||||
xfree(valuators);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
|
@ -621,7 +634,7 @@ xf86PostButtonEvent(DeviceIntPtr device,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
va_list var;
|
va_list var;
|
||||||
int *valuators = NULL;
|
int valuators[MAX_VALUATORS];
|
||||||
int i = 0, nevents = 0;
|
int i = 0, nevents = 0;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
|
@ -632,7 +645,11 @@ xf86PostButtonEvent(DeviceIntPtr device,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
valuators = xcalloc(sizeof(int), num_valuators);
|
if (num_valuators > MAX_VALUATORS) {
|
||||||
|
xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d"
|
||||||
|
" is greater than MAX_VALUATORS\n", num_valuators);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
va_start(var, num_valuators);
|
va_start(var, num_valuators);
|
||||||
for (i = 0; i < num_valuators; i++)
|
for (i = 0; i < num_valuators; i++)
|
||||||
|
@ -648,7 +665,6 @@ xf86PostButtonEvent(DeviceIntPtr device,
|
||||||
for (i = 0; i < nevents; i++)
|
for (i = 0; i < nevents; i++)
|
||||||
mieqEnqueue(device, (xf86Events + i)->event);
|
mieqEnqueue(device, (xf86Events + i)->event);
|
||||||
|
|
||||||
xfree(valuators);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
|
@ -661,15 +677,21 @@ xf86PostKeyEvent(DeviceIntPtr device,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
va_list var;
|
va_list var;
|
||||||
int i = 0, nevents = 0, *valuators = NULL;
|
int i = 0, nevents = 0;
|
||||||
|
static int valuators[MAX_VALUATORS];
|
||||||
|
|
||||||
/* instil confidence in the user */
|
/* instil confidence in the user */
|
||||||
DebugF("this function has never been tested properly. if things go quite "
|
DebugF("this function has never been tested properly. if things go quite "
|
||||||
"badly south after this message, then xf86PostKeyEvent is "
|
"badly south after this message, then xf86PostKeyEvent is "
|
||||||
"broken.\n");
|
"broken.\n");
|
||||||
|
|
||||||
|
if (num_valuators > MAX_VALUATORS) {
|
||||||
|
xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d"
|
||||||
|
" is greater than MAX_VALUATORS\n", num_valuators);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_absolute) {
|
if (is_absolute) {
|
||||||
valuators = xcalloc(sizeof(int), num_valuators);
|
|
||||||
va_start(var, num_valuators);
|
va_start(var, num_valuators);
|
||||||
for (i = 0; i < num_valuators; i++)
|
for (i = 0; i < num_valuators; i++)
|
||||||
valuators[i] = va_arg(var, int);
|
valuators[i] = va_arg(var, int);
|
||||||
|
@ -680,7 +702,6 @@ xf86PostKeyEvent(DeviceIntPtr device,
|
||||||
is_down ? KeyPress : KeyRelease,
|
is_down ? KeyPress : KeyRelease,
|
||||||
key_code, first_valuator,
|
key_code, first_valuator,
|
||||||
num_valuators, valuators);
|
num_valuators, valuators);
|
||||||
xfree(valuators);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nevents = GetKeyboardEvents(xf86Events, device,
|
nevents = GetKeyboardEvents(xf86Events, device,
|
||||||
|
|
|
@ -107,127 +107,6 @@ xf86FormatPciBusNumber(int busnum, char *buffer)
|
||||||
sprintf(buffer, "%d@%d", busnum & 0x00ff, busnum >> 8);
|
sprintf(buffer, "%d@%d", busnum & 0x00ff, busnum >> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
FindPCIVideoInfo(void)
|
|
||||||
{
|
|
||||||
int i = 0, k;
|
|
||||||
int num = 0;
|
|
||||||
struct pci_device *info;
|
|
||||||
struct pci_device_iterator *iter;
|
|
||||||
|
|
||||||
|
|
||||||
if (!xf86scanpci()) {
|
|
||||||
xf86PciVideoInfo = NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
iter = pci_slot_match_iterator_create(& xf86IsolateDevice);
|
|
||||||
while ((info = pci_device_next(iter)) != NULL) {
|
|
||||||
if (PCIINFOCLASSES(info->device_class)) {
|
|
||||||
num++;
|
|
||||||
xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo,
|
|
||||||
(sizeof(struct pci_device *)
|
|
||||||
* (num + 1)));
|
|
||||||
xf86PciVideoInfo[num] = NULL;
|
|
||||||
xf86PciVideoInfo[num - 1] = info;
|
|
||||||
|
|
||||||
pci_device_probe(info);
|
|
||||||
info->user_data = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* If we haven't found a primary device try a different heuristic */
|
|
||||||
if (primaryBus.type == BUS_NONE && num) {
|
|
||||||
for (i = 0; i < num; i++) {
|
|
||||||
uint16_t command;
|
|
||||||
|
|
||||||
info = xf86PciVideoInfo[i];
|
|
||||||
pci_device_cfg_read_u16(info, & command, 4);
|
|
||||||
|
|
||||||
if ((command & PCI_CMD_MEM_ENABLE)
|
|
||||||
&& ((num == 1) || IS_VGA(info->device_class))) {
|
|
||||||
if (primaryBus.type == BUS_NONE) {
|
|
||||||
primaryBus.type = BUS_PCI;
|
|
||||||
primaryBus.id.pci = info;
|
|
||||||
} else {
|
|
||||||
xf86Msg(X_NOTICE,
|
|
||||||
"More than one possible primary device found\n");
|
|
||||||
primaryBus.type ^= (BusType)(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Print a summary of the video devices found */
|
|
||||||
for (k = 0; k < num; k++) {
|
|
||||||
const char *vendorname = NULL, *chipname = NULL;
|
|
||||||
const char *prim = " ";
|
|
||||||
Bool memdone = FALSE, iodone = FALSE;
|
|
||||||
|
|
||||||
|
|
||||||
info = xf86PciVideoInfo[k];
|
|
||||||
|
|
||||||
vendorname = pci_device_get_vendor_name( info );
|
|
||||||
chipname = pci_device_get_device_name( info );
|
|
||||||
|
|
||||||
if ((!vendorname || !chipname) &&
|
|
||||||
!PCIALWAYSPRINTCLASSES(info->device_class))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (xf86IsPrimaryPci(info))
|
|
||||||
prim = "*";
|
|
||||||
|
|
||||||
xf86Msg( X_PROBED, "PCI:%s(%u@%u:%u:%u) ", prim, info->domain,
|
|
||||||
info->bus, info->dev, info->func );
|
|
||||||
|
|
||||||
if (vendorname)
|
|
||||||
xf86ErrorF("%s ", vendorname);
|
|
||||||
else
|
|
||||||
xf86ErrorF("unknown vendor (0x%04x) ", info->vendor_id);
|
|
||||||
|
|
||||||
if (chipname)
|
|
||||||
xf86ErrorF("%s ", chipname);
|
|
||||||
else
|
|
||||||
xf86ErrorF("unknown chipset (0x%04x) ", info->device_id);
|
|
||||||
|
|
||||||
xf86ErrorF("rev %d", info->revision);
|
|
||||||
|
|
||||||
for (i = 0; i < 6; i++) {
|
|
||||||
struct pci_mem_region * r = & info->regions[i];
|
|
||||||
|
|
||||||
if ( r->size && ! r->is_IO ) {
|
|
||||||
if (!memdone) {
|
|
||||||
xf86ErrorF(", Mem @ ");
|
|
||||||
memdone = TRUE;
|
|
||||||
} else
|
|
||||||
xf86ErrorF(", ");
|
|
||||||
xf86ErrorF("0x%08lx/%ld", r->base_addr, r->size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < 6; i++) {
|
|
||||||
struct pci_mem_region * r = & info->regions[i];
|
|
||||||
|
|
||||||
if ( r->size && r->is_IO ) {
|
|
||||||
if (!iodone) {
|
|
||||||
xf86ErrorF(", I/O @ ");
|
|
||||||
iodone = TRUE;
|
|
||||||
} else
|
|
||||||
xf86ErrorF(", ");
|
|
||||||
xf86ErrorF("0x%08lx/%ld", r->base_addr, r->size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( info->rom_size ) {
|
|
||||||
xf86ErrorF(", BIOS @ 0x\?\?\?\?\?\?\?\?/%ld", info->rom_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
xf86ErrorF("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IO enable/disable related routines for PCI
|
* IO enable/disable related routines for PCI
|
||||||
*/
|
*/
|
||||||
|
@ -401,10 +280,10 @@ savePciState( struct pci_device * dev, pciSavePtr ptr )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* move to OS layer */
|
/* move to OS layer */
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
restorePciState( struct pci_device * dev, pciSavePtr ptr)
|
restorePciState( struct pci_device * dev, pciSavePtr ptr)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* disable card before setting anything */
|
/* disable card before setting anything */
|
||||||
|
@ -419,8 +298,8 @@ restorePciState( struct pci_device * dev, pciSavePtr ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_device_cfg_write_u32(dev, ptr->command, PCI_CMD_STAT_REG);
|
pci_device_cfg_write_u32(dev, ptr->command, PCI_CMD_STAT_REG);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* move to OS layer */
|
/* move to OS layer */
|
||||||
static void
|
static void
|
||||||
|
@ -470,7 +349,121 @@ restorePciBusState(BusAccPtr ptr)
|
||||||
void
|
void
|
||||||
xf86PciProbe(void)
|
xf86PciProbe(void)
|
||||||
{
|
{
|
||||||
FindPCIVideoInfo();
|
int i = 0, k;
|
||||||
|
int num = 0;
|
||||||
|
struct pci_device *info;
|
||||||
|
struct pci_device_iterator *iter;
|
||||||
|
|
||||||
|
|
||||||
|
if (!xf86scanpci()) {
|
||||||
|
xf86PciVideoInfo = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
iter = pci_slot_match_iterator_create(& xf86IsolateDevice);
|
||||||
|
while ((info = pci_device_next(iter)) != NULL) {
|
||||||
|
if (PCIINFOCLASSES(info->device_class)) {
|
||||||
|
num++;
|
||||||
|
xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo,
|
||||||
|
(sizeof(struct pci_device *)
|
||||||
|
* (num + 1)));
|
||||||
|
xf86PciVideoInfo[num] = NULL;
|
||||||
|
xf86PciVideoInfo[num - 1] = info;
|
||||||
|
|
||||||
|
pci_device_probe(info);
|
||||||
|
info->user_data = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* If we haven't found a primary device try a different heuristic */
|
||||||
|
if (primaryBus.type == BUS_NONE && num) {
|
||||||
|
for (i = 0; i < num; i++) {
|
||||||
|
uint16_t command;
|
||||||
|
|
||||||
|
info = xf86PciVideoInfo[i];
|
||||||
|
pci_device_cfg_read_u16(info, & command, 4);
|
||||||
|
|
||||||
|
if ((command & PCI_CMD_MEM_ENABLE)
|
||||||
|
&& ((num == 1) || IS_VGA(info->device_class))) {
|
||||||
|
if (primaryBus.type == BUS_NONE) {
|
||||||
|
primaryBus.type = BUS_PCI;
|
||||||
|
primaryBus.id.pci = info;
|
||||||
|
} else {
|
||||||
|
xf86Msg(X_NOTICE,
|
||||||
|
"More than one possible primary device found\n");
|
||||||
|
primaryBus.type ^= (BusType)(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print a summary of the video devices found */
|
||||||
|
for (k = 0; k < num; k++) {
|
||||||
|
const char *vendorname = NULL, *chipname = NULL;
|
||||||
|
const char *prim = " ";
|
||||||
|
Bool memdone = FALSE, iodone = FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
info = xf86PciVideoInfo[k];
|
||||||
|
|
||||||
|
vendorname = pci_device_get_vendor_name( info );
|
||||||
|
chipname = pci_device_get_device_name( info );
|
||||||
|
|
||||||
|
if ((!vendorname || !chipname) &&
|
||||||
|
!PCIALWAYSPRINTCLASSES(info->device_class))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (xf86IsPrimaryPci(info))
|
||||||
|
prim = "*";
|
||||||
|
|
||||||
|
xf86Msg( X_PROBED, "PCI:%s(%u@%u:%u:%u) ", prim, info->domain,
|
||||||
|
info->bus, info->dev, info->func );
|
||||||
|
|
||||||
|
if (vendorname)
|
||||||
|
xf86ErrorF("%s ", vendorname);
|
||||||
|
else
|
||||||
|
xf86ErrorF("unknown vendor (0x%04x) ", info->vendor_id);
|
||||||
|
|
||||||
|
if (chipname)
|
||||||
|
xf86ErrorF("%s ", chipname);
|
||||||
|
else
|
||||||
|
xf86ErrorF("unknown chipset (0x%04x) ", info->device_id);
|
||||||
|
|
||||||
|
xf86ErrorF("rev %d", info->revision);
|
||||||
|
|
||||||
|
for (i = 0; i < 6; i++) {
|
||||||
|
struct pci_mem_region * r = & info->regions[i];
|
||||||
|
|
||||||
|
if ( r->size && ! r->is_IO ) {
|
||||||
|
if (!memdone) {
|
||||||
|
xf86ErrorF(", Mem @ ");
|
||||||
|
memdone = TRUE;
|
||||||
|
} else
|
||||||
|
xf86ErrorF(", ");
|
||||||
|
xf86ErrorF("0x%08lx/%ld", r->base_addr, r->size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 6; i++) {
|
||||||
|
struct pci_mem_region * r = & info->regions[i];
|
||||||
|
|
||||||
|
if ( r->size && r->is_IO ) {
|
||||||
|
if (!iodone) {
|
||||||
|
xf86ErrorF(", I/O @ ");
|
||||||
|
iodone = TRUE;
|
||||||
|
} else
|
||||||
|
xf86ErrorF(", ");
|
||||||
|
xf86ErrorF("0x%08lx/%ld", r->base_addr, r->size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( info->rom_size ) {
|
||||||
|
xf86ErrorF(", BIOS @ 0x\?\?\?\?\?\?\?\?/%ld", info->rom_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
xf86ErrorF("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -348,7 +348,7 @@ typedef struct _DriverRec {
|
||||||
* functions to configuration tools, the Xserver, or any other
|
* functions to configuration tools, the Xserver, or any other
|
||||||
* application/module interested in such information.
|
* application/module interested in such information.
|
||||||
*/
|
*/
|
||||||
typedef struct _ModuleInfoRec {
|
_X_DEPRECATED typedef struct _ModuleInfoRec {
|
||||||
int moduleVersion;
|
int moduleVersion;
|
||||||
char * moduleName;
|
char * moduleName;
|
||||||
pointer module;
|
pointer module;
|
||||||
|
|
|
@ -108,9 +108,9 @@ static unsigned char XF86MiscReqCode = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
# define DEBUG_P(x) ErrorF(x"\n");
|
# define DEBUG_P(x) ErrorF x;
|
||||||
#else
|
#else
|
||||||
# define DEBUG_P(x) /**/
|
# define DEBUG_P(x) do {} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MISCERR(x) (miscErrorBase + x)
|
#define MISCERR(x) (miscErrorBase + x)
|
||||||
|
@ -120,8 +120,6 @@ XFree86MiscExtensionInit(void)
|
||||||
{
|
{
|
||||||
ExtensionEntry* extEntry;
|
ExtensionEntry* extEntry;
|
||||||
|
|
||||||
DEBUG_P("XFree86MiscExtensionInit");
|
|
||||||
|
|
||||||
if (!xf86GetModInDevEnabled())
|
if (!xf86GetModInDevEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -154,8 +152,6 @@ ProcXF86MiscQueryVersion(client)
|
||||||
xXF86MiscQueryVersionReply rep;
|
xXF86MiscQueryVersionReply rep;
|
||||||
register int n;
|
register int n;
|
||||||
|
|
||||||
DEBUG_P("XF86MiscQueryVersion");
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86MiscQueryVersionReq);
|
REQUEST_SIZE_MATCH(xXF86MiscQueryVersionReq);
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
|
@ -252,8 +248,6 @@ ProcXF86MiscGetMouseSettings(client)
|
||||||
register int n;
|
register int n;
|
||||||
int devnamelen;
|
int devnamelen;
|
||||||
|
|
||||||
DEBUG_P("XF86MiscGetMouseSettings");
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq);
|
REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq);
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
|
@ -303,8 +297,6 @@ ProcXF86MiscGetKbdSettings(client)
|
||||||
pointer kbd;
|
pointer kbd;
|
||||||
register int n;
|
register int n;
|
||||||
|
|
||||||
DEBUG_P("XF86MiscGetKbdSettings");
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq);
|
REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq);
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
|
@ -338,19 +330,17 @@ ProcXF86MiscSetMouseSettings(client)
|
||||||
|
|
||||||
REQUEST(xXF86MiscSetMouseSettingsReq);
|
REQUEST(xXF86MiscSetMouseSettingsReq);
|
||||||
|
|
||||||
DEBUG_P("XF86MiscSetMouseSettings");
|
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86MiscSetMouseSettingsReq);
|
REQUEST_AT_LEAST_SIZE(xXF86MiscSetMouseSettingsReq);
|
||||||
|
|
||||||
ClientVersion(client, &major, &minor);
|
ClientVersion(client, &major, &minor);
|
||||||
|
|
||||||
if (xf86GetVerbosity() > 1) {
|
if (xf86GetVerbosity() > 1) {
|
||||||
ErrorF("SetMouseSettings - type: %d brate: %d srate: %d chdmid: %d\n",
|
DEBUG_P(("SetMouseSettings - type: %d brate: %d srate: %d chdmid: %d\n",
|
||||||
(int)stuff->mousetype, (int)stuff->baudrate,
|
(int)stuff->mousetype, (int)stuff->baudrate,
|
||||||
(int)stuff->samplerate, stuff->chordmiddle);
|
(int)stuff->samplerate, stuff->chordmiddle));
|
||||||
ErrorF(" em3but: %d em3tim: %d res: %d flags: %ld\n",
|
DEBUG_P((" em3but: %d em3tim: %d res: %d flags: %ld\n",
|
||||||
stuff->emulate3buttons, (int)stuff->emulate3timeout,
|
stuff->emulate3buttons, (int)stuff->emulate3timeout,
|
||||||
(int)stuff->resolution, (unsigned long)stuff->flags);
|
(int)stuff->resolution, (unsigned long)stuff->flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mouse = MiscExtCreateStruct(MISC_POINTER)) == (pointer) 0)
|
if ((mouse = MiscExtCreateStruct(MISC_POINTER)) == (pointer) 0)
|
||||||
|
@ -376,7 +366,7 @@ ProcXF86MiscSetMouseSettings(client)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
strncpy(devname,(char*)(&stuff[1]),stuff->devnamelen);
|
strncpy(devname,(char*)(&stuff[1]),stuff->devnamelen);
|
||||||
if (xf86GetVerbosity() > 1)
|
if (xf86GetVerbosity() > 1)
|
||||||
ErrorF("SetMouseSettings - device: %s\n",devname);
|
DEBUG_P(("SetMouseSettings - device: %s\n",devname));
|
||||||
MiscExtSetMouseDevice(mouse, devname);
|
MiscExtSetMouseDevice(mouse, devname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -395,12 +385,12 @@ ProcXF86MiscSetMouseSettings(client)
|
||||||
case MISC_RET_BADCOMBO: return MISCERR(XF86MiscBadMouseCombo);
|
case MISC_RET_BADCOMBO: return MISCERR(XF86MiscBadMouseCombo);
|
||||||
case MISC_RET_NOMODULE: return MISCERR(XF86MiscNoModule);
|
case MISC_RET_NOMODULE: return MISCERR(XF86MiscNoModule);
|
||||||
default:
|
default:
|
||||||
ErrorF("Unexpected return from MiscExtApply(POINTER) = %d\n", ret);
|
DEBUG_P(("Unexpected return from MiscExtApply(POINTER) = %d\n", ret));
|
||||||
return BadImplementation;
|
return BadImplementation;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xf86GetVerbosity() > 1)
|
if (xf86GetVerbosity() > 1)
|
||||||
ErrorF("SetMouseSettings - Succeeded\n");
|
DEBUG_P(("SetMouseSettings - Succeeded\n"));
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,14 +402,12 @@ ProcXF86MiscSetKbdSettings(client)
|
||||||
pointer kbd;
|
pointer kbd;
|
||||||
REQUEST(xXF86MiscSetKbdSettingsReq);
|
REQUEST(xXF86MiscSetKbdSettingsReq);
|
||||||
|
|
||||||
DEBUG_P("XF86MiscSetKbdSettings");
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq);
|
REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq);
|
||||||
|
|
||||||
if (xf86GetVerbosity() > 1)
|
if (xf86GetVerbosity() > 1)
|
||||||
ErrorF("SetKbdSettings - type: %d rate: %d delay: %d snumlk: %d\n",
|
DEBUG_P(("SetKbdSettings - type: %d rate: %d delay: %d snumlk: %d\n",
|
||||||
(int)stuff->kbdtype, (int)stuff->rate,
|
(int)stuff->kbdtype, (int)stuff->rate,
|
||||||
(int)stuff->delay, stuff->servnumlock);
|
(int)stuff->delay, stuff->servnumlock));
|
||||||
|
|
||||||
if ((kbd = MiscExtCreateStruct(MISC_KEYBOARD)) == (pointer) 0)
|
if ((kbd = MiscExtCreateStruct(MISC_KEYBOARD)) == (pointer) 0)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
@ -434,12 +422,12 @@ ProcXF86MiscSetKbdSettings(client)
|
||||||
case MISC_RET_BADVAL: return BadValue;
|
case MISC_RET_BADVAL: return BadValue;
|
||||||
case MISC_RET_BADKBDTYPE: return MISCERR(XF86MiscBadKbdType);
|
case MISC_RET_BADKBDTYPE: return MISCERR(XF86MiscBadKbdType);
|
||||||
default:
|
default:
|
||||||
ErrorF("Unexpected return from MiscExtApply(KEYBOARD) = %d\n", ret);
|
DEBUG_P(("Unexpected return from MiscExtApply(KEYBOARD) = %d\n", ret));
|
||||||
return BadImplementation;
|
return BadImplementation;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xf86GetVerbosity() > 1)
|
if (xf86GetVerbosity() > 1)
|
||||||
ErrorF("SetKbdSettings - Succeeded\n");
|
DEBUG_P(("SetKbdSettings - Succeeded\n"));
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,14 +439,12 @@ ProcXF86MiscSetGrabKeysState(client)
|
||||||
xXF86MiscSetGrabKeysStateReply rep;
|
xXF86MiscSetGrabKeysStateReply rep;
|
||||||
REQUEST(xXF86MiscSetGrabKeysStateReq);
|
REQUEST(xXF86MiscSetGrabKeysStateReq);
|
||||||
|
|
||||||
DEBUG_P("XF86MiscSetGrabKeysState");
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq);
|
REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq);
|
||||||
|
|
||||||
if ((status = MiscExtSetGrabKeysState(client, stuff->enable)) == 0) {
|
if ((status = MiscExtSetGrabKeysState(client, stuff->enable)) == 0) {
|
||||||
if (xf86GetVerbosity() > 1)
|
if (xf86GetVerbosity() > 1)
|
||||||
ErrorF("SetGrabKeysState - %s\n",
|
DEBUG_P(("SetGrabKeysState - %s\n",
|
||||||
stuff->enable ? "enabled" : "disabled");
|
stuff->enable ? "enabled" : "disabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
|
@ -482,8 +468,6 @@ ProcXF86MiscSetClientVersion(ClientPtr client)
|
||||||
|
|
||||||
MiscPrivPtr pPriv;
|
MiscPrivPtr pPriv;
|
||||||
|
|
||||||
DEBUG_P("XF86MiscSetClientVersion");
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq);
|
REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq);
|
||||||
|
|
||||||
if ((pPriv = M_GETPRIV(client)) == NULL) {
|
if ((pPriv = M_GETPRIV(client)) == NULL) {
|
||||||
|
@ -493,7 +477,7 @@ ProcXF86MiscSetClientVersion(ClientPtr client)
|
||||||
M_SETPRIV(client, pPriv);
|
M_SETPRIV(client, pPriv);
|
||||||
}
|
}
|
||||||
if (xf86GetVerbosity() > 1)
|
if (xf86GetVerbosity() > 1)
|
||||||
ErrorF("SetClientVersion: %i %i\n",stuff->major,stuff->minor);
|
DEBUG_P(("SetClientVersion: %i %i\n",stuff->major,stuff->minor));
|
||||||
pPriv->major = stuff->major;
|
pPriv->major = stuff->major;
|
||||||
pPriv->minor = stuff->minor;
|
pPriv->minor = stuff->minor;
|
||||||
|
|
||||||
|
@ -511,8 +495,6 @@ ProcXF86MiscGetFilePaths(client)
|
||||||
register int n;
|
register int n;
|
||||||
int configlen, modulelen, loglen;
|
int configlen, modulelen, loglen;
|
||||||
|
|
||||||
DEBUG_P("XF86MiscGetFilePaths");
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq);
|
REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq);
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
|
@ -559,8 +541,6 @@ ProcXF86MiscPassMessage(client)
|
||||||
|
|
||||||
REQUEST(xXF86MiscPassMessageReq);
|
REQUEST(xXF86MiscPassMessageReq);
|
||||||
|
|
||||||
DEBUG_P("XF86MiscPassMessage");
|
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86MiscPassMessageReq);
|
REQUEST_AT_LEAST_SIZE(xXF86MiscPassMessageReq);
|
||||||
size = (sizeof(xXF86MiscPassMessageReq) + 3) >> 2;
|
size = (sizeof(xXF86MiscPassMessageReq) + 3) >> 2;
|
||||||
size+= (stuff->typelen + 3) >> 2;
|
size+= (stuff->typelen + 3) >> 2;
|
||||||
|
|
|
@ -125,6 +125,9 @@ glxSetup(pointer module, pointer opts, int *errmaj, int *errmin)
|
||||||
provider = LoaderSymbol("__glXDRIProvider");
|
provider = LoaderSymbol("__glXDRIProvider");
|
||||||
if (provider)
|
if (provider)
|
||||||
GlxPushProvider(provider);
|
GlxPushProvider(provider);
|
||||||
|
provider = LoaderSymbol("__glXDRI2Provider");
|
||||||
|
if (provider)
|
||||||
|
GlxPushProvider(provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (xf86Info.glxVisuals) {
|
switch (xf86Info.glxVisuals) {
|
||||||
|
|
|
@ -75,7 +75,6 @@ rendition
|
||||||
s3
|
s3
|
||||||
s3virge
|
s3virge
|
||||||
savage
|
savage
|
||||||
scanpci
|
|
||||||
shadow
|
shadow
|
||||||
shadowfb
|
shadowfb
|
||||||
siliconmotion
|
siliconmotion
|
||||||
|
|
|
@ -378,13 +378,6 @@ and
|
||||||
.B \-ggamma
|
.B \-ggamma
|
||||||
options.
|
options.
|
||||||
.TP 8
|
.TP 8
|
||||||
.B \-scanpci
|
|
||||||
When this option is specified, the
|
|
||||||
.B __xservername__
|
|
||||||
server scans the PCI bus, and prints out some information about each
|
|
||||||
device that was detected. See also scanpci(__appmansuffix__)
|
|
||||||
and pcitweak(__appmansuffix__).
|
|
||||||
.TP 8
|
|
||||||
.BI \-screen " screen-name"
|
.BI \-screen " screen-name"
|
||||||
Use the __xconfigfile__(__filemansuffix__) file
|
Use the __xconfigfile__(__filemansuffix__) file
|
||||||
.B Screen
|
.B Screen
|
||||||
|
|
|
@ -507,17 +507,6 @@ This allows the server to start up even if the mouse device can't be
|
||||||
opened/initialised.
|
opened/initialised.
|
||||||
Default: false.
|
Default: false.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qVTInit\*q \*q" command \*q
|
|
||||||
Runs
|
|
||||||
.I command
|
|
||||||
after the VT used by the server has been opened.
|
|
||||||
The command string is passed to \*q/bin/sh \-c\*q, and is run with the real
|
|
||||||
user's id with stdin and stdout set to the VT.
|
|
||||||
The purpose of this option is to allow system dependent VT initialisation
|
|
||||||
commands to be run.
|
|
||||||
This option should rarely be needed.
|
|
||||||
Default: not set.
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qVTSysReq\*q \*q" boolean \*q
|
.BI "Option \*qVTSysReq\*q \*q" boolean \*q
|
||||||
enables the SYSV\-style VT switch sequence for non\-SYSV systems
|
enables the SYSV\-style VT switch sequence for non\-SYSV systems
|
||||||
which support VT switching.
|
which support VT switching.
|
||||||
|
@ -1005,10 +994,8 @@ In multi-head configurations, or when using a secondary graphics card in a
|
||||||
single-head configuration, this entry is mandatory.
|
single-head configuration, this entry is mandatory.
|
||||||
Its main purpose is to make an unambiguous connection between the device
|
Its main purpose is to make an unambiguous connection between the device
|
||||||
section and the hardware it is representing.
|
section and the hardware it is representing.
|
||||||
This information can usually be found by running the __xservername__ server
|
This information can usually be found by running the pciaccess tool
|
||||||
with the
|
scanpci.
|
||||||
.B \-scanpci
|
|
||||||
command line option.
|
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Screen " number
|
.BI "Screen " number
|
||||||
This option is mandatory for cards where a single PCI entity can drive more
|
This option is mandatory for cards where a single PCI entity can drive more
|
||||||
|
|
15
hw/xfree86/dri2/Makefile.am
Normal file
15
hw/xfree86/dri2/Makefile.am
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
libdri2_la_LTLIBRARIES = libdri2.la
|
||||||
|
libdri2_la_CFLAGS = \
|
||||||
|
-DHAVE_XORG_CONFIG_H \
|
||||||
|
-I@MESA_SOURCE@/include \
|
||||||
|
@DIX_CFLAGS@ @DRIPROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
|
||||||
|
-I$(top_srcdir)/hw/xfree86/common \
|
||||||
|
-I$(top_srcdir)/hw/xfree86/os-support/bus
|
||||||
|
|
||||||
|
libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
|
||||||
|
libdri2_ladir = $(moduledir)/extensions
|
||||||
|
libdri2_la_SOURCES = \
|
||||||
|
dri2.c \
|
||||||
|
dri2.h
|
||||||
|
|
||||||
|
sdk_HEADERS = dri2.h
|
456
hw/xfree86/dri2/dri2.c
Normal file
456
hw/xfree86/dri2/dri2.c
Normal file
|
@ -0,0 +1,456 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2007 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Soft-
|
||||||
|
* ware"), to deal in the Software without restriction, including without
|
||||||
|
* limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, provided that the above copyright
|
||||||
|
* notice(s) and this permission notice appear in all copies of the Soft-
|
||||||
|
* ware and that both the above copyright notice(s) and this permission
|
||||||
|
* notice appear in supporting documentation.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
|
||||||
|
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
|
||||||
|
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
|
||||||
|
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
|
||||||
|
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||||
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
|
||||||
|
* MANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
* Except as contained in this notice, the name of a copyright holder shall
|
||||||
|
* not be used in advertising or otherwise to promote the sale, use or
|
||||||
|
* other dealings in this Software without prior written authorization of
|
||||||
|
* the copyright holder.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kristian Høgsberg (krh@redhat.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_XORG_CONFIG_H
|
||||||
|
#include <xorg-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <xf86drm.h>
|
||||||
|
#include "xf86Module.h"
|
||||||
|
#include "scrnintstr.h"
|
||||||
|
#include "windowstr.h"
|
||||||
|
#include "dri2.h"
|
||||||
|
#include <GL/internal/dri_sarea.h>
|
||||||
|
|
||||||
|
#include "xf86.h"
|
||||||
|
|
||||||
|
static DevPrivateKey dri2ScreenPrivateKey = &dri2ScreenPrivateKey;
|
||||||
|
static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKey;
|
||||||
|
static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKey;
|
||||||
|
|
||||||
|
typedef struct _DRI2DrawablePriv {
|
||||||
|
drm_drawable_t drawable;
|
||||||
|
unsigned int handle;
|
||||||
|
} DRI2DrawablePrivRec, *DRI2DrawablePrivPtr;
|
||||||
|
|
||||||
|
typedef struct _DRI2Screen {
|
||||||
|
int fd;
|
||||||
|
drmBO sareaBO;
|
||||||
|
void *sarea;
|
||||||
|
unsigned int sareaSize;
|
||||||
|
const char *driverName;
|
||||||
|
int ddxVersionMajor;
|
||||||
|
int ddxVersionMinor;
|
||||||
|
int ddxVersionPatch;
|
||||||
|
|
||||||
|
__DRIEventBuffer *buffer;
|
||||||
|
int locked;
|
||||||
|
|
||||||
|
DRI2GetPixmapHandleProcPtr getPixmapHandle;
|
||||||
|
DRI2BeginClipNotifyProcPtr beginClipNotify;
|
||||||
|
DRI2EndClipNotifyProcPtr endClipNotify;
|
||||||
|
|
||||||
|
ClipNotifyProcPtr ClipNotify;
|
||||||
|
HandleExposuresProcPtr HandleExposures;
|
||||||
|
} DRI2ScreenRec, *DRI2ScreenPtr;
|
||||||
|
|
||||||
|
static DRI2ScreenPtr
|
||||||
|
DRI2GetScreen(ScreenPtr pScreen)
|
||||||
|
{
|
||||||
|
return dixLookupPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
DRI2ScreenAllocEvent(DRI2ScreenPtr ds, size_t size)
|
||||||
|
{
|
||||||
|
unsigned int *pad, mask = ds->buffer->size - 1;
|
||||||
|
size_t pad_size;
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
if ((ds->buffer->head & mask) + size > ds->buffer->size) {
|
||||||
|
/* The requested event size would wrap the buffer, so pad to
|
||||||
|
* the end and allocate the event from the start. */
|
||||||
|
pad_size = ds->buffer->size - (ds->buffer->head & mask);
|
||||||
|
pad = (unsigned int *)
|
||||||
|
(ds->buffer->data + (ds->buffer->prealloc & mask));
|
||||||
|
*pad = DRI2_EVENT_HEADER(DRI2_EVENT_PAD, pad_size);
|
||||||
|
ds->buffer->prealloc += pad_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = ds->buffer->data + (ds->buffer->prealloc & mask);
|
||||||
|
ds->buffer->prealloc += size;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
DRI2ScreenCommitEvents(DRI2ScreenPtr ds)
|
||||||
|
{
|
||||||
|
ds->buffer->head = ds->buffer->prealloc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
DRI2PostDrawableConfig(DrawablePtr pDraw)
|
||||||
|
{
|
||||||
|
ScreenPtr pScreen = pDraw->pScreen;
|
||||||
|
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||||
|
DRI2DrawablePrivPtr pPriv;
|
||||||
|
WindowPtr pWin;
|
||||||
|
PixmapPtr pPixmap;
|
||||||
|
BoxPtr pBox;
|
||||||
|
BoxRec pixmapBox;
|
||||||
|
int nBox;
|
||||||
|
int i;
|
||||||
|
__DRIDrawableConfigEvent *e;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
|
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||||
|
pWin = (WindowPtr) pDraw;
|
||||||
|
pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
|
||||||
|
|
||||||
|
nBox = REGION_NUM_RECTS(&pWin->clipList);
|
||||||
|
pBox = REGION_RECTS(&pWin->clipList);
|
||||||
|
|
||||||
|
pPixmap = pScreen->GetWindowPixmap(pWin);
|
||||||
|
} else {
|
||||||
|
pPixmap = (PixmapPtr) pDraw;
|
||||||
|
pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
|
||||||
|
|
||||||
|
pixmapBox.x1 = 0;
|
||||||
|
pixmapBox.y1 = 0;
|
||||||
|
pixmapBox.x2 = pDraw->width;
|
||||||
|
pixmapBox.y2 = pDraw->height;
|
||||||
|
nBox = 1;
|
||||||
|
pBox = &pixmapBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pPriv)
|
||||||
|
return;
|
||||||
|
|
||||||
|
size = sizeof *e + nBox * sizeof e->rects[0];
|
||||||
|
|
||||||
|
e = DRI2ScreenAllocEvent(ds, size);
|
||||||
|
e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_DRAWABLE_CONFIG, size);
|
||||||
|
e->drawable = pPriv->drawable;
|
||||||
|
e->x = pDraw->x - pPixmap->screen_x;
|
||||||
|
e->y = pDraw->y - pPixmap->screen_y;
|
||||||
|
e->width = pDraw->width;
|
||||||
|
e->height = pDraw->height;
|
||||||
|
|
||||||
|
e->num_rects = nBox;
|
||||||
|
for (i = 0; i < nBox; i++) {
|
||||||
|
e->rects[i].x1 = pBox->x1 - pPixmap->screen_x;
|
||||||
|
e->rects[i].y1 = pBox->y1 - pPixmap->screen_y;
|
||||||
|
e->rects[i].x2 = pBox->x2 - pPixmap->screen_x;
|
||||||
|
e->rects[i].y2 = pBox->y2 - pPixmap->screen_y;
|
||||||
|
pBox++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
DRI2PostBufferAttach(DrawablePtr pDraw)
|
||||||
|
{
|
||||||
|
ScreenPtr pScreen = pDraw->pScreen;
|
||||||
|
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||||
|
DRI2DrawablePrivPtr pPriv;
|
||||||
|
WindowPtr pWin;
|
||||||
|
PixmapPtr pPixmap;
|
||||||
|
__DRIBufferAttachEvent *e;
|
||||||
|
size_t size;
|
||||||
|
unsigned int handle, flags;
|
||||||
|
|
||||||
|
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||||
|
pWin = (WindowPtr) pDraw;
|
||||||
|
pPixmap = pScreen->GetWindowPixmap(pWin);
|
||||||
|
pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
|
||||||
|
} else {
|
||||||
|
pPixmap = (PixmapPtr) pDraw;
|
||||||
|
pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pPriv)
|
||||||
|
return;
|
||||||
|
|
||||||
|
size = sizeof *e;
|
||||||
|
|
||||||
|
handle = ds->getPixmapHandle(pPixmap, &flags);
|
||||||
|
if (handle == 0 || handle == pPriv->handle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
e = DRI2ScreenAllocEvent(ds, size);
|
||||||
|
e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_BUFFER_ATTACH, size);
|
||||||
|
e->drawable = pPriv->drawable;
|
||||||
|
e->buffer.attachment = DRI_DRAWABLE_BUFFER_FRONT_LEFT;
|
||||||
|
e->buffer.handle = handle;
|
||||||
|
e->buffer.pitch = pPixmap->devKind;
|
||||||
|
e->buffer.cpp = pPixmap->drawable.bitsPerPixel / 8;
|
||||||
|
e->buffer.flags = flags;
|
||||||
|
|
||||||
|
pPriv->handle = handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
DRI2ClipNotify(WindowPtr pWin, int dx, int dy)
|
||||||
|
{
|
||||||
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||||
|
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||||
|
|
||||||
|
if (!ds->locked) {
|
||||||
|
ds->beginClipNotify(pScreen);
|
||||||
|
ds->locked = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ds->ClipNotify) {
|
||||||
|
pScreen->ClipNotify = ds->ClipNotify;
|
||||||
|
pScreen->ClipNotify(pWin, dx, dy);
|
||||||
|
pScreen->ClipNotify = DRI2ClipNotify;
|
||||||
|
}
|
||||||
|
|
||||||
|
DRI2PostDrawableConfig(&pWin->drawable);
|
||||||
|
DRI2PostBufferAttach(&pWin->drawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
DRI2HandleExposures(WindowPtr pWin)
|
||||||
|
{
|
||||||
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||||
|
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||||
|
|
||||||
|
if (ds->HandleExposures) {
|
||||||
|
pScreen->HandleExposures = ds->HandleExposures;
|
||||||
|
pScreen->HandleExposures(pWin);
|
||||||
|
pScreen->HandleExposures = DRI2HandleExposures;
|
||||||
|
}
|
||||||
|
|
||||||
|
DRI2ScreenCommitEvents(ds);
|
||||||
|
|
||||||
|
if (ds->locked) {
|
||||||
|
ds->endClipNotify(pScreen);
|
||||||
|
ds->locked = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DRI2CloseScreen(ScreenPtr pScreen)
|
||||||
|
{
|
||||||
|
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||||
|
|
||||||
|
pScreen->ClipNotify = ds->ClipNotify;
|
||||||
|
pScreen->HandleExposures = ds->HandleExposures;
|
||||||
|
|
||||||
|
drmBOUnmap(ds->fd, &ds->sareaBO);
|
||||||
|
drmBOUnreference(ds->fd, &ds->sareaBO);
|
||||||
|
|
||||||
|
xfree(ds);
|
||||||
|
dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
DRI2CreateDrawable(ScreenPtr pScreen,
|
||||||
|
DrawablePtr pDraw, drm_drawable_t *pDrmDrawable)
|
||||||
|
{
|
||||||
|
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||||
|
WindowPtr pWin;
|
||||||
|
PixmapPtr pPixmap;
|
||||||
|
DRI2DrawablePrivPtr pPriv;
|
||||||
|
DevPrivateKey key;
|
||||||
|
PrivateRec **devPrivates;
|
||||||
|
|
||||||
|
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||||
|
pWin = (WindowPtr) pDraw;
|
||||||
|
devPrivates = &pWin->devPrivates;
|
||||||
|
key = dri2WindowPrivateKey;
|
||||||
|
} else {
|
||||||
|
pPixmap = (PixmapPtr) pDraw;
|
||||||
|
devPrivates = &pPixmap->devPrivates;
|
||||||
|
key = dri2PixmapPrivateKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
pPriv = dixLookupPrivate(devPrivates, key);
|
||||||
|
if (pPriv == NULL) {
|
||||||
|
pPriv = xalloc(sizeof *pPriv);
|
||||||
|
if (drmCreateDrawable(ds->fd, &pPriv->drawable))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
dixSetPrivate(devPrivates, key, pPriv);
|
||||||
|
}
|
||||||
|
|
||||||
|
*pDrmDrawable = pPriv->drawable;
|
||||||
|
|
||||||
|
DRI2PostDrawableConfig(pDraw);
|
||||||
|
DRI2PostBufferAttach(pDraw);
|
||||||
|
DRI2ScreenCommitEvents(ds);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DRI2DestroyDrawable(ScreenPtr pScreen, DrawablePtr pDraw)
|
||||||
|
{
|
||||||
|
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||||
|
PixmapPtr pPixmap;
|
||||||
|
WindowPtr pWin;
|
||||||
|
DRI2DrawablePrivPtr pPriv;
|
||||||
|
|
||||||
|
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||||
|
pWin = (WindowPtr) pDraw;
|
||||||
|
pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
|
||||||
|
dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
|
||||||
|
} else {
|
||||||
|
pPixmap = (PixmapPtr) pDraw;
|
||||||
|
pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
|
||||||
|
dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pPriv == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
drmDestroyDrawable(ds->fd, pPriv->drawable);
|
||||||
|
xfree(pPriv);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
|
||||||
|
int *ddxMajor, int *ddxMinor, int *ddxPatch,
|
||||||
|
unsigned int *sareaHandle)
|
||||||
|
{
|
||||||
|
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||||
|
|
||||||
|
if (ds == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
*fd = ds->fd;
|
||||||
|
*driverName = ds->driverName;
|
||||||
|
*ddxMajor = ds->ddxVersionMajor;
|
||||||
|
*ddxMinor = ds->ddxVersionMinor;
|
||||||
|
*ddxPatch = ds->ddxVersionPatch;
|
||||||
|
*sareaHandle = ds->sareaBO.handle;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
DRI2GetPixmapHandle(PixmapPtr pPixmap, unsigned int *flags)
|
||||||
|
{
|
||||||
|
DRI2ScreenPtr ds = DRI2GetScreen(pPixmap->drawable.pScreen);
|
||||||
|
|
||||||
|
return ds->getPixmapHandle(pPixmap, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
DRI2SetupSAREA(ScreenPtr pScreen, size_t driverSareaSize)
|
||||||
|
{
|
||||||
|
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||||
|
unsigned long mask;
|
||||||
|
const size_t event_buffer_size = 32 * 1024;
|
||||||
|
|
||||||
|
ds->sareaSize =
|
||||||
|
sizeof(*ds->buffer) + event_buffer_size +
|
||||||
|
driverSareaSize +
|
||||||
|
sizeof (unsigned int);
|
||||||
|
|
||||||
|
mask = DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE |
|
||||||
|
DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_SHAREABLE;
|
||||||
|
|
||||||
|
if (drmBOCreate(ds->fd, ds->sareaSize, 1, NULL, mask, 0, &ds->sareaBO))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (drmBOMap(ds->fd, &ds->sareaBO,
|
||||||
|
DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0, &ds->sarea)) {
|
||||||
|
drmBOUnreference(ds->fd, &ds->sareaBO);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
xf86DrvMsg(pScreen->myNum, X_INFO,
|
||||||
|
"[DRI2] Allocated %d byte SAREA, BO handle 0x%08x\n",
|
||||||
|
ds->sareaSize, ds->sareaBO.handle);
|
||||||
|
memset(ds->sarea, 0, ds->sareaSize);
|
||||||
|
|
||||||
|
ds->buffer = ds->sarea;
|
||||||
|
ds->buffer->block_header =
|
||||||
|
DRI2_SAREA_BLOCK_HEADER(DRI2_SAREA_BLOCK_EVENT_BUFFER,
|
||||||
|
sizeof *ds->buffer + event_buffer_size);
|
||||||
|
ds->buffer->size = event_buffer_size;
|
||||||
|
|
||||||
|
return DRI2_SAREA_BLOCK_NEXT(ds->buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
|
||||||
|
{
|
||||||
|
DRI2ScreenPtr ds;
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
ds = xalloc(sizeof *ds);
|
||||||
|
if (!ds)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
ds->fd = info->fd;
|
||||||
|
ds->driverName = info->driverName;
|
||||||
|
ds->ddxVersionMajor = info->ddxVersionMajor;
|
||||||
|
ds->ddxVersionMinor = info->ddxVersionMinor;
|
||||||
|
ds->ddxVersionPatch = info->ddxVersionPatch;
|
||||||
|
|
||||||
|
ds->getPixmapHandle = info->getPixmapHandle;
|
||||||
|
ds->beginClipNotify = info->beginClipNotify;
|
||||||
|
ds->endClipNotify = info->endClipNotify;
|
||||||
|
|
||||||
|
ds->ClipNotify = pScreen->ClipNotify;
|
||||||
|
pScreen->ClipNotify = DRI2ClipNotify;
|
||||||
|
ds->HandleExposures = pScreen->HandleExposures;
|
||||||
|
pScreen->HandleExposures = DRI2HandleExposures;
|
||||||
|
|
||||||
|
dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds);
|
||||||
|
|
||||||
|
p = DRI2SetupSAREA(pScreen, info->driverSareaSize);
|
||||||
|
if (p == NULL) {
|
||||||
|
xfree(ds);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n");
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
static pointer
|
||||||
|
DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
|
||||||
|
{
|
||||||
|
return (pointer) 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static XF86ModuleVersionInfo DRI2VersRec =
|
||||||
|
{
|
||||||
|
"dri2",
|
||||||
|
MODULEVENDORSTRING,
|
||||||
|
MODINFOSTRING1,
|
||||||
|
MODINFOSTRING2,
|
||||||
|
XORG_VERSION_CURRENT,
|
||||||
|
1, 0, 0,
|
||||||
|
ABI_CLASS_EXTENSION,
|
||||||
|
ABI_EXTENSION_VERSION,
|
||||||
|
MOD_CLASS_NONE,
|
||||||
|
{ 0, 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
_X_EXPORT XF86ModuleData dri2ModuleData = { &DRI2VersRec, DRI2Setup, NULL };
|
||||||
|
|
80
hw/xfree86/dri2/dri2.h
Normal file
80
hw/xfree86/dri2/dri2.h
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2007 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Soft-
|
||||||
|
* ware"), to deal in the Software without restriction, including without
|
||||||
|
* limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, provided that the above copyright
|
||||||
|
* notice(s) and this permission notice appear in all copies of the Soft-
|
||||||
|
* ware and that both the above copyright notice(s) and this permission
|
||||||
|
* notice appear in supporting documentation.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
|
||||||
|
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
|
||||||
|
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
|
||||||
|
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
|
||||||
|
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||||
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
|
||||||
|
* MANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
* Except as contained in this notice, the name of a copyright holder shall
|
||||||
|
* not be used in advertising or otherwise to promote the sale, use or
|
||||||
|
* other dealings in this Software without prior written authorization of
|
||||||
|
* the copyright holder.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kristian Høgsberg (krh@redhat.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _DRI2_H_
|
||||||
|
#define _DRI2_H_
|
||||||
|
|
||||||
|
typedef unsigned int (*DRI2GetPixmapHandleProcPtr)(PixmapPtr p,
|
||||||
|
unsigned int *flags);
|
||||||
|
typedef void (*DRI2BeginClipNotifyProcPtr)(ScreenPtr pScreen);
|
||||||
|
typedef void (*DRI2EndClipNotifyProcPtr)(ScreenPtr pScreen);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned int version; /* Version of this struct */
|
||||||
|
int fd;
|
||||||
|
size_t driverSareaSize;
|
||||||
|
const char *driverName;
|
||||||
|
int ddxVersionMajor, ddxVersionMinor, ddxVersionPatch;
|
||||||
|
DRI2GetPixmapHandleProcPtr getPixmapHandle;
|
||||||
|
DRI2BeginClipNotifyProcPtr beginClipNotify;
|
||||||
|
DRI2EndClipNotifyProcPtr endClipNotify;
|
||||||
|
} DRI2InfoRec, *DRI2InfoPtr;
|
||||||
|
|
||||||
|
void *DRI2ScreenInit(ScreenPtr pScreen,
|
||||||
|
DRI2InfoPtr info);
|
||||||
|
|
||||||
|
void DRI2CloseScreen(ScreenPtr pScreen);
|
||||||
|
|
||||||
|
Bool DRI2Connect(ScreenPtr pScreen,
|
||||||
|
int *fd,
|
||||||
|
const char **driverName,
|
||||||
|
int *ddxMajor,
|
||||||
|
int *ddxMinor,
|
||||||
|
int *ddxPatch,
|
||||||
|
unsigned int *sareaHandle);
|
||||||
|
|
||||||
|
unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap,
|
||||||
|
unsigned int *flags);
|
||||||
|
|
||||||
|
void DRI2Lock(ScreenPtr pScreen);
|
||||||
|
void DRI2Unlock(ScreenPtr pScreen);
|
||||||
|
|
||||||
|
Bool DRI2CreateDrawable(ScreenPtr pScreen,
|
||||||
|
DrawablePtr pDraw,
|
||||||
|
drm_drawable_t *pDrmDrawable);
|
||||||
|
|
||||||
|
void DRI2DestroyDrawable(ScreenPtr pScreen,
|
||||||
|
DrawablePtr pDraw);
|
||||||
|
|
||||||
|
void DRI2ExtensionInit(void);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,6 +1,6 @@
|
||||||
# libdummy.a contains just those bits used in the server itself
|
# libdummy.a contains just those bits used in the server itself
|
||||||
# libdummy-nonserver.a contains additional routines normally found in the
|
# libdummy-nonserver.a contains additional routines normally found in the
|
||||||
# server for use in building the utilities like scanpci & the config tools
|
# server for use in building the utilities like config tools
|
||||||
|
|
||||||
noinst_LIBRARIES = libdummy-nonserver.a
|
noinst_LIBRARIES = libdummy-nonserver.a
|
||||||
|
|
||||||
|
|
|
@ -178,8 +178,6 @@ exaDDXDriverInit(ScreenPtr pScreen)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static MODULESETUPPROTO(exaSetup);
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
static const OptionInfoRec *
|
static const OptionInfoRec *
|
||||||
EXAAvailableOptions(void *unused)
|
EXAAvailableOptions(void *unused)
|
||||||
|
@ -201,26 +199,4 @@ static XF86ModuleVersionInfo exaVersRec =
|
||||||
{0,0,0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
_X_EXPORT XF86ModuleData exaModuleData = { &exaVersRec, exaSetup, NULL };
|
_X_EXPORT XF86ModuleData exaModuleData = { &exaVersRec, NULL, NULL };
|
||||||
|
|
||||||
static ModuleInfoRec EXA = {
|
|
||||||
1,
|
|
||||||
"EXA",
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
EXAAvailableOptions,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
static pointer
|
|
||||||
exaSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor)
|
|
||||||
{
|
|
||||||
static Bool Initialised = FALSE;
|
|
||||||
|
|
||||||
if (!Initialised) {
|
|
||||||
Initialised = TRUE;
|
|
||||||
xf86AddModuleInfo(&EXA, Module);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (pointer)TRUE;
|
|
||||||
}
|
|
||||||
|
|
|
@ -71,15 +71,9 @@
|
||||||
#define DLSYM_PREFIX ""
|
#define DLSYM_PREFIX ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int handle;
|
|
||||||
void *dlhandle;
|
|
||||||
int flags;
|
|
||||||
} DLModuleRec, *DLModulePtr;
|
|
||||||
|
|
||||||
/* Hooray, yet another open coded linked list! FIXME */
|
/* Hooray, yet another open coded linked list! FIXME */
|
||||||
typedef struct DLModuleList {
|
typedef struct DLModuleList {
|
||||||
DLModulePtr module;
|
void *module;
|
||||||
struct DLModuleList *next;
|
struct DLModuleList *next;
|
||||||
} DLModuleList;
|
} DLModuleList;
|
||||||
|
|
||||||
|
@ -88,19 +82,22 @@ static DLModuleList *dlModuleList = NULL;
|
||||||
static void *
|
static void *
|
||||||
DLFindSymbolLocal(pointer module, const char *name)
|
DLFindSymbolLocal(pointer module, const char *name)
|
||||||
{
|
{
|
||||||
DLModulePtr dlfile = module;
|
|
||||||
void *p;
|
void *p;
|
||||||
char *n;
|
char *n;
|
||||||
|
|
||||||
static const char symPrefix[] = DLSYM_PREFIX;
|
static const char symPrefix[] = DLSYM_PREFIX;
|
||||||
|
|
||||||
n = malloc(strlen(symPrefix) + strlen(name) + 1);
|
if (strlen(symPrefix)) {
|
||||||
if (strlen(symPrefix))
|
n = malloc(strlen(symPrefix) + strlen(name) + 1);
|
||||||
sprintf(n, "%s%s", symPrefix, name);
|
sprintf(n, "%s%s", symPrefix, name);
|
||||||
else
|
} else {
|
||||||
sprintf(n, "%s", name);
|
n = name;
|
||||||
p = dlsym(dlfile->dlhandle, n);
|
}
|
||||||
free(n);
|
|
||||||
|
p = dlsym(module, n);
|
||||||
|
|
||||||
|
if (strlen(symPrefix))
|
||||||
|
free(n);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +124,7 @@ DLFindSymbol(const char *name)
|
||||||
global_scope = dlopen(NULL, DLOPEN_LAZY | DLOPEN_GLOBAL);
|
global_scope = dlopen(NULL, DLOPEN_LAZY | DLOPEN_GLOBAL);
|
||||||
|
|
||||||
if (global_scope)
|
if (global_scope)
|
||||||
return dlsym(global_scope, name);
|
return DLFindSymbolLocal(global_scope, name);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -135,23 +132,17 @@ DLFindSymbol(const char *name)
|
||||||
void *
|
void *
|
||||||
DLLoadModule(loaderPtr modrec, int flags)
|
DLLoadModule(loaderPtr modrec, int flags)
|
||||||
{
|
{
|
||||||
DLModulePtr dlfile;
|
void * dlfile;
|
||||||
DLModuleList *l;
|
DLModuleList *l;
|
||||||
int dlopen_flags;
|
int dlopen_flags;
|
||||||
|
|
||||||
if ((dlfile = calloc(1, sizeof(DLModuleRec))) == NULL) {
|
|
||||||
ErrorF("Unable to allocate DLModuleRec\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
dlfile->handle = modrec->handle;
|
|
||||||
if (flags & LD_FLAG_GLOBAL)
|
if (flags & LD_FLAG_GLOBAL)
|
||||||
dlopen_flags = DLOPEN_LAZY | DLOPEN_GLOBAL;
|
dlopen_flags = DLOPEN_LAZY | DLOPEN_GLOBAL;
|
||||||
else
|
else
|
||||||
dlopen_flags = DLOPEN_LAZY;
|
dlopen_flags = DLOPEN_LAZY;
|
||||||
dlfile->dlhandle = dlopen(modrec->name, dlopen_flags);
|
dlfile = dlopen(modrec->name, dlopen_flags);
|
||||||
if (dlfile->dlhandle == NULL) {
|
if (dlfile == NULL) {
|
||||||
ErrorF("dlopen: %s\n", dlerror());
|
ErrorF("dlopen: %s\n", dlerror());
|
||||||
free(dlfile);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +157,6 @@ DLLoadModule(loaderPtr modrec, int flags)
|
||||||
void
|
void
|
||||||
DLUnloadModule(void *modptr)
|
DLUnloadModule(void *modptr)
|
||||||
{
|
{
|
||||||
DLModulePtr dlfile = (DLModulePtr) modptr;
|
|
||||||
DLModuleList *l, *p;
|
DLModuleList *l, *p;
|
||||||
|
|
||||||
/* remove it from dlModuleList. */
|
/* remove it from dlModuleList. */
|
||||||
|
@ -185,6 +175,5 @@ DLUnloadModule(void *modptr)
|
||||||
p = l;
|
p = l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dlclose(dlfile->dlhandle);
|
dlclose(modptr);
|
||||||
free(modptr);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ extern RESTYPE ShmSegType, ShmPixType;
|
||||||
extern Bool noPanoramiXExtension;
|
extern Bool noPanoramiXExtension;
|
||||||
extern int PanoramiXNumScreens;
|
extern int PanoramiXNumScreens;
|
||||||
extern PanoramiXData *panoramiXdataPtr;
|
extern PanoramiXData *panoramiXdataPtr;
|
||||||
extern XID *PanoramiXVisualTable;
|
|
||||||
extern unsigned long XRT_WINDOW;
|
extern unsigned long XRT_WINDOW;
|
||||||
extern unsigned long XRT_PIXMAP;
|
extern unsigned long XRT_PIXMAP;
|
||||||
extern unsigned long XRT_GC;
|
extern unsigned long XRT_GC;
|
||||||
|
@ -69,7 +68,6 @@ _X_HIDDEN void *extLookupTab[] = {
|
||||||
SYMFUNC(XineramaDeleteResource)
|
SYMFUNC(XineramaDeleteResource)
|
||||||
SYMVAR(PanoramiXNumScreens)
|
SYMVAR(PanoramiXNumScreens)
|
||||||
SYMVAR(panoramiXdataPtr)
|
SYMVAR(panoramiXdataPtr)
|
||||||
SYMVAR(PanoramiXVisualTable)
|
|
||||||
SYMVAR(XRT_WINDOW)
|
SYMVAR(XRT_WINDOW)
|
||||||
SYMVAR(XRT_PIXMAP)
|
SYMVAR(XRT_PIXMAP)
|
||||||
SYMVAR(XRT_GC)
|
SYMVAR(XRT_GC)
|
||||||
|
|
|
@ -62,17 +62,11 @@ typedef struct module_desc {
|
||||||
struct module_desc *child;
|
struct module_desc *child;
|
||||||
struct module_desc *sib;
|
struct module_desc *sib;
|
||||||
struct module_desc *parent;
|
struct module_desc *parent;
|
||||||
struct module_desc *demand_next;
|
|
||||||
char *name;
|
char *name;
|
||||||
char *filename;
|
|
||||||
char *identifier;
|
|
||||||
XID client_id;
|
|
||||||
int in_use;
|
|
||||||
int handle;
|
int handle;
|
||||||
ModuleSetupProc SetupProc;
|
ModuleSetupProc SetupProc;
|
||||||
ModuleTearDownProc TearDownProc;
|
ModuleTearDownProc TearDownProc;
|
||||||
void *TearDownData; /* returned from SetupProc */
|
void *TearDownData; /* returned from SetupProc */
|
||||||
const char *path;
|
|
||||||
const XF86ModuleVersionInfo *VersionInfo;
|
const XF86ModuleVersionInfo *VersionInfo;
|
||||||
} ModuleDesc, *ModuleDescPtr;
|
} ModuleDesc, *ModuleDescPtr;
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,7 @@ InitPathList(const char *path)
|
||||||
}
|
}
|
||||||
if (list)
|
if (list)
|
||||||
list[n] = NULL;
|
list[n] = NULL;
|
||||||
|
xfree(fullpath);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,12 +787,7 @@ NewModuleDesc(const char *name)
|
||||||
mdp->child = NULL;
|
mdp->child = NULL;
|
||||||
mdp->sib = NULL;
|
mdp->sib = NULL;
|
||||||
mdp->parent = NULL;
|
mdp->parent = NULL;
|
||||||
mdp->demand_next = NULL;
|
|
||||||
mdp->name = xstrdup(name);
|
mdp->name = xstrdup(name);
|
||||||
mdp->filename = NULL;
|
|
||||||
mdp->identifier = NULL;
|
|
||||||
mdp->client_id = 0;
|
|
||||||
mdp->in_use = 0;
|
|
||||||
mdp->handle = -1;
|
mdp->handle = -1;
|
||||||
mdp->SetupProc = NULL;
|
mdp->SetupProc = NULL;
|
||||||
mdp->TearDownProc = NULL;
|
mdp->TearDownProc = NULL;
|
||||||
|
@ -816,15 +812,10 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent)
|
||||||
if (LoaderHandleOpen(mod->handle) == -1)
|
if (LoaderHandleOpen(mod->handle) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret->filename = xstrdup(mod->filename);
|
|
||||||
ret->identifier = mod->identifier;
|
|
||||||
ret->client_id = mod->client_id;
|
|
||||||
ret->in_use = mod->in_use;
|
|
||||||
ret->handle = mod->handle;
|
ret->handle = mod->handle;
|
||||||
ret->SetupProc = mod->SetupProc;
|
ret->SetupProc = mod->SetupProc;
|
||||||
ret->TearDownProc = mod->TearDownProc;
|
ret->TearDownProc = mod->TearDownProc;
|
||||||
ret->TearDownData = NULL;
|
ret->TearDownData = NULL;
|
||||||
ret->path = mod->path;
|
|
||||||
ret->child = DuplicateModule(mod->child, ret);
|
ret->child = DuplicateModule(mod->child, ret);
|
||||||
ret->sib = DuplicateModule(mod->sib, parent);
|
ret->sib = DuplicateModule(mod->sib, parent);
|
||||||
ret->parent = parent;
|
ret->parent = parent;
|
||||||
|
@ -943,8 +934,6 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
|
||||||
if (ret->handle < 0)
|
if (ret->handle < 0)
|
||||||
goto LoadModule_fail;
|
goto LoadModule_fail;
|
||||||
|
|
||||||
ret->filename = xstrdup(found);
|
|
||||||
|
|
||||||
/* drop any explicit suffix from the module name */
|
/* drop any explicit suffix from the module name */
|
||||||
p = strchr(name, '.');
|
p = strchr(name, '.');
|
||||||
if (p)
|
if (p)
|
||||||
|
@ -998,7 +987,6 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
|
||||||
ret->SetupProc = setup;
|
ret->SetupProc = setup;
|
||||||
if (teardown)
|
if (teardown)
|
||||||
ret->TearDownProc = teardown;
|
ret->TearDownProc = teardown;
|
||||||
ret->path = path;
|
|
||||||
ret->VersionInfo = vers;
|
ret->VersionInfo = vers;
|
||||||
} else {
|
} else {
|
||||||
/* No initdata is OK for external modules */
|
/* No initdata is OK for external modules */
|
||||||
|
@ -1120,7 +1108,6 @@ UnloadModuleOrDriver(ModuleDescPtr mod)
|
||||||
if (mod->sib)
|
if (mod->sib)
|
||||||
UnloadModuleOrDriver(mod->sib);
|
UnloadModuleOrDriver(mod->sib);
|
||||||
TestFree(mod->name);
|
TestFree(mod->name);
|
||||||
TestFree(mod->filename);
|
|
||||||
xfree(mod);
|
xfree(mod);
|
||||||
#ifdef __alpha__
|
#ifdef __alpha__
|
||||||
istream_mem_barrier();
|
istream_mem_barrier();
|
||||||
|
@ -1145,7 +1132,6 @@ UnloadSubModule(ModuleDescPtr mod)
|
||||||
UnloadModuleOrDriver(mod->child);
|
UnloadModuleOrDriver(mod->child);
|
||||||
|
|
||||||
TestFree(mod->name);
|
TestFree(mod->name);
|
||||||
TestFree(mod->filename);
|
|
||||||
xfree(mod);
|
xfree(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,12 +1142,6 @@ FreeModuleDesc(ModuleDescPtr head)
|
||||||
|
|
||||||
if (head == (ModuleDescPtr) 1)
|
if (head == (ModuleDescPtr) 1)
|
||||||
return;
|
return;
|
||||||
/*
|
|
||||||
* only free it if it's not marked as in use. In use means that it may
|
|
||||||
* be unloaded someday, and UnloadModule will free it
|
|
||||||
*/
|
|
||||||
if (head->in_use)
|
|
||||||
return;
|
|
||||||
if (head->child)
|
if (head->child)
|
||||||
FreeModuleDesc(head->child);
|
FreeModuleDesc(head->child);
|
||||||
sibs = head;
|
sibs = head;
|
||||||
|
|
|
@ -482,8 +482,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
||||||
SYMFUNC(xf86IsScreenPrimary)
|
SYMFUNC(xf86IsScreenPrimary)
|
||||||
SYMFUNC(xf86RegisterRootWindowProperty)
|
SYMFUNC(xf86RegisterRootWindowProperty)
|
||||||
SYMFUNC(xf86IsUnblank)
|
SYMFUNC(xf86IsUnblank)
|
||||||
SYMFUNC(xf86AddModuleInfo)
|
|
||||||
SYMFUNC(xf86DeleteModuleInfo)
|
|
||||||
|
|
||||||
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
|
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
|
||||||
/* xf86sbusBus.c */
|
/* xf86sbusBus.c */
|
||||||
|
|
|
@ -16,7 +16,7 @@ libxf86modes_a_SOURCES = \
|
||||||
|
|
||||||
INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
|
INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
|
||||||
-I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
|
-I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
|
||||||
-I$(srcdir)/../scanpci -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
|
-I$(srcdir)/../vbe -I$(srcdir)/../int10 \
|
||||||
-I$(srcdir)/../vgahw -I$(srcdir)/../ramdac \
|
-I$(srcdir)/../vgahw -I$(srcdir)/../ramdac \
|
||||||
-I$(srcdir)/../dixmods/extmod
|
-I$(srcdir)/../dixmods/extmod
|
||||||
|
|
||||||
|
|
|
@ -236,6 +236,9 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
|
||||||
int saved_x, saved_y;
|
int saved_x, saved_y;
|
||||||
Rotation saved_rotation;
|
Rotation saved_rotation;
|
||||||
|
|
||||||
|
if (crtc->funcs->set_mode_major)
|
||||||
|
return crtc->funcs->set_mode_major(crtc, mode, rotation, x, y);
|
||||||
|
|
||||||
crtc->enabled = xf86CrtcInUse (crtc);
|
crtc->enabled = xf86CrtcInUse (crtc);
|
||||||
|
|
||||||
if (!crtc->enabled)
|
if (!crtc->enabled)
|
||||||
|
@ -1362,8 +1365,8 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
|
||||||
if (sync_source == sync_default)
|
if (sync_source == sync_default)
|
||||||
sync_source = sync_edid;
|
sync_source = sync_edid;
|
||||||
}
|
}
|
||||||
if (ranges->max_clock > max_clock)
|
if (ranges->max_clock * 1000 > max_clock)
|
||||||
max_clock = ranges->max_clock;
|
max_clock = ranges->max_clock * 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1410,9 +1413,12 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
|
||||||
/*
|
/*
|
||||||
* Check default modes against monitor max clock
|
* Check default modes against monitor max clock
|
||||||
*/
|
*/
|
||||||
if (max_clock)
|
if (max_clock) {
|
||||||
xf86ValidateModesClocks(scrn, default_modes,
|
xf86ValidateModesClocks(scrn, default_modes,
|
||||||
&min_clock, &max_clock, 1);
|
&min_clock, &max_clock, 1);
|
||||||
|
xf86ValidateModesClocks(scrn, output_modes,
|
||||||
|
&min_clock, &max_clock, 1);
|
||||||
|
}
|
||||||
|
|
||||||
output->probed_modes = NULL;
|
output->probed_modes = NULL;
|
||||||
output->probed_modes = xf86ModesAdd (output->probed_modes, config_modes);
|
output->probed_modes = xf86ModesAdd (output->probed_modes, config_modes);
|
||||||
|
|
|
@ -206,6 +206,13 @@ typedef struct _xf86CrtcFuncs {
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
(*destroy) (xf86CrtcPtr crtc);
|
(*destroy) (xf86CrtcPtr crtc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Less fine-grained mode setting entry point for kernel modesetting
|
||||||
|
*/
|
||||||
|
Bool
|
||||||
|
(*set_mode_major)(xf86CrtcPtr crtc, DisplayModePtr mode,
|
||||||
|
Rotation rotation, int x, int y);
|
||||||
} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
|
} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
|
||||||
|
|
||||||
struct _xf86Crtc {
|
struct _xf86Crtc {
|
||||||
|
|
|
@ -110,8 +110,9 @@ static Bool quirk_detailed_h_in_cm (int scrnIndex, xf86MonPtr DDC)
|
||||||
{
|
{
|
||||||
/* Bug #10304: "LGPhilipsLCD LP154W01-A5" */
|
/* Bug #10304: "LGPhilipsLCD LP154W01-A5" */
|
||||||
/* Bug #12784: "LGPhilipsLCD LP154W01-TLA2" */
|
/* Bug #12784: "LGPhilipsLCD LP154W01-TLA2" */
|
||||||
|
/* Red Hat #435216 "LGPhilipsLCD LP154W01-TLAE" */
|
||||||
if (memcmp (DDC->vendor.name, "LPL", 4) == 0 &&
|
if (memcmp (DDC->vendor.name, "LPL", 4) == 0 &&
|
||||||
DDC->vendor.prod_id == 0)
|
(DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* Bug #11603: Funai Electronics PM36B */
|
/* Bug #11603: Funai Electronics PM36B */
|
||||||
|
|
|
@ -580,9 +580,9 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PictureTransformTranslate (&crtc_to_fb, &fb_to_crtc, crtc->x, crtc->y);
|
PictureTransformTranslate (&crtc_to_fb, &fb_to_crtc, F(crtc->x), F(crtc->y));
|
||||||
PictureTransformIsInverse ("offset", &crtc_to_fb, &fb_to_crtc);
|
PictureTransformIsInverse ("offset", &crtc_to_fb, &fb_to_crtc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* these are the size of the shadow pixmap, which
|
* these are the size of the shadow pixmap, which
|
||||||
* matches the mode, not the pre-rotated copy in the
|
* matches the mode, not the pre-rotated copy in the
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user