Merge commit 'origin/master' into transform-proposal-old

Conflicts:

	configure.ac
	exa/exa.c
This commit is contained in:
Keith Packard 2008-05-04 22:24:56 -07:00
commit 33e5a176e6
190 changed files with 4420 additions and 10781 deletions

2
.gitignore vendored
View file

@ -278,6 +278,8 @@ hw/xprint/doc/Xprt.1x
hw/xprint/doc/Xprt.man
hw/xprint/dpmsstubs-wrapper.c
hw/xprint/miinitext-wrapper.c
hw/xquartz/xpr/Xquartz
hw/xquartz/xpr/Xquartz.1
include/dix-config.h
include/kdrive-config.h
include/xgl-config.h

View file

@ -1,9 +1,4 @@
if XQUARTZ
XQUARTZ_SUBDIRS = apple
endif
SUBDIRS = glx mesa $(XQUARTZ_SUBDIRS)
DIST_SUBDIRS = glx mesa apple
SUBDIRS = glx
WINDOWS_EXTRAS = \
windows/ChangeLog \

View file

@ -1,24 +0,0 @@
AM_CFLAGS = $(DIX_CFLAGS)
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/GL/glx \
-I$(top_srcdir)/GL/include \
-I$(top_srcdir)/GL/mesa/glapi \
-I$(top_srcdir)/hw/xquartz \
-I$(top_srcdir)/hw/xquartz/xpr \
-I$(top_srcdir)/miext/damage
if HAVE_AGL_FRAMEWORK
noinst_LIBRARIES = libAGLcore.a
libAGLcore_a_SOURCES = aglGlx.c \
$(top_srcdir)/hw/xquartz/xpr/x-list.c \
$(top_srcdir)/hw/xquartz/xpr/x-list.h \
$(top_srcdir)/hw/xquartz/xpr/x-hash.c \
$(top_srcdir)/hw/xquartz/xpr/x-hash.h \
$(top_srcdir)/hw/dmx/glxProxy/compsize.c
endif
#noinst_LIBRARIES = libCGLcore.a
#libCGLcore_a_SOURCES = \
# indirect.c \
# $(top_srcdir)/hw/dmx/glxProxy/compsize.c

File diff suppressed because it is too large Load diff

View file

@ -47,7 +47,12 @@ libglxdri_la_SOURCES = \
extension_string.c \
extension_string.h
#if XQUARTZ
XQUARTZ_libglx_la_SOURCES = glcontextmodes.c
#endif
libglx_la_SOURCES = \
$(XQUARTZ_libglx_la_SOURCES) \
g_disptab.h \
glxbyteorder.h \
glxcmds.c \

View file

@ -37,7 +37,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
#include <string.h>
#include <dlfcn.h>
#define _NEED_GL_CORE_IF
#include <GL/xmesa.h>
#include <GL/internal/glcore.h>
#include <glxserver.h>
@ -48,6 +50,22 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "os.h"
#define XMesaCreateVisual (*glcore->XMesaCreateVisual)
#define XMesaDestroyVisual (*glcore->XMesaDestroyVisual)
#define XMesaCreateWindowBuffer (*glcore->XMesaCreateWindowBuffer)
#define XMesaCreatePixmapBuffer (*glcore->XMesaCreatePixmapBuffer)
#define XMesaDestroyBuffer (*glcore->XMesaDestroyBuffer)
#define XMesaSwapBuffers (*glcore->XMesaSwapBuffers)
#define XMesaResizeBuffers (*glcore->XMesaResizeBuffers)
#define XMesaCreateContext (*glcore->XMesaCreateContext)
#define XMesaDestroyContext (*glcore->XMesaDestroyContext)
#define XMesaCopyContext (*glcore->XMesaCopyContext)
#define XMesaMakeCurrent2 (*glcore->XMesaMakeCurrent2)
#define XMesaForceCurrent (*glcore->XMesaForceCurrent)
#define XMesaLoseCurrent (*glcore->XMesaLoseCurrent)
typedef struct __GLXMESAscreen __GLXMESAscreen;
typedef struct __GLXMESAcontext __GLXMESAcontext;
typedef struct __GLXMESAdrawable __GLXMESAdrawable;
@ -55,8 +73,11 @@ typedef struct __GLXMESAdrawable __GLXMESAdrawable;
struct __GLXMESAscreen {
__GLXscreen base;
int index;
int num_vis;
int num_vis;
XMesaVisual *xm_vis;
void *driver;
const __GLcoreModule *glcore;
};
struct __GLXMESAcontext {
@ -65,8 +86,9 @@ struct __GLXMESAcontext {
};
struct __GLXMESAdrawable {
__GLXdrawable base;
XMesaBuffer xm_buf;
__GLXdrawable base;
XMesaBuffer xm_buf;
__GLXMESAscreen *screen;
};
static XMesaVisual find_mesa_visual(__GLXscreen *screen, XID fbconfigID);
@ -76,6 +98,7 @@ static void
__glXMesaDrawableDestroy(__GLXdrawable *base)
{
__GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base;
const __GLcoreModule *glcore = glxPriv->screen->glcore;
if (glxPriv->xm_buf != NULL)
XMesaDestroyBuffer(glxPriv->xm_buf);
@ -86,6 +109,7 @@ static GLboolean
__glXMesaDrawableResize(__GLXdrawable *base)
{
__GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base;
const __GLcoreModule *glcore = glxPriv->screen->glcore;
XMesaResizeBuffers(glxPriv->xm_buf);
@ -96,6 +120,7 @@ static GLboolean
__glXMesaDrawableSwapBuffers(__GLXdrawable *base)
{
__GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base;
const __GLcoreModule *glcore = glxPriv->screen->glcore;
/* This is terrifying: XMesaSwapBuffers() ends up calling CopyArea
* to do the buffer swap, but this assumes that the server holds
@ -121,6 +146,8 @@ __glXMesaScreenCreateDrawable(__GLXscreen *screen,
XID drawId,
__GLXconfig *modes)
{
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
const __GLcoreModule *glcore = mesaScreen->glcore;
__GLXMESAdrawable *glxPriv;
XMesaVisual xm_vis;
@ -130,6 +157,7 @@ __glXMesaScreenCreateDrawable(__GLXscreen *screen,
memset(glxPriv, 0, sizeof *glxPriv);
glxPriv->screen = mesaScreen;
if (!__glXDrawableInit(&glxPriv->base, screen,
pDraw, type, drawId, modes)) {
xfree(glxPriv);
@ -166,6 +194,8 @@ static void
__glXMesaContextDestroy(__GLXcontext *baseContext)
{
__GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
__GLXMESAscreen *screen = (__GLXMESAscreen *) context->base.pGlxScreen;
const __GLcoreModule *glcore = screen->glcore;
XMesaDestroyContext(context->xmesa);
__glXContextDestroy(&context->base);
@ -179,6 +209,8 @@ __glXMesaContextMakeCurrent(__GLXcontext *baseContext)
__GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
__GLXMESAdrawable *drawPriv = (__GLXMESAdrawable *) context->base.drawPriv;
__GLXMESAdrawable *readPriv = (__GLXMESAdrawable *) context->base.readPriv;
__GLXMESAscreen *screen = (__GLXMESAscreen *) context->base.pGlxScreen;
const __GLcoreModule *glcore = screen->glcore;
return XMesaMakeCurrent2(context->xmesa,
drawPriv->xm_buf,
@ -189,6 +221,8 @@ static int
__glXMesaContextLoseCurrent(__GLXcontext *baseContext)
{
__GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
__GLXMESAscreen *screen = (__GLXMESAscreen *) context->base.pGlxScreen;
const __GLcoreModule *glcore = screen->glcore;
return XMesaLoseCurrent(context->xmesa);
}
@ -200,6 +234,8 @@ __glXMesaContextCopy(__GLXcontext *baseDst,
{
__GLXMESAcontext *dst = (__GLXMESAcontext *) baseDst;
__GLXMESAcontext *src = (__GLXMESAcontext *) baseSrc;
__GLXMESAscreen *screen = (__GLXMESAscreen *) dst->base.pGlxScreen;
const __GLcoreModule *glcore = screen->glcore;
return XMesaCopyContext(src->xmesa, dst->xmesa, mask);
}
@ -208,6 +244,8 @@ static int
__glXMesaContextForceCurrent(__GLXcontext *baseContext)
{
__GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
__GLXMESAscreen *screen = (__GLXMESAscreen *) context->base.pGlxScreen;
const __GLcoreModule *glcore = screen->glcore;
/* GlxSetRenderTables() call for XGL moved in XMesaForceCurrent() */
@ -219,6 +257,8 @@ __glXMesaScreenCreateContext(__GLXscreen *screen,
__GLXconfig *config,
__GLXcontext *baseShareContext)
{
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
const __GLcoreModule *glcore = mesaScreen->glcore;
__GLXMESAcontext *context;
__GLXMESAcontext *shareContext = (__GLXMESAcontext *) baseShareContext;
XMesaVisual xm_vis;
@ -261,6 +301,7 @@ static void
__glXMesaScreenDestroy(__GLXscreen *screen)
{
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
const __GLcoreModule *glcore = mesaScreen->glcore;
int i;
if (mesaScreen->xm_vis) {
@ -272,6 +313,8 @@ __glXMesaScreenDestroy(__GLXscreen *screen)
xfree(mesaScreen->xm_vis);
}
dlclose(mesaScreen->driver);
__glXScreenDestroy(screen);
xfree(screen);
@ -317,9 +360,10 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
for (back = numBack - 1; back >= 0; back--)
for (depth = 0; depth < numDepth; depth++)
for (stencil = 0; stencil < numStencil; stencil++) {
config->next = xalloc(sizeof *config);
config->next = xcalloc(sizeof(*config), 1);
config = config->next;
config->visualRating = GLX_NONE;
config->visualType = glx_visual_types[visual->class];
config->xRenderable = GL_TRUE;
config->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
@ -372,6 +416,7 @@ createFBConfigs(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
static void
createMesaVisuals(__GLXMESAscreen *pMesaScreen)
{
const __GLcoreModule *glcore = pMesaScreen->glcore;
__GLXconfig *config;
ScreenPtr pScreen;
VisualPtr visual = NULL;
@ -408,15 +453,35 @@ createMesaVisuals(__GLXMESAscreen *pMesaScreen)
}
}
static const char dri_driver_path[] = DRI_DRIVER_PATH;
static __GLXscreen *
__glXMesaScreenProbe(ScreenPtr pScreen)
{
__GLXMESAscreen *screen;
char filename[128];
screen = xalloc(sizeof *screen);
if (screen == NULL)
return NULL;
snprintf(filename, sizeof filename, "%s/%s.so",
dri_driver_path, "libGLcore");
screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
if (screen->driver == NULL) {
LogMessage(X_ERROR, "GLX error: dlopen of %s failed (%s)\n",
filename, dlerror());
goto handle_error;
}
screen->glcore = dlsym(screen->driver, __GL_CORE);
if (screen->glcore == NULL) {
LogMessage(X_ERROR, "GLX error: dlsym for %s failed (%s)\n",
__GL_CORE, dlerror());
goto handle_error;
}
/*
* Find the GLX visuals that are supported by this screen and create
* XMesa's visuals.
@ -431,9 +496,23 @@ __glXMesaScreenProbe(ScreenPtr pScreen)
screen->base.destroy = __glXMesaScreenDestroy;
screen->base.createContext = __glXMesaScreenCreateContext;
screen->base.createDrawable = __glXMesaScreenCreateDrawable;
screen->base.swapInterval = NULL;
screen->base.pScreen = pScreen;
LogMessage(X_INFO, "GLX: Loaded and initialized %s\n", filename);
return &screen->base;
handle_error:
if (screen->driver)
dlclose(screen->driver);
xfree(screen);
FatalError("GLX: could not load software renderer\n");
return NULL;
}
__GLXprovider __glXMesaProvider = {

View file

@ -437,6 +437,7 @@ initGlxVisual(VisualPtr visual, __GLXconfig *config)
typedef struct {
GLboolean doubleBuffer;
GLboolean depthBuffer;
GLboolean stencilBuffer;
} FBConfigTemplateRec, *FBConfigTemplatePtr;
static __GLXconfig *
@ -453,6 +454,8 @@ pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class)
continue;
if ((config->depthBits > 0) != template->depthBuffer)
continue;
if ((config->stencilBits > 0) != template->stencilBuffer)
continue;
return config;
}
@ -466,8 +469,9 @@ addMinimalSet(__GLXscreen *pGlxScreen)
__GLXconfig *config;
VisualPtr visuals;
int i, j;
FBConfigTemplateRec best = { GL_TRUE, GL_TRUE };
FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE };
FBConfigTemplateRec best = { GL_TRUE, GL_TRUE, GL_TRUE };
FBConfigTemplateRec good = { GL_TRUE, GL_TRUE, GL_FALSE };
FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE, GL_FALSE };
pGlxScreen->visuals = xcalloc(pGlxScreen->pScreen->numVisuals,
sizeof (__GLXconfig *));
@ -480,15 +484,18 @@ addMinimalSet(__GLXscreen *pGlxScreen)
for (i = 0, j = 0; i < pGlxScreen->pScreen->numVisuals; i++) {
if (visuals[i].nplanes == 32)
config = pickFBConfig(pGlxScreen, &minimal, visuals[i].class);
else
else {
config = pickFBConfig(pGlxScreen, &best, visuals[i].class);
if (config == NULL)
config = pickFBConfig(pGlxScreen, &good, visuals[i].class);
}
if (config == NULL)
config = pGlxScreen->fbconfigs;
if (config == NULL)
continue;
pGlxScreen->visuals[j] = config;
config->visualID = visuals[j].vid;
config->visualID = visuals[i].vid;
j++;
}

View file

@ -81,38 +81,40 @@ __glXDeassociateContext(__GLXcontext *glxc)
__GLXcontext *curr, *prev;
prev = NULL;
for ( curr = glxc->drawPriv->drawGlxc
; curr != NULL
; prev = curr, curr = curr->nextDrawPriv ) {
if (curr == glxc) {
/* found context. Deassociate. */
if (prev == NULL) {
glxc->drawPriv->drawGlxc = curr->nextDrawPriv;
} else {
prev->nextDrawPriv = curr->nextDrawPriv;
if (glxc->drawPriv) {
for ( curr = glxc->drawPriv->drawGlxc; curr != NULL
; prev = curr, curr = curr->nextDrawPriv ) {
if (curr == glxc) {
/* found context. Deassociate. */
if (prev == NULL) {
glxc->drawPriv->drawGlxc = curr->nextDrawPriv;
} else {
prev->nextDrawPriv = curr->nextDrawPriv;
}
curr->nextDrawPriv = NULL;
__glXUnrefDrawable(glxc->drawPriv);
break;
}
curr->nextDrawPriv = NULL;
__glXUnrefDrawable(glxc->drawPriv);
break;
}
}
}
prev = NULL;
for ( curr = glxc->readPriv->readGlxc
; curr != NULL
; prev = curr, curr = curr->nextReadPriv ) {
if (curr == glxc) {
/* found context. Deassociate. */
if (prev == NULL) {
glxc->readPriv->readGlxc = curr->nextReadPriv;
} else {
prev->nextReadPriv = curr->nextReadPriv;
}
curr->nextReadPriv = NULL;
__glXUnrefDrawable(glxc->readPriv);
break;
}
if (glxc->readPriv) {
for ( curr = glxc->readPriv->readGlxc
; curr != NULL
; prev = curr, curr = curr->nextReadPriv ) {
if (curr == glxc) {
/* found context. Deassociate. */
if (prev == NULL) {
glxc->readPriv->readGlxc = curr->nextReadPriv;
} else {
prev->nextReadPriv = curr->nextReadPriv;
}
curr->nextReadPriv = NULL;
__glXUnrefDrawable(glxc->readPriv);
break;
}
}
}
}

32
GL/mesa/.gitignore vendored
View file

@ -1,32 +0,0 @@
X/drivers
X/glxheader.h
X/xm*.h
X/xm*.c
mesa/drivers
mesa/glxheader.h
mesa/xm*.c
glapi/*.c
glapi/*.h
main/*.c
main/*.h
math/*.c
math/*.h
ppc
shader/*.c
shader/*.h
shader/slang/*.c
shader/slang/*.h
shader/slang/library
shader/grammar/*.c
shader/grammar/*.h
sparc
swrast/*.c
swrast/*.h
swrast_setup/*.c
swrast_setup/*.h
tnl/*.c
tnl/*.h
x86
x86-64
vbo/*.c
vbo/*.h

View file

@ -1,18 +0,0 @@
SUBDIRS = X
SUBDIRS += main math swrast swrast_setup tnl shader glapi vbo
noinst_LTLIBRARIES = libGLcore.la
libGLcore_la_SOURCES = dummy.c
MESA_LIBS = main/libmain.la \
math/libmath.la \
swrast/libswrast.la \
swrast_setup/libss.la \
tnl/libtnl.la \
shader/libshader.la \
shader/grammar/libgrammar.la \
shader/slang/libslang.la \
vbo/libvbo.la
libGLcore_la_LIBADD = $(MESA_LIBS) \
X/libX.la

View file

@ -1,27 +0,0 @@
noinst_LTLIBRARIES = libX.la
INCLUDES = -I@MESA_SOURCE@/include \
-I. \
-I@MESA_SOURCE@/src/mesa/glapi \
-I@MESA_SOURCE@/src/mesa/main \
-I@MESA_SOURCE@/src/mesa
# -DXFree86Server is required because the X11 driver in Mesa thinks that
# symbol means "being built in the server"
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
XM_SOURCES = \
xm_api.c \
xm_buffer.c \
xm_dd.c \
xm_image.c \
xm_line.c \
xm_span.c \
xm_tri.c
XM_SOURCES += drivers/common/driverfuncs.c
nodist_libX_la_SOURCES = $(XM_SOURCES)

View file

View file

@ -1,20 +0,0 @@
noinst_LTLIBRARIES = libglapi.la
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../glapi \
-I../main \
-I../math \
-I../shader \
-I../swrast \
-I../swrast_setup \
-I../tnl \
-I.. \
-I$(top_srcdir)/hw/xfree86/os-support
nodist_libglapi_la_SOURCES = glapi.c glthread.c

View file

@ -1,86 +0,0 @@
noinst_LTLIBRARIES = libmain.la
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../glapi \
-I../main \
-I../math \
-I../shader \
-I../swrast \
-I../swrast_setup \
-I../tnl \
-I.. \
-I$(top_srcdir)/hw/xfree86/os-support
if NEED_VSNPRINTF
VSNPRINTF_SOURCES = vsnprintf.c
endif
nodist_libmain_la_SOURCES = accum.c \
api_arrayelt.c \
api_loopback.c \
api_noop.c \
api_validate.c \
arrayobj.c \
attrib.c \
blend.c \
bufferobj.c \
buffers.c \
clip.c \
colortab.c \
context.c \
convolve.c \
debug.c \
depth.c \
depthstencil.c \
dlist.c \
drawpix.c \
enable.c \
enums.c \
eval.c \
execmem.c \
extensions.c \
fbobject.c \
feedback.c \
fog.c \
framebuffer.c \
get.c \
getstring.c \
hash.c \
hint.c \
histogram.c \
image.c \
imports.c \
light.c \
lines.c \
matrix.c \
mipmap.c \
mm.c \
pixel.c \
points.c \
polygon.c \
queryobj.c \
rastpos.c \
rbadaptors.c \
renderbuffer.c \
shaders.c \
state.c \
stencil.c \
texcompress.c \
texcompress_fxt1.c \
texcompress_s3tc.c \
texenvprogram.c \
texformat.c \
teximage.c \
texobj.c \
texrender.c \
texstate.c \
texstore.c \
varray.c \
$(VSNPRINTF_SOURCES) \
vtxfmt.c

View file

@ -1,27 +0,0 @@
noinst_LTLIBRARIES = libmath.la
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../glapi \
-I../main \
-I../math \
-I../shader \
-I../swrast \
-I../swrast_setup \
-I../tnl \
-I.. \
-I$(top_srcdir)/hw/xfree86/os-support
nodist_libmath_la_SOURCES = m_debug_clip.c \
m_debug_norm.c \
m_debug_xform.c \
m_eval.c \
m_matrix.c \
m_translate.c \
m_vector.c \
m_xform.c

View file

@ -1,39 +0,0 @@
SUBDIRS = grammar slang
noinst_LTLIBRARIES = libshader.la
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../glapi \
-I../main \
-I../math \
-I../shader \
-I../shader/grammar \
-I../shader/slang \
-I../swrast \
-I../swrast_setup \
-I../tnl \
-I.. \
-I$(top_srcdir)/hw/xfree86/os-support
nodist_libshader_la_SOURCES = \
arbprogparse.c \
arbprogram.c \
atifragshader.c \
nvfragparse.c \
nvprogram.c \
nvvertparse.c \
prog_debug.c \
prog_execute.c \
prog_instruction.c \
prog_parameter.c \
prog_print.c \
program.c \
programopt.c \
prog_statevars.c \
shader_api.c

View file

@ -1,20 +0,0 @@
noinst_LTLIBRARIES = libgrammar.la
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
INCLUDES = -I@MESA_SOURCE@/include \
-I../../X \
-I../../glapi \
-I../../main \
-I../../math \
-I../../shader \
-I../../swrast \
-I../../swrast_setup \
-I../../tnl \
-I../.. \
-I$(top_srcdir)/hw/xfree86/os-support
nodist_libgrammar_la_SOURCES = grammar_mesa.c

View file

@ -1,41 +0,0 @@
noinst_LTLIBRARIES = libslang.la
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
INCLUDES = -I@MESA_SOURCE@/include \
-I../grammar \
-I../../X \
-I../../glapi \
-I../../main \
-I../../math \
-I../../shader \
-I../../swrast \
-I../../swrast_setup \
-I../../tnl \
-I../.. \
-I$(top_srcdir)/hw/xfree86/os-support
nodist_libslang_la_SOURCES = slang_builtin.c \
slang_codegen.c \
slang_compile.c \
slang_compile_function.c \
slang_compile_operation.c \
slang_compile_struct.c \
slang_compile_variable.c \
slang_emit.c \
slang_ir.c \
slang_label.c \
slang_library_noise.c \
slang_link.c \
slang_log.c \
slang_mem.c \
slang_preprocess.c \
slang_print.c \
slang_simplify.c \
slang_storage.c \
slang_typeinfo.c \
slang_utility.c \
slang_vartable.c

View file

@ -1,50 +0,0 @@
noinst_LTLIBRARIES = libswrast.la
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../glapi \
-I../main \
-I../math \
-I../shader \
-I../shader/slang \
-I../shader/slang \
-I../swrast \
-I../swrast_setup \
-I../tnl \
-I.. \
-I$(top_srcdir)/hw/xfree86/os-support
nodist_libswrast_la_SOURCES = s_aaline.c \
s_aatriangle.c \
s_accum.c \
s_alpha.c \
s_atifragshader.c \
s_bitmap.c \
s_blend.c \
s_blit.c \
s_buffers.c \
s_context.c \
s_copypix.c \
s_depth.c \
s_drawpix.c \
s_feedback.c \
s_fog.c \
s_fragprog.c \
s_imaging.c \
s_lines.c \
s_logic.c \
s_masking.c \
s_points.c \
s_readpix.c \
s_span.c \
s_stencil.c \
s_texcombine.c \
s_texfilter.c \
s_texstore.c \
s_triangle.c \
s_zoom.c

View file

@ -1,20 +0,0 @@
noinst_LTLIBRARIES = libss.la
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../glapi \
-I../main \
-I../math \
-I../shader \
-I../swrast \
-I../swrast_setup \
-I../tnl \
-I.. \
-I$(top_srcdir)/hw/xfree86/os-support
nodist_libss_la_SOURCES = ss_context.c ss_triangle.c

View file

@ -1,37 +0,0 @@
noinst_LTLIBRARIES = libtnl.la
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../glapi \
-I../main \
-I../math \
-I../shader \
-I../shader/slang \
-I../swrast \
-I../swrast_setup \
-I../tnl \
-I.. \
-I$(top_srcdir)/hw/xfree86/os-support
nodist_libtnl_la_SOURCES = t_context.c \
t_draw.c \
t_pipeline.c \
t_vb_cull.c \
t_vb_fog.c \
t_vb_light.c \
t_vb_normals.c \
t_vb_points.c \
t_vb_program.c \
t_vb_render.c \
t_vb_texgen.c \
t_vb_texmat.c \
t_vb_vertex.c \
t_vertex.c \
t_vertex_generic.c \
t_vertex_sse.c \
t_vp_build.c

View file

@ -1,35 +0,0 @@
noinst_LTLIBRARIES = libvbo.la
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../glapi \
-I../main \
-I../math \
-I../shader \
-I../shader/slang \
-I../shader/slang \
-I../swrast \
-I../swrast_setup \
-I../tnl \
-I.. \
-I$(top_srcdir)/hw/xfree86/os-support
nodist_libvbo_la_SOURCES = vbo_context.c \
vbo_exec_api.c \
vbo_exec_array.c \
vbo_exec.c \
vbo_exec_draw.c \
vbo_exec_eval.c \
vbo_rebase.c \
vbo_save_api.c \
vbo_save.c \
vbo_save_draw.c \
vbo_save_loopback.c \
vbo_split.c \
vbo_split_copy.c \
vbo_split_inplace.c

View file

@ -58,175 +58,14 @@ main() {
## actual symlinking
symlink_mesa_glapi() {
src_dir src/mesa/glapi
dst_dir mesa/glapi
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_main() {
src_dir src/mesa/main
dst_dir mesa/main
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_math() {
src_dir src/mesa/math
dst_dir mesa/math
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_swrast() {
src_dir src/mesa/swrast
dst_dir mesa/swrast
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_ss() {
src_dir src/mesa/swrast_setup
dst_dir mesa/swrast_setup
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_tnl() {
src_dir src/mesa/tnl
dst_dir mesa/tnl
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_shader() {
src_dir src/mesa/shader
dst_dir mesa/shader
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_shader_grammar() {
src_dir src/mesa/shader/grammar
dst_dir mesa/shader/grammar
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_shader_slang() {
src_dir src/mesa/shader/slang
dst_dir mesa/shader/slang
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_shader_slang_library() {
src_dir src/mesa/shader/slang/library
dst_dir mesa/shader/slang/library
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_vbo() {
src_dir src/mesa/vbo
dst_dir mesa/vbo
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_x() {
src_dir src/mesa/drivers/x11
dst_dir mesa/X
# action glxapi.h
action glxheader.h
# action realglx.h
# action xfonts.h
action xm_api.c
action xm_buffer.c
action xm_dd.c
action xm_image.c
action xm_image.h
action xm_line.c
action xm_span.c
action xm_tri.c
action xmesaP.h
# another hack
src_dir src/mesa/drivers/common
dst_dir mesa/X/drivers/common
action driverfuncs.c
action driverfuncs.h
}
symlink_mesa_ppc() {
src_dir src/mesa/ppc
dst_dir mesa/ppc
}
symlink_mesa_sparc() {
src_dir src/mesa/sparc
dst_dir mesa/sparc
}
symlink_mesa_x86() {
src_dir src/mesa/x86
dst_dir mesa/x86
}
symlink_mesa_x8664() {
src_dir src/mesa/x86-64
dst_dir mesa/x86-64
}
symlink_mesa() {
symlink_mesa_main
symlink_mesa_math
symlink_mesa_swrast
symlink_mesa_ss
symlink_mesa_tnl
symlink_mesa_shader
symlink_mesa_shader_grammar
symlink_mesa_shader_slang
symlink_mesa_shader_slang_library
symlink_mesa_x
symlink_mesa_glapi
symlink_mesa_ppc
symlink_mesa_sparc
symlink_mesa_vbo
symlink_mesa_x86
symlink_mesa_x8664
}
symlink_glx() {
# this is... unpleasant
src_dir src/glx/x11
dst_dir glx
action indirect_size.h
action glcontextmodes.c
action glcontextmodes.h
action indirect_dispatch.c
action indirect_dispatch.h
action indirect_dispatch_swap.c
@ -267,7 +106,6 @@ run() {
# $1 what to do
# $2 explanation
ACTION=$1 EXPLANATION=$2 run_module mesa
ACTION=$1 EXPLANATION=$2 run_module glx
}

View file

@ -1,200 +0,0 @@
/************************************************************
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, 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 Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS 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 <X11/X.h>
#include <X11/Xproto.h>
#include "dixstruct.h"
#include "extnsionst.h"
#include "dix.h"
#define _XEVI_SERVER_
#include <X11/extensions/XEVIstr.h>
#include "EVIstruct.h"
#include "modinit.h"
#include "scrnintstr.h"
static EviPrivPtr eviPriv;
static int
ProcEVIQueryVersion(ClientPtr client)
{
/* REQUEST(xEVIQueryVersionReq); */
xEVIQueryVersionReply rep;
register int n;
REQUEST_SIZE_MATCH (xEVIQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XEVI_MAJOR_VERSION;
rep.minorVersion = XEVI_MAJOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.majorVersion, n);
swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof (xEVIQueryVersionReply), (char *)&rep);
return (client->noClientException);
}
#define swapEviInfo(eviInfo, l) \
{ \
int l1 = l; \
xExtendedVisualInfo *eviInfo1 = eviInfo; \
while (l1-- > 0) { \
swapl(&eviInfo1->core_visual_id, n); \
swapl(&eviInfo1->transparency_value, n); \
swaps(&eviInfo1->num_colormap_conflicts, n); \
eviInfo1++; \
} \
}
#define swapVisual(visual, l) \
{ \
int l1 = l; \
VisualID32 *visual1 = visual; \
while (l1-- > 0) { \
swapl(visual1, n); \
visual1++; \
} \
}
static int
ProcEVIGetVisualInfo(ClientPtr client)
{
REQUEST(xEVIGetVisualInfoReq);
xEVIGetVisualInfoReply rep;
int i, n, n_conflict, n_info, sz_info, sz_conflict;
VisualID32 *conflict;
unsigned int total_visuals = 0;
xExtendedVisualInfo *eviInfo;
int status;
/*
* do this first, otherwise REQUEST_FIXED_SIZE can overflow. we assume
* here that you don't have more than 2^32 visuals over all your screens;
* this seems like a safe assumption.
*/
for (i = 0; i < screenInfo.numScreens; i++)
total_visuals += screenInfo.screens[i]->numVisuals;
if (stuff->n_visual > total_visuals)
return BadValue;
REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
&eviInfo, &n_info, &conflict, &n_conflict);
if (status != Success)
return status;
sz_info = n_info * sz_xExtendedVisualInfo;
sz_conflict = n_conflict * sz_VisualID32;
rep.type = X_Reply;
rep.n_info = n_info;
rep.n_conflicts = n_conflict;
rep.sequenceNumber = client->sequence;
rep.length = (sz_info + sz_conflict) >> 2;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.n_info, n);
swapl(&rep.n_conflicts, n);
swapEviInfo(eviInfo, n_info);
swapVisual(conflict, n_conflict);
}
WriteToClient(client, sz_xEVIGetVisualInfoReply, (char *)&rep);
WriteToClient(client, sz_info, (char *)eviInfo);
WriteToClient(client, sz_conflict, (char *)conflict);
eviPriv->freeVisualInfo(eviInfo, conflict);
return (client->noClientException);
}
static int
ProcEVIDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_EVIQueryVersion:
return ProcEVIQueryVersion (client);
case X_EVIGetVisualInfo:
return ProcEVIGetVisualInfo (client);
default:
return BadRequest;
}
}
static int
SProcEVIQueryVersion(ClientPtr client)
{
REQUEST(xEVIQueryVersionReq);
int n;
swaps(&stuff->length, n);
return ProcEVIQueryVersion(client);
}
static int
SProcEVIGetVisualInfo(ClientPtr client)
{
register int n;
REQUEST(xEVIGetVisualInfoReq);
swaps(&stuff->length, n);
return ProcEVIGetVisualInfo(client);
}
static int
SProcEVIDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
case X_EVIQueryVersion:
return SProcEVIQueryVersion (client);
case X_EVIGetVisualInfo:
return SProcEVIGetVisualInfo (client);
default:
return BadRequest;
}
}
/*ARGSUSED*/
static void
EVIResetProc(ExtensionEntry *extEntry)
{
eviDDXReset();
}
/****************
* XEVIExtensionInit
*
* Called from InitExtensions in main() or from QueryExtension() if the
* extension is dynamically loaded.
*
****************/
void
EVIExtensionInit(INITARGS)
{
if (AddExtension(EVINAME, 0, 0,
ProcEVIDispatch, SProcEVIDispatch,
EVIResetProc, StandardMinorOpcode)) {
eviPriv = eviDDXInit();
}
}

View file

@ -1,58 +0,0 @@
/************************************************************
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, 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 Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS 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
#ifndef EVI_STRUCT_H
#define EVI_STRUCT_H
/*
******************************************************************************
** Per-ddx data
******************************************************************************
*/
typedef int (*GetVisualInfoProc)(
VisualID32*,
int,
xExtendedVisualInfo**,
int*,
VisualID32**,
int*
);
typedef void (*FreeVisualInfoProc)(
xExtendedVisualInfo*,
VisualID32*
);
typedef struct _EviPrivRec {
GetVisualInfoProc getVisualInfo;
FreeVisualInfoProc freeVisualInfo;
} EviPrivRec, *EviPrivPtr;
extern EviPrivPtr eviDDXInit(void);
extern void eviDDXReset(void);
#endif /* EVI_STRUCT_H */

View file

@ -28,7 +28,6 @@ BUILTIN_SRCS = \
# Sources always included in libXextmodule.la & libXext.la
MODULE_SRCS = \
bigreq.c \
mitmisc.c \
shape.c \
sync.c \
xcmisc.c
@ -105,25 +104,6 @@ if XPRINT
BUILTIN_SRCS += $(XPRINT_SRCS)
endif
# AppGroup
APPGROUP_SRCS = appgroup.c appgroup.h
if APPGROUP
BUILTIN_SRCS += $(APPGROUP_SRCS)
endif
# Colormap Utilization Protocol: Less flashing when switching between
# PsuedoColor apps and better sharing of limited colormap slots
CUP_SRCS = cup.c
if CUP
MODULE_SRCS += $(CUP_SRCS)
endif
# Extended Visual Information
EVI_SRCS = EVI.c sampleEVI.c EVIstruct.h
if EVI
MODULE_SRCS += $(EVI_SRCS)
endif
# Multi-buffering extension
MULTIBUFFER_SRCS = mbuf.c
EXTRA_MULTIBUFFER_SRCS = mbufbf.c mbufpx.c
@ -170,9 +150,6 @@ EXTRA_DIST = \
$(XINERAMA_SRCS) \
$(XEVIE_SRCS) \
$(XPRINT_SRCS) \
$(APPGROUP_SRCS) \
$(CUP_SRCS) \
$(EVI_SRCS) \
$(MULTIBUFFER_SRCS) \
$(EXTRA_MULTIBUFFER_SRCS) \
$(FONTCACHE_SRCS) \

View file

@ -1,775 +0,0 @@
/*
Copyright 1996, 1998, 2001 The Open Group
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.
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 OPEN GROUP 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 Open Group 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 Open Group.
*/
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "colormapst.h"
#include "servermd.h"
#define _XAG_SERVER_
#include <X11/extensions/Xagstr.h>
#include "xacestr.h"
#include "securitysrv.h"
#include <X11/Xfuncproto.h>
#define XSERV_t
#include <X11/Xtrans/Xtrans.h>
#include "../os/osdep.h"
#include <stdio.h>
#include "modinit.h"
#include "appgroup.h"
typedef struct _AppGroupRec {
struct _AppGroupRec* next;
XID appgroupId;
ClientPtr* clients;
int nclients;
ClientPtr leader;
Bool single_screen;
Window default_root;
VisualID root_visual;
Colormap default_colormap;
Pixel black_pixel;
Pixel white_pixel;
xConnSetupPrefix connSetupPrefix;
char* ConnectionInfo;
} AppGroupRec, *AppGroupPtr;
static int ProcXagDispatch(ClientPtr client);
static int SProcXagDispatch(ClientPtr client);
static void XagResetProc(ExtensionEntry* extEntry);
static int XagCallbackRefCount = 0;
static RESTYPE RT_APPGROUP;
static AppGroupPtr appGrpList = NULL;
extern xConnSetupPrefix connSetupPrefix;
extern char* ConnectionInfo;
extern int connBlockScreenStart;
static
int XagAppGroupFree(
pointer what,
XID id) /* unused */
{
int i;
AppGroupPtr pAppGrp = (AppGroupPtr) what;
if (pAppGrp->leader)
for (i = 0; i < pAppGrp->nclients; i++) {
if (pAppGrp->clients[i] == NULL) continue;
CloseDownClient (pAppGrp->clients[i]);
}
if (pAppGrp == appGrpList)
appGrpList = appGrpList->next;
else {
AppGroupPtr tpAppGrp;
for (tpAppGrp = appGrpList;
tpAppGrp->next != NULL;
tpAppGrp = tpAppGrp->next) {
if (tpAppGrp->next == pAppGrp) {
tpAppGrp->next = tpAppGrp->next->next;
break;
}
}
}
(void) xfree (pAppGrp->clients);
(void) xfree (pAppGrp->ConnectionInfo);
(void) xfree (what);
return Success;
}
static void XagClientStateChange(
CallbackListPtr* pcbl,
pointer nulldata,
pointer calldata)
{
NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
ClientPtr pClient = pci->client;
AppGroupPtr pAppGrp = pClient->appgroup;
int slot;
if (!pAppGrp)
return;
switch (pClient->clientState) {
case ClientStateAuthenticating:
case ClientStateRunning:
case ClientStateCheckingSecurity:
break;
case ClientStateInitial:
case ClientStateCheckedSecurity:
slot = -1;
/* see the comment above about Initial vs. CheckedSecurity */
if (pAppGrp->nclients != 0) {
/* if this client already in AppGroup, don't add it again */
int i;
for (i = 0; i < pAppGrp->nclients; i++)
if (pClient == pAppGrp->clients[i]) return;
if (slot == -1 && pAppGrp->clients[i] == NULL)
slot = i;
}
if (slot == -1) {
slot = pAppGrp->nclients++;
pAppGrp->clients = (ClientPtr*) xrealloc (pAppGrp->clients,
pAppGrp->nclients * sizeof (ClientPtr));
}
pAppGrp->clients[slot] = pClient;
pClient->appgroup = pAppGrp;
break;
case ClientStateGone:
case ClientStateRetained: /* client disconnected, dump it */
{
int i;
for (i = 0; i < pAppGrp->nclients; i++)
if (pAppGrp->clients[i] == pClient) {
pAppGrp->clients[i] = NULL;
break;
}
}
pClient->appgroup = NULL; /* redundant, pClient will be freed */
break;
}
}
/*ARGSUSED*/
static
void XagResetProc(
ExtensionEntry* extEntry)
{
DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);
XagCallbackRefCount = 0;
while (appGrpList) XagAppGroupFree ((pointer) appGrpList, 0);
}
static
int ProcXagQueryVersion(
register ClientPtr client)
{
/* REQUEST (xXagQueryVersionReq); */
xXagQueryVersionReply rep;
register int n;
REQUEST_SIZE_MATCH (xXagQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
rep.server_major_version = XAG_MAJOR_VERSION;
rep.server_minor_version = XAG_MINOR_VERSION;
if (client->swapped) {
swaps (&rep.sequence_number, n);
swapl (&rep.length, n);
swaps (&rep.server_major_version, n);
swaps (&rep.server_minor_version, n);
}
WriteToClient (client, sizeof (xXagQueryVersionReply), (char *)&rep);
return client->noClientException;
}
static
void ProcessAttr(
AppGroupPtr pAppGrp,
ClientPtr client,
unsigned int attrib_mask,
CARD32* attribs)
{
int i;
for (i = 0; i <= XagNappGroupLeader; i++) {
switch (attrib_mask & (1 << i)) {
case XagSingleScreenMask:
pAppGrp->single_screen = *attribs;
break;
case XagDefaultRootMask:
pAppGrp->default_root = *attribs;
break;
case XagRootVisualMask:
pAppGrp->root_visual = *attribs;
break;
case XagDefaultColormapMask:
pAppGrp->default_colormap = *attribs;
break;
case XagBlackPixelMask:
pAppGrp->black_pixel = *attribs;
break;
case XagWhitePixelMask:
pAppGrp->white_pixel = *attribs;
break;
case XagAppGroupLeaderMask:
pAppGrp->leader = client;
break;
default: continue;
}
attribs++;
}
}
static
void CreateConnectionInfo(
AppGroupPtr pAppGrp)
{
xWindowRoot* rootp;
xWindowRoot* roots[MAXSCREENS];
unsigned int rootlens[MAXSCREENS];
xDepth* depth;
int olen;
int snum, i;
rootp = (xWindowRoot*) (ConnectionInfo + connBlockScreenStart);
for (snum = 0; snum < screenInfo.numScreens; snum++) {
rootlens[snum] = sizeof (xWindowRoot);
roots[snum] = rootp;
depth = (xDepth*) (rootp + 1);
for (i = 0; i < rootp->nDepths; i++) {
rootlens[snum] += sizeof (xDepth) +
depth->nVisuals * sizeof (xVisualType);
depth = (xDepth *)(((char*)(depth + 1)) +
depth->nVisuals * sizeof (xVisualType));
}
rootp = (xWindowRoot*) depth;
}
snum = 0;
if (pAppGrp->default_root) {
for (; snum < screenInfo.numVideoScreens; snum++) {
if (roots[snum]->windowId == pAppGrp->default_root)
break;
}
}
olen = connBlockScreenStart + rootlens[snum];
for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++)
olen += rootlens[i];
pAppGrp->ConnectionInfo = (char*) xalloc (olen);
if (!pAppGrp->ConnectionInfo)
return;
memmove (pAppGrp->ConnectionInfo, ConnectionInfo, connBlockScreenStart);
((xConnSetup*) (pAppGrp->ConnectionInfo))->numRoots =
1 + screenInfo.numScreens - screenInfo.numVideoScreens;
memmove (pAppGrp->ConnectionInfo + connBlockScreenStart,
(void*) roots[snum], rootlens[snum]);
rootp = (xWindowRoot*) (pAppGrp->ConnectionInfo + connBlockScreenStart);
if (pAppGrp->default_colormap) {
rootp->defaultColormap = pAppGrp->default_colormap;
rootp->whitePixel = pAppGrp->white_pixel;
rootp->blackPixel = pAppGrp->black_pixel;
}
if (pAppGrp->root_visual)
rootp->rootVisualID = pAppGrp->root_visual;
rootp = (xWindowRoot*) (((char*)rootp) + rootlens[snum]);
for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++) {
memmove ((void*) rootp, (void*) roots[i], rootlens[i]);
rootp = (xWindowRoot*) (((char*) rootp) + rootlens[i]);
}
pAppGrp->connSetupPrefix = connSetupPrefix;
pAppGrp->connSetupPrefix.length = olen >> 2;
}
static
AppGroupPtr CreateAppGroup(
ClientPtr client,
XID appgroupId,
unsigned int attrib_mask,
CARD32* attribs)
{
AppGroupPtr pAppGrp;
pAppGrp = (AppGroupPtr) xalloc (sizeof(AppGroupRec));
if (pAppGrp) {
pAppGrp->next = appGrpList;
appGrpList = pAppGrp;
pAppGrp->appgroupId = appgroupId;
pAppGrp->clients = (ClientPtr*) xalloc (0);
pAppGrp->nclients = 0;
pAppGrp->leader = NULL;
pAppGrp->default_root = 0;
pAppGrp->root_visual = 0;
pAppGrp->default_colormap = 0;
pAppGrp->black_pixel = -1;
pAppGrp->white_pixel = -1;
pAppGrp->ConnectionInfo = NULL;
ProcessAttr (pAppGrp, client, attrib_mask, attribs);
}
return pAppGrp;
}
static
int AttrValidate(
ClientPtr client,
int attrib_mask,
AppGroupPtr pAppGrp)
{
WindowPtr pWin;
int idepth, ivids, found, rc;
ScreenPtr pScreen;
DepthPtr pDepth;
ColormapPtr pColormap;
rc = dixLookupWindow(&pWin, pAppGrp->default_root, client,
DixGetAttrAccess);
if (rc != Success)
return rc;
pScreen = pWin->drawable.pScreen;
if (WindowTable[pScreen->myNum]->drawable.id != pAppGrp->default_root)
return BadWindow;
pDepth = pScreen->allowedDepths;
if (pAppGrp->root_visual) {
found = FALSE;
for (idepth = 0; idepth < pScreen->numDepths; idepth++, pDepth++) {
for (ivids = 0; ivids < pDepth->numVids; ivids++) {
if (pAppGrp->root_visual == pDepth->vids[ivids]) {
found = TRUE;
break;
}
}
}
if (!found)
return BadMatch;
}
if (pAppGrp->default_colormap) {
rc = dixLookupResource((pointer *)&pColormap, pAppGrp->default_colormap,
RT_COLORMAP, client, DixUseAccess);
if (rc != Success)
return rc;
if (pColormap->pScreen != pScreen)
return BadColor;
if (pColormap->pVisual->vid != (pAppGrp->root_visual ? pAppGrp->root_visual : pScreen->rootVisual))
return BadMatch;
}
return client->noClientException;
}
static int ProcXagCreate (
register ClientPtr client)
{
REQUEST (xXagCreateReq);
AppGroupPtr pAppGrp;
int ret;
REQUEST_AT_LEAST_SIZE (xXagCreateReq);
LEGAL_NEW_RESOURCE (stuff->app_group, client);
pAppGrp = CreateAppGroup (client, stuff->app_group,
stuff->attrib_mask, (CARD32*) &stuff[1]);
if (!pAppGrp)
return BadAlloc;
ret = AttrValidate (client, stuff->attrib_mask, pAppGrp);
if (ret != Success) {
XagAppGroupFree ((pointer)pAppGrp, (XID)0);
return ret;
}
if (pAppGrp->single_screen) {
CreateConnectionInfo (pAppGrp);
if (!pAppGrp->ConnectionInfo)
return BadAlloc;
}
if (!AddResource (stuff->app_group, RT_APPGROUP, (pointer)pAppGrp))
return BadAlloc;
if (XagCallbackRefCount++ == 0)
(void) AddCallback (&ClientStateCallback, XagClientStateChange, NULL);
return client->noClientException;
}
static int ProcXagDestroy(
register ClientPtr client)
{
AppGroupPtr pAppGrp;
REQUEST (xXagDestroyReq);
REQUEST_SIZE_MATCH (xXagDestroyReq);
pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
(XID)stuff->app_group, RT_APPGROUP, DixReadAccess);
if (!pAppGrp) return XagBadAppGroup;
FreeResource ((XID)stuff->app_group, RT_NONE);
if (--XagCallbackRefCount == 0)
(void) DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);
return client->noClientException;
}
static
int ProcXagGetAttr(
register ClientPtr client)
{
AppGroupPtr pAppGrp;
REQUEST (xXagGetAttrReq);
xXagGetAttrReply rep;
int n;
REQUEST_SIZE_MATCH (xXagGetAttrReq);
pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
(XID)stuff->app_group, RT_APPGROUP, DixReadAccess);
if (!pAppGrp) return XagBadAppGroup;
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
rep.default_root = pAppGrp->default_root;
rep.root_visual = pAppGrp->root_visual;
rep.default_colormap = pAppGrp->default_colormap;
rep.black_pixel = pAppGrp->black_pixel;
rep.white_pixel = pAppGrp->white_pixel;
rep.single_screen = pAppGrp->single_screen;
rep.app_group_leader = (pAppGrp->leader) ? 1 : 0;
if (client->swapped) {
swaps (&rep.sequence_number, n);
swapl (&rep.length, n);
swapl (&rep.default_root, n);
swapl (&rep.root_visual, n);
swapl (&rep.default_colormap, n);
swapl (&rep.black_pixel, n);
swapl (&rep.white_pixel, n);
}
WriteToClient (client, sizeof (xXagGetAttrReply), (char *)&rep);
return client->noClientException;
}
static
int ProcXagQuery(
register ClientPtr client)
{
ClientPtr pClient;
AppGroupPtr pAppGrp;
REQUEST (xXagQueryReq);
int n, rc;
REQUEST_SIZE_MATCH (xXagQueryReq);
rc = dixLookupClient(&pClient, stuff->resource, client, DixGetAttrAccess);
if (rc != Success)
return rc;
for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
for (n = 0; n < pAppGrp->nclients; n++)
if (pAppGrp->clients[n] == pClient) {
xXagQueryReply rep;
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
rep.app_group = pAppGrp->appgroupId;
if (client->swapped) {
swaps (&rep.sequence_number, n);
swapl (&rep.length, n);
swapl (&rep.app_group, n);
}
WriteToClient (client, sizeof (xXagQueryReply), (char *)&rep);
return client->noClientException;
}
return BadMatch;
}
static
int ProcXagCreateAssoc(
register ClientPtr client)
{
REQUEST (xXagCreateAssocReq);
REQUEST_SIZE_MATCH (xXagCreateAssocReq);
#ifdef WIN32
if (stuff->window_type != XagWindowTypeWin32)
#else
if (stuff->window_type != XagWindowTypeX11)
#endif
return BadMatch;
#if defined(WIN32) || defined(__CYGWIN__) /* and Mac, etc */
if (!LocalClient (client))
return BadAccess;
#endif
/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
return client->noClientException;
}
static
int ProcXagDestroyAssoc(
register ClientPtr client)
{
/* REQUEST (xXagDestroyAssocReq); */
REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
return client->noClientException;
}
static
int ProcXagDispatch (
register ClientPtr client)
{
REQUEST (xReq);
switch (stuff->data)
{
case X_XagQueryVersion:
return ProcXagQueryVersion (client);
case X_XagCreate:
return ProcXagCreate (client);
case X_XagDestroy:
return ProcXagDestroy (client);
case X_XagGetAttr:
return ProcXagGetAttr (client);
case X_XagQuery:
return ProcXagQuery (client);
case X_XagCreateAssoc:
return ProcXagCreateAssoc (client);
case X_XagDestroyAssoc:
return ProcXagDestroyAssoc (client);
default:
return BadRequest;
}
}
static
int SProcXagQueryVersion(
register ClientPtr client)
{
register int n;
REQUEST(xXagQueryVersionReq);
swaps(&stuff->length, n);
return ProcXagQueryVersion(client);
}
static
int SProcXagCreate(
ClientPtr client)
{
register int n;
REQUEST (xXagCreateReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xXagCreateReq);
swapl (&stuff->app_group, n);
swapl (&stuff->attrib_mask, n);
SwapRestL (stuff);
return ProcXagCreate (client);
}
static
int SProcXagDestroy(
ClientPtr client)
{
register int n;
REQUEST (xXagDestroyReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xXagDestroyReq);
swapl (&stuff->app_group, n);
return ProcXagDestroy (client);
}
static
int SProcXagGetAttr(
ClientPtr client)
{
register int n;
REQUEST (xXagGetAttrReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xXagGetAttrReq);
swapl (&stuff->app_group, n);
return ProcXagGetAttr (client);
}
static
int SProcXagQuery(
ClientPtr client)
{
register int n;
REQUEST (xXagQueryReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xXagQueryReq);
swapl (&stuff->resource, n);
return ProcXagQuery (client);
}
static
int SProcXagCreateAssoc(
ClientPtr client)
{
register int n;
REQUEST (xXagCreateAssocReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xXagCreateAssocReq);
swapl (&stuff->window, n);
swapl (&stuff->window_type, n);
swaps (&stuff->system_window_len, n);
return ProcXagCreateAssoc (client);
}
static
int SProcXagDestroyAssoc(
ClientPtr client)
{
register int n;
REQUEST (xXagDestroyAssocReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
swapl (&stuff->window, n);
return ProcXagDestroyAssoc (client);
}
static
int SProcXagDispatch(
register ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XagQueryVersion:
return SProcXagQueryVersion (client);
case X_XagCreate:
return SProcXagCreate (client);
case X_XagDestroy:
return SProcXagDestroy (client);
case X_XagGetAttr:
return SProcXagGetAttr (client);
case X_XagQuery:
return SProcXagQuery (client);
case X_XagCreateAssoc:
return SProcXagCreateAssoc (client);
case X_XagDestroyAssoc:
return SProcXagDestroyAssoc (client);
default:
return BadRequest;
}
}
Colormap XagDefaultColormap(
ClientPtr client)
{
return (client->appgroup ? client->appgroup->default_colormap : None);
}
VisualID XagRootVisual(
ClientPtr client)
{
return (client->appgroup ? client->appgroup->root_visual : 0);
}
ClientPtr XagLeader(
ClientPtr client)
{
return (client->appgroup ? client->appgroup->leader : NULL);
}
/*
* Return whether the Map request event should be sent to the appgroup leader.
* We don't want to send it to the leader when the window is on a different
* screen, e.g. a print screen.
*/
Bool XagIsControlledRoot(
ClientPtr client,
WindowPtr pParent)
{
if (client->appgroup) {
if (client->appgroup->single_screen &&
pParent->drawable.id == client->appgroup->default_root)
return TRUE;
else if (!pParent->parent)
return TRUE;
else
return FALSE;
}
return FALSE;
}
void XagConnectionInfo(
ClientPtr client,
xConnSetupPrefix** conn_prefix,
char** conn_info,
int* num_screen)
{
if (client->appgroup && client->appgroup->ConnectionInfo) {
*conn_prefix = &client->appgroup->connSetupPrefix;
*conn_info = client->appgroup->ConnectionInfo;
*num_screen = ((xConnSetup*)(client->appgroup->ConnectionInfo))->numRoots;
}
}
XID XagId(
ClientPtr client)
{
return (client->appgroup ? client->appgroup->appgroupId : 0);
}
static void XagCallClientStateChange(
CallbackListPtr *pcbl,
pointer nulldata,
pointer calldata)
{
XaceAuthAvailRec* rec = (XaceAuthAvailRec*) calldata;
ClientPtr pClient = rec->client;
if (!pClient->appgroup) {
SecurityAuthorizationPtr pAuth;
XID authId = rec->authId;
/* can't use SecurityLookupIDByType here -- client
* security state hasn't been setup yet.
*/
pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
SecurityAuthorizationResType);
if (!pAuth)
return;
pClient->appgroup = (AppGroupPtr)LookupIDByType(pAuth->group,
RT_APPGROUP);
}
if (pClient->appgroup) {
NewClientInfoRec clientinfo;
clientinfo.client = pClient;
XagClientStateChange (NULL, NULL, (pointer)&clientinfo);
}
}
void
XagExtensionInit(INITARGS)
{
if (AddExtension (XAGNAME,
0,
XagNumberErrors,
ProcXagDispatch,
SProcXagDispatch,
XagResetProc,
StandardMinorOpcode)) {
RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
XaceRegisterCallback(XACE_AUTH_AVAIL, XagCallClientStateChange, NULL);
}
}

View file

@ -1,67 +0,0 @@
/*
Copyright 1996, 1998 The Open Group
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.
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 OPEN GROUP 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 Open Group 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 Open Group.
*/
#ifndef _APPGROUP_SRV_H_
#define _APPGROUP_SRV_H_
#include <X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
extern void XagConnectionInfo(
ClientPtr /* client */,
xConnSetupPrefix** /* conn_prefix */,
char** /* conn_info */,
int* /* num_screens */
);
extern VisualID XagRootVisual(
ClientPtr /* client */
);
extern Colormap XagDefaultColormap(
ClientPtr /* client */
);
extern ClientPtr XagLeader(
ClientPtr /* client */
);
extern Bool XagIsControlledRoot (
ClientPtr /* client */,
WindowPtr /* pParent */
);
extern XID XagId (
ClientPtr /* client */
);
_XFUNCPROTOEND
#endif /* _APPGROUP_SRV_H_ */

View file

@ -1,342 +0,0 @@
/*
Copyright 1997, 1998 The Open Group
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.
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
OPEN GROUP 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 Open Group 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 Open Group.
*/
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "colormapst.h"
#include "scrnintstr.h"
#include "servermd.h"
#include "swapreq.h"
#define _XCUP_SERVER_
#include <X11/extensions/Xcupstr.h>
#include <X11/Xfuncproto.h>
#include "../os/osdep.h"
#include "modinit.h"
static int ProcDispatch(ClientPtr client);
static int SProcDispatch(ClientPtr client);
static void ResetProc(ExtensionEntry* extEntry);
#if defined(WIN32) || defined(TESTWIN32)
#define HAVE_SPECIAL_DESKTOP_COLORS
#endif
static xColorItem citems[] = {
#ifndef HAVE_SPECIAL_DESKTOP_COLORS
#define CUP_BLACK_PIXEL 0
#define CUP_WHITE_PIXEL 1
/* pix red green blue */
{ 0, 0, 0, 0, 0, 0 },
{ 1, 0xffff, 0xffff, 0xffff, 0, 0 }
#else
#ifndef WIN32
/*
This approximates the MS-Windows desktop colormap for testing
purposes but has black and white pixels in the typical Unix
locations, which should be switched if necessary if your system
has blackPixel and whitePixel swapped. No entries are provided
for colormap entries 254 and 255 because AllocColor/FindColor
will reuse entries zero and one.
*/
{ 0, 0, 0, 0, 0, 0 },
{ 1, 0xffff, 0xffff, 0xffff, 0, 0 },
{ 2, 0x8000, 0, 0, 0, 0 },
{ 3, 0, 0x8000, 0, 0, 0 },
{ 4, 0x8000, 0x8000, 0, 0, 0 },
{ 5, 0, 0, 0x8000, 0, 0 },
{ 6, 0x8000, 0, 0x8000, 0, 0 },
{ 7, 0, 0x8000, 0x8000, 0, 0 },
{ 8, 0xc000, 0xc000, 0xc000, 0, 0 },
{ 9, 0xc000, 0xdc00, 0xc000, 0, 0 },
{ 246, 0xa000, 0xa000, 0xa000, 0, 0 },
{ 247, 0x8000, 0x8000, 0x8000, 0, 0 },
{ 248, 0xffff, 0, 0, 0, 0 },
{ 249, 0, 0xffff, 0, 0, 0 },
{ 250, 0xffff, 0xffff, 0, 0, 0 },
{ 251, 0, 0, 0xffff, 0, 0 },
{ 252, 0xffff, 0, 0xffff, 0, 0 },
{ 253, 0, 0xffff, 0xffff, 0, 0 }
#else
/*
this is the MS-Windows desktop, adjusted for X's 16-bit color
specifications.
*/
{ 0, 0, 0, 0, 0, 0 },
{ 1, 0x8000, 0, 0, 0, 0 },
{ 2, 0, 0x8000, 0, 0, 0 },
{ 3, 0x8000, 0x8000, 0, 0, 0 },
{ 4, 0, 0, 0x8000, 0, 0 },
{ 5, 0x8000, 0, 0x8000, 0, 0 },
{ 6, 0, 0x8000, 0x8000, 0, 0 },
{ 7, 0xc000, 0xc000, 0xc000, 0, 0 },
{ 8, 0xc000, 0xdc00, 0xc000, 0, 0 },
{ 9, 0xa600, 0xca00, 0xf000, 0, 0 },
{ 246, 0xff00, 0xfb00, 0xf000, 0, 0 },
{ 247, 0xa000, 0xa000, 0xa400, 0, 0 },
{ 248, 0x8000, 0x8000, 0x8000, 0, 0 },
{ 249, 0xff00, 0, 0, 0, 0 },
{ 250, 0, 0xff00, 0, 0, 0 },
{ 251, 0xff00, 0xff00, 0, 0, 0 },
{ 252, 0, 0, 0xff00, 0, 0 },
{ 253, 0xff00, 0, 0xff00, 0, 0 },
{ 254, 0, 0xff00, 0xff00, 0, 0 },
{ 255, 0xff00, 0xff00, 0xff00, 0, 0 }
#endif
#endif
};
#define NUM_DESKTOP_COLORS (sizeof citems / sizeof citems[0])
void
XcupExtensionInit (INITARGS)
{
(void) AddExtension (XCUPNAME,
0,
XcupNumberErrors,
ProcDispatch,
SProcDispatch,
ResetProc,
StandardMinorOpcode);
/* PC servers initialize the desktop colors (citems) here! */
}
/*ARGSUSED*/
static
void ResetProc(
ExtensionEntry* extEntry)
{
}
static
int ProcQueryVersion(
register ClientPtr client)
{
/* REQUEST (xXcupQueryVersionReq); */
xXcupQueryVersionReply rep;
register int n;
REQUEST_SIZE_MATCH (xXcupQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
rep.server_major_version = XCUP_MAJOR_VERSION;
rep.server_minor_version = XCUP_MINOR_VERSION;
if (client->swapped) {
swaps (&rep.sequence_number, n);
swapl (&rep.length, n);
swaps (&rep.server_major_version, n);
swaps (&rep.server_minor_version, n);
}
WriteToClient (client, sizeof (xXcupQueryVersionReply), (char *)&rep);
return client->noClientException;
}
static
int ProcGetReservedColormapEntries(
register ClientPtr client)
{
REQUEST (xXcupGetReservedColormapEntriesReq);
xXcupGetReservedColormapEntriesReply rep;
xColorItem* cptr;
register int n;
REQUEST_SIZE_MATCH (xXcupGetReservedColormapEntriesReq);
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
#ifndef HAVE_SPECIAL_DESKTOP_COLORS
citems[CUP_BLACK_PIXEL].pixel =
screenInfo.screens[stuff->screen]->blackPixel;
citems[CUP_WHITE_PIXEL].pixel =
screenInfo.screens[stuff->screen]->whitePixel;
#endif
rep.type = X_Reply;
rep.sequence_number = client->sequence;
rep.length = NUM_DESKTOP_COLORS * 3;
if (client->swapped) {
swaps (&rep.sequence_number, n);
swapl (&rep.length, n);
}
WriteToClient (client, sizeof (xXcupGetReservedColormapEntriesReply), (char *)&rep);
for (n = 0, cptr = citems; n < NUM_DESKTOP_COLORS; n++, cptr++) {
if (client->swapped) SwapColorItem (cptr);
WriteToClient (client, SIZEOF(xColorItem), (char *)cptr);
}
return client->noClientException;
}
static
int ProcStoreColors(
register ClientPtr client)
{
REQUEST (xXcupStoreColorsReq);
ColormapPtr pcmp;
int rc;
REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP,
client, DixAddAccess);
if (rc == Success) {
int ncolors, n;
xXcupStoreColorsReply rep;
xColorItem* cptr;
if (!(pcmp->class & DynamicClass))
return BadMatch;
ncolors = (client->req_len << 2) - SIZEOF (xXcupStoreColorsReq);
if (ncolors % SIZEOF(xColorItem))
return BadLength;
ncolors /= SIZEOF (xColorItem);
for (n = 0, cptr = (xColorItem*) &stuff[1]; n < ncolors; n++) {
Pixel pixel = cptr->pixel;
if (AllocColor (pcmp,
&cptr->red, &cptr->green, &cptr->blue,
&pixel, client->index) == Success) {
cptr->pixel = pixel;
cptr->flags = 0x08;
} else
cptr->flags = 0;
cptr = (xColorItem*) (((char*)cptr) + SIZEOF(xColorItem));
}
rep.type = X_Reply;
rep.sequence_number = client->sequence;
rep.length = ncolors * 3;
if (client->swapped) {
swaps (&rep.sequence_number, n);
swapl (&rep.length, n);
}
WriteToClient (client, sizeof (xXcupGetReservedColormapEntriesReply), (char *)&rep);
for (n = 0, cptr = (xColorItem*) &stuff[1]; n < ncolors; n++) {
if (client->swapped) SwapColorItem (cptr);
WriteToClient (client, SIZEOF(xColorItem), (char *)cptr);
cptr = (xColorItem*) (((char*)cptr) + SIZEOF(xColorItem));
}
return client->noClientException;
} else {
client->errorValue = stuff->cmap;
return (rc == BadValue) ? BadColor : rc;
}
}
static
int ProcDispatch(
register ClientPtr client)
{
REQUEST (xReq);
switch (stuff->data)
{
case X_XcupQueryVersion:
return ProcQueryVersion (client);
case X_XcupGetReservedColormapEntries:
return ProcGetReservedColormapEntries (client);
case X_XcupStoreColors:
return ProcStoreColors (client);
default:
return BadRequest;
}
}
static
int SProcQueryVersion(
register ClientPtr client)
{
register int n;
REQUEST(xXcupQueryVersionReq);
swaps(&stuff->length, n);
return ProcQueryVersion(client);
}
static
int SProcGetReservedColormapEntries(
ClientPtr client)
{
register int n;
REQUEST (xXcupGetReservedColormapEntriesReq);
swaps (&stuff->length, n);
swapl (&stuff->screen, n);
REQUEST_AT_LEAST_SIZE (xXcupGetReservedColormapEntriesReq);
return ProcGetReservedColormapEntries (client);
}
static
int SProcXcupStoreColors(
ClientPtr client)
{
register int n;
int count;
xColorItem* pItem;
REQUEST (xXcupStoreColorsReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
swapl(&stuff->cmap, n);
pItem = (xColorItem*) &stuff[1];
for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; )
SwapColorItem(pItem++);
return ProcStoreColors (client);
}
static
int SProcDispatch(
register ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XcupQueryVersion:
return SProcQueryVersion (client);
case X_XcupGetReservedColormapEntries:
return SProcGetReservedColormapEntries (client);
case X_XcupStoreColors:
return SProcXcupStoreColors (client);
default:
return BadRequest;
}
}

View file

@ -1,155 +0,0 @@
/************************************************************
Copyright 1989, 1998 The Open Group
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.
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
OPEN GROUP 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 Open Group 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 Open Group.
********************************************************/
/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#define _MITMISC_SERVER_
#include <X11/extensions/mitmiscstr.h>
#include "modinit.h"
static void MITResetProc(
ExtensionEntry * /* extEntry */
);
static DISPATCH_PROC(ProcMITDispatch);
static DISPATCH_PROC(ProcMITGetBugMode);
static DISPATCH_PROC(ProcMITSetBugMode);
static DISPATCH_PROC(SProcMITDispatch);
static DISPATCH_PROC(SProcMITGetBugMode);
static DISPATCH_PROC(SProcMITSetBugMode);
void
MITMiscExtensionInit(INITARGS)
{
AddExtension(MITMISCNAME, 0, 0,
ProcMITDispatch, SProcMITDispatch,
MITResetProc, StandardMinorOpcode);
}
/*ARGSUSED*/
static void
MITResetProc (extEntry)
ExtensionEntry *extEntry;
{
}
static int
ProcMITSetBugMode(client)
register ClientPtr client;
{
REQUEST(xMITSetBugModeReq);
REQUEST_SIZE_MATCH(xMITSetBugModeReq);
if (stuff->onOff != xFalse)
return BadRequest;
return(client->noClientException);
}
static int
ProcMITGetBugMode(client)
register ClientPtr client;
{
xMITGetBugModeReply rep;
register int n;
REQUEST_SIZE_MATCH(xMITGetBugModeReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.onOff = FALSE;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
}
WriteToClient(client, sizeof(xMITGetBugModeReply), (char *)&rep);
return(client->noClientException);
}
static int
ProcMITDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_MITSetBugMode:
return ProcMITSetBugMode(client);
case X_MITGetBugMode:
return ProcMITGetBugMode(client);
default:
return BadRequest;
}
}
static int
SProcMITSetBugMode(client)
register ClientPtr client;
{
register int n;
REQUEST(xMITSetBugModeReq);
swaps(&stuff->length, n);
return ProcMITSetBugMode(client);
}
static int
SProcMITGetBugMode(client)
register ClientPtr client;
{
register int n;
REQUEST(xMITGetBugModeReq);
swaps(&stuff->length, n);
return ProcMITGetBugMode(client);
}
static int
SProcMITDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_MITSetBugMode:
return SProcMITSetBugMode(client);
case X_MITGetBugMode:
return SProcMITGetBugMode(client);
default:
return BadRequest;
}
}

View file

@ -1,123 +0,0 @@
/************************************************************
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, 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 Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS 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 <X11/X.h>
#include <X11/Xproto.h>
#include "dixstruct.h"
#include "extnsionst.h"
#include "dix.h"
#define _XEVI_SERVER_
#include <X11/extensions/XEVIstr.h>
#include "EVIstruct.h"
#include "scrnintstr.h"
#if HAVE_STDINT_H
#include <stdint.h>
#elif !defined(UINT32_MAX)
#define UINT32_MAX 0xffffffffU
#endif
static int sampleGetVisualInfo(
VisualID32 *visual,
int n_visual,
xExtendedVisualInfo **evi_rn,
int *n_info_rn,
VisualID32 **conflict_rn,
int *n_conflict_rn)
{
unsigned int max_sz_evi;
VisualID32 *temp_conflict;
xExtendedVisualInfo *evi;
unsigned int max_visuals = 0, max_sz_conflict, sz_conflict = 0;
register int visualI, scrI, sz_evi = 0, conflictI, n_conflict;
if (n_visual > UINT32_MAX/(sz_xExtendedVisualInfo * screenInfo.numScreens))
return BadAlloc;
max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens;
for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
if (screenInfo.screens[scrI]->numVisuals > max_visuals)
max_visuals = screenInfo.screens[scrI]->numVisuals;
}
if (n_visual > UINT32_MAX/(sz_VisualID32 * screenInfo.numScreens
* max_visuals))
return BadAlloc;
max_sz_conflict = n_visual * sz_VisualID32 * screenInfo.numScreens * max_visuals;
*evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi);
if (!*evi_rn)
return BadAlloc;
temp_conflict = (VisualID32 *)xalloc(max_sz_conflict);
if (!temp_conflict) {
xfree(*evi_rn);
return BadAlloc;
}
for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
for (visualI = 0; visualI < n_visual; visualI++) {
evi[sz_evi].core_visual_id = visual[visualI];
evi[sz_evi].screen = scrI;
evi[sz_evi].level = 0;
evi[sz_evi].transparency_type = XEVI_TRANSPARENCY_NONE;
evi[sz_evi].transparency_value = 0;
evi[sz_evi].min_hw_colormaps = 1;
evi[sz_evi].max_hw_colormaps = 1;
evi[sz_evi].num_colormap_conflicts = n_conflict = 0;
for (conflictI = 0; conflictI < n_conflict; conflictI++)
temp_conflict[sz_conflict++] = visual[visualI];
sz_evi++;
}
}
*conflict_rn = temp_conflict;
*n_conflict_rn = sz_conflict;
*n_info_rn = sz_evi;
return Success;
}
static void sampleFreeVisualInfo(
xExtendedVisualInfo *evi,
VisualID32 *conflict)
{
if (evi)
xfree(evi);
if (conflict)
xfree(conflict);
}
EviPrivPtr eviDDXInit(void)
{
static EviPrivRec eviPriv;
eviPriv.getVisualInfo = sampleGetVisualInfo;
eviPriv.freeVisualInfo = sampleFreeVisualInfo;
return &eviPriv;
}
void eviDDXReset(void)
{
}

View file

@ -38,9 +38,6 @@ in this Software without prior written authorization from The Open Group.
#include "xacestr.h"
#include "securitysrv.h"
#include <X11/extensions/securstr.h>
#ifdef XAPPGROUP
#include "appgroup.h"
#endif
#include "modinit.h"
/* Extension stuff */
@ -833,11 +830,6 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
if (SecurityDoCheck(subj, obj, requested, allowed) == Success)
return;
#ifdef XAPPGROUP
if (rec->id == XagDefaultColormap(rec->client))
return;
#endif
SecurityAudit("Security: denied client %d access %x to resource 0x%x "
"of client %d on request %s\n", rec->client->index,
requested, rec->id, cid,

View file

@ -1279,6 +1279,8 @@ SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count)
for (i = 0; i < screenInfo.numScreens; i++) {
pWin = WindowTable[i];
if (!pWin)
continue;
(void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id);
p1 = pWin->firstChild;
FindInterestedChildren(dev, p1, mask, ev, count);

View file

@ -8,8 +8,7 @@ dnl To use dolt, invoke the DOLT macro immediately after the libtool macros.
dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it
dnl installed when running autoconf on your project.
dnl
dnl git snapshot: 198a3026b347b9220a2f2e2ae23a3049c35af262
dnl git snapshot: d91f2b4e9041538400e2703a2a6fbeecdb8ee27d
AC_DEFUN([DOLT], [
AC_REQUIRE([AC_CANONICAL_HOST])
# dolt, a replacement for libtool
@ -27,11 +26,13 @@ if test x$GCC != xyes; then
fi
case $host in
i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*) ;;
amd64-*-freebsd*|i386-*-freebsd*|ia64-*-freebsd*) ;;
amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*) ;;
*) dolt_supported=no ;;
esac
if test x$dolt_supported = xno ; then
AC_MSG_RESULT([no, falling back to libtool])
LTCOMPILE='$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)'
LTCXXCOMPILE='$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)'
else
AC_MSG_RESULT([yes, replacing libtool])
@ -65,9 +66,10 @@ dnl Write out shared compilation code.
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
libobjdir="${obj%$objbase}.libs"
if test ! -d "$libobjdir" ; then
mkdir -p "$libobjdir"
mkdir_out="$(mkdir "$libobjdir" 2>&1)"
mkdir_ret=$?
if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then
echo "$mkdir_out" 1>&2
exit $mkdir_ret
fi
fi
@ -130,17 +132,19 @@ __DOLTCOMPILE__EOF__
dnl Done writing out doltcompile; substitute it for libtool compilation.
chmod +x doltcompile
LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)'
AC_SUBST(LTCOMPILE)
LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)'
AC_SUBST(LTCXXCOMPILE)
fi
AC_SUBST(LTCOMPILE)
AC_SUBST(LTCXXCOMPILE)
# end dolt
])
##### http://autoconf-archive.cryp.to/ac_define_dir.html
# ===========================================================================
# http://autoconf-archive.cryp.to/ac_define_dir.html
# ===========================================================================
#
# SYNOPSIS
#
@ -148,11 +152,11 @@ fi
#
# DESCRIPTION
#
# This macro sets VARNAME to the expansion of the DIR variable,
# taking care of fixing up ${prefix} and such.
# This macro sets VARNAME to the expansion of the DIR variable, taking
# care of fixing up ${prefix} and such.
#
# VARNAME is then offered as both an output variable and a C
# preprocessor symbol.
# VARNAME is then offered as both an output variable and a C preprocessor
# symbol.
#
# Example:
#
@ -160,18 +164,18 @@ fi
#
# LAST MODIFICATION
#
# 2006-10-13
# 2008-04-12
#
# COPYLEFT
#
# Copyright (c) 2006 Stepan Kasal <kasal@ucw.cz>
# Copyright (c) 2006 Andreas Schwab <schwab@suse.de>
# Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2006 Alexandre Oliva
# Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz>
# Copyright (c) 2008 Andreas Schwab <schwab@suse.de>
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2008 Alexandre Oliva
#
# Copying and distribution of this file, with or without
# modification, are permitted in any medium without royalty provided
# the copyright notice and this notice are preserved.
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved.
AC_DEFUN([AC_DEFINE_DIR], [
prefix_NONE=

View file

@ -7,4 +7,5 @@ libcomposite_la_SOURCES = \
compext.c \
compint.h \
compinit.c \
compoverlay.c \
compwindow.c

View file

@ -54,10 +54,7 @@ static CARD8 CompositeReqCode;
static DevPrivateKey CompositeClientPrivateKey = &CompositeClientPrivateKey;
RESTYPE CompositeClientWindowType;
RESTYPE CompositeClientSubwindowsType;
static RESTYPE CompositeClientOverlayType;
static void deleteCompOverlayClient (CompOverlayClientPtr pOcToDel,
ScreenPtr pScreen);
RESTYPE CompositeClientOverlayType;
typedef struct _CompositeClient {
int major_version;
@ -107,19 +104,8 @@ static int
FreeCompositeClientOverlay (pointer value, XID ccwid)
{
CompOverlayClientPtr pOc = (CompOverlayClientPtr) value;
ScreenPtr pScreen = pOc->pScreen;
CompScreenPtr cs;
deleteCompOverlayClient(pOc, pScreen);
/* Unmap overlay window when there are no more clients using it */
cs = GetCompScreen(pScreen);
if (cs->pOverlayClients == NULL) {
if (cs->pOverlayWin != NULL) {
UnmapWindow(cs->pOverlayWin, FALSE);
}
}
compFreeOverlayClient (pOc);
return Success;
}
@ -304,137 +290,6 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
}
/*
* Routines for manipulating the per-screen overlay clients list.
* This list indicates which clients have called GetOverlayWindow
* for this screen.
*/
/* Return the screen's overlay client list element for the given client */
static CompOverlayClientPtr
findCompOverlayClient (ClientPtr pClient, ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc;
for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext) {
if (pOc->pClient == pClient) {
return pOc;
}
}
return NULL;
}
static int
createCompOverlayClient (ClientPtr pClient, ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc;
pOc = (CompOverlayClientPtr) xalloc(sizeof(CompOverlayClientRec));
if (pOc == NULL) {
return BadAlloc;
}
pOc->pClient = pClient;
pOc->pScreen = pScreen;
pOc->resource = FakeClientID(pClient->index);
pOc->pNext = cs->pOverlayClients;
cs->pOverlayClients = pOc;
/*
* Create a resource for this element so it can be deleted
* when the client goes away.
*/
if (!AddResource (pOc->resource, CompositeClientOverlayType,
(pointer) pOc)) {
xfree(pOc);
return BadAlloc;
}
return Success;
}
/*
* Delete the given overlay client list element from its screen list.
*/
static void
deleteCompOverlayClient (CompOverlayClientPtr pOcToDel, ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc, pNext;
CompOverlayClientPtr pOcLast = NULL;
pOc = cs->pOverlayClients;
while (pOc != NULL) {
pNext = pOc->pNext;
if (pOc == pOcToDel) {
xfree(pOc);
if (pOcLast == NULL) {
cs->pOverlayClients = pNext;
} else {
pOcLast->pNext = pNext;
}
break;
}
pOcLast = pOc;
pOc = pNext;
}
}
/*
* Delete all the hide-counts list elements for this screen.
*/
void
deleteCompOverlayClientsForScreen (ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc, pTmp;
pOc = cs->pOverlayClients;
while (pOc != NULL) {
pTmp = pOc->pNext;
FreeResource(pOc->resource, 0);
pOc = pTmp;
}
cs->pOverlayClients = NULL;
}
/*
** If necessary, create the overlay window. And map it
** Note: I found it excessively difficult to destroy this window
** during compCloseScreen; DeleteWindow can't be called because
** the input devices are already shut down. So we are going to
** just allocate an overlay window once per screen per X server
** invocation.
*/
static WindowPtr
createOverlayWindow (ScreenPtr pScreen)
{
int wid = FakeClientID(0);
WindowPtr pWin;
XID overrideRedirect = TRUE;
int result;
pWin = CreateWindow (
wid, WindowTable[pScreen->myNum],
0, 0, pScreen->width, pScreen->height, 0,
InputOutput, CWOverrideRedirect, &overrideRedirect,
WindowTable[pScreen->myNum]->drawable.depth,
serverClient, pScreen->rootVisual, &result);
if (pWin == NULL) {
return NULL;
}
if (!AddResource(wid, RT_WINDOW, (pointer)pWin)) {
DeleteWindow(pWin, None);
return NULL;
}
return pWin;
}
static int
ProcCompositeGetOverlayWindow (ClientPtr client)
{
@ -456,28 +311,31 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
}
pScreen = pWin->drawable.pScreen;
/*
* Create an OverlayClient structure to mark this client's
* interest in the overlay window
*/
pOc = compCreateOverlayClient(pScreen, client);
if (pOc == NULL)
return BadAlloc;
/*
* Make sure the overlay window exists
*/
cs = GetCompScreen(pScreen);
if (cs->pOverlayWin == NULL) {
cs->pOverlayWin = createOverlayWindow(pScreen);
if (cs->pOverlayWin == NULL) {
if (cs->pOverlayWin == NULL)
if (!compCreateOverlayWindow(pScreen))
{
FreeResource (pOc->resource, RT_NONE);
return BadAlloc;
}
}
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id,
RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess);
if (rc != Success)
{
FreeResource (pOc->resource, RT_NONE);
return rc;
MapWindow(cs->pOverlayWin, serverClient);
/* Record that client is using this overlay window */
pOc = findCompOverlayClient(client, pScreen);
if (pOc == NULL) {
int ret = createCompOverlayClient(client, pScreen);
if (ret != Success) {
return ret;
}
}
rep.type = X_Reply;
@ -504,7 +362,6 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client)
WindowPtr pWin;
ScreenPtr pScreen;
CompOverlayClientPtr pOc;
CompScreenPtr cs;
REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
@ -519,18 +376,12 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client)
* Has client queried a reference to the overlay window
* on this screen? If not, generate an error.
*/
pOc = findCompOverlayClient(client, pWin->drawable.pScreen);
if (pOc == NULL) {
pOc = compFindOverlayClient (pWin->drawable.pScreen, client);
if (pOc == NULL)
return BadMatch;
}
/* The delete function will free the client structure */
FreeResource (pOc->resource, 0);
cs = GetCompScreen(pScreen);
if (cs->pOverlayClients == NULL) {
UnmapWindow(cs->pOverlayWin, FALSE);
}
FreeResource (pOc->resource, RT_NONE);
return client->noClientException;
}

View file

@ -76,14 +76,6 @@ compCloseScreen (int index, ScreenPtr pScreen)
pScreen->CopyWindow = cs->CopyWindow;
pScreen->PositionWindow = cs->PositionWindow;
deleteCompOverlayClientsForScreen(pScreen);
/*
** Note: no need to call DeleteWindow; the server has
** already destroyed it.
*/
cs->pOverlayWin = NULL;
xfree (cs);
dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
ret = (*pScreen->CloseScreen) (index, pScreen);
@ -122,11 +114,11 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
if (ret && (mask & CWBackingStore)) {
if (pWin->backingStore != NotUseful) {
compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
pWin->backStorage = TRUE;
pWin->backStorage = (pointer) (intptr_t) 1;
} else {
compUnredirectWindow(serverClient, pWin,
CompositeRedirectAutomatic);
pWin->backStorage = FALSE;
pWin->backStorage = NULL;
}
}
@ -380,6 +372,7 @@ compScreenInit (ScreenPtr pScreen)
return FALSE;
cs->damaged = FALSE;
cs->overlayWid = FakeClientID(0);
cs->pOverlayWin = NULL;
cs->pOverlayClients = NULL;

View file

@ -155,6 +155,7 @@ typedef struct _CompScreen {
VisualID *alternateVisuals;
WindowPtr pOverlayWin;
Window overlayWid;
CompOverlayClientPtr pOverlayClients;
} CompScreenRec, *CompScreenPtr;
@ -172,6 +173,7 @@ extern DevPrivateKey CompSubwindowsPrivateKey;
extern RESTYPE CompositeClientWindowType;
extern RESTYPE CompositeClientSubwindowsType;
extern RESTYPE CompositeClientOverlayType;
/*
* compalloc.c
@ -229,6 +231,25 @@ CompositeRegisterAlternateVisuals (ScreenPtr pScreen,
Bool
compScreenInit (ScreenPtr pScreen);
/*
* compoverlay.c
*/
void
compFreeOverlayClient (CompOverlayClientPtr pOcToDel);
CompOverlayClientPtr
compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient);
CompOverlayClientPtr
compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient);
Bool
compCreateOverlayWindow (ScreenPtr pScreen);
void
compDestroyOverlayWindow (ScreenPtr pScreen);
/*
* compwindow.c
*/
@ -292,9 +313,6 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
void
compWindowUpdate (WindowPtr pWin);
void
deleteCompOverlayClientsForScreen (ScreenPtr pScreen);
WindowPtr
CompositeRealChildHead (WindowPtr pWin);

159
composite/compoverlay.c Normal file
View file

@ -0,0 +1,159 @@
/*
* Copyright © 2006 Sun Microsystems
*
* 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 Sun Microsystems not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Sun Microsystems makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL SUN MICROSYSTEMS 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.
*
* Copyright © 2003 Keith Packard
*
* 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 Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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 "compint.h"
#include "xace.h"
/*
* Delete the given overlay client list element from its screen list.
*/
void
compFreeOverlayClient (CompOverlayClientPtr pOcToDel)
{
ScreenPtr pScreen = pOcToDel->pScreen;
CompScreenPtr cs = GetCompScreen (pScreen);
CompOverlayClientPtr *pPrev, pOc;
for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext)
{
if (pOc == pOcToDel) {
*pPrev = pOc->pNext;
xfree (pOc);
break;
}
}
/* Destroy overlay window when there are no more clients using it */
if (cs->pOverlayClients == NULL)
compDestroyOverlayWindow (pScreen);
}
/*
* Return the client's first overlay client rec from the given screen
*/
CompOverlayClientPtr
compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
{
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc;
for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext)
if (pOc->pClient == pClient)
return pOc;
return NULL;
}
/*
* Create an overlay client object for the given client
*/
CompOverlayClientPtr
compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
{
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc;
pOc = (CompOverlayClientPtr) xalloc(sizeof(CompOverlayClientRec));
if (pOc == NULL)
return NULL;
pOc->pClient = pClient;
pOc->pScreen = pScreen;
pOc->resource = FakeClientID(pClient->index);
pOc->pNext = cs->pOverlayClients;
cs->pOverlayClients = pOc;
/*
* Create a resource for this element so it can be deleted
* when the client goes away.
*/
if (!AddResource (pOc->resource, CompositeClientOverlayType, (pointer) pOc))
return NULL;
return pOc;
}
/*
* Create the overlay window and map it
*/
Bool
compCreateOverlayWindow (ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen(pScreen);
WindowPtr pRoot = WindowTable[pScreen->myNum];
WindowPtr pWin;
XID overrideRedirect = TRUE;
int result;
pWin = cs->pOverlayWin =
CreateWindow (cs->overlayWid, pRoot,
0, 0, pScreen->width, pScreen->height, 0,
InputOutput, CWOverrideRedirect, &overrideRedirect,
pRoot->drawable.depth,
serverClient, pScreen->rootVisual, &result);
if (pWin == NULL)
return FALSE;
if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin))
return FALSE;
MapWindow(pWin, serverClient);
return TRUE;
}
/*
* Destroy the overlay window
*/
void
compDestroyOverlayWindow (ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen(pScreen);
cs->pOverlayWin = NullWindow;
FreeResource (cs->overlayWid, RT_NONE);
}

View file

@ -177,7 +177,7 @@ AC_CHECK_FUNC([dlopen], [],
AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
case $host_os in
linux*)
linux*|darwin*)
AC_DEFINE(HAVE_URANDOM, 1, [Has /dev/urandom]) ;;
solaris*)
# Solaris 8 with patches, or Solaris 9 or later have /dev/urandom
@ -379,7 +379,7 @@ case $host_os in
AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console])
DRI=yes
DRI2=yes
PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.1], DRI2=yes, DRI2=no)
;;
*netbsd*)
AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
@ -387,7 +387,7 @@ case $host_os in
AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
DRI=yes
DRI2=yes
PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.1], DRI2=yes, DRI2=no)
;;
*openbsd*)
AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
@ -396,7 +396,7 @@ case $host_os in
;;
*linux*)
DRI=yes
DRI2=yes
PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.1], DRI2=yes, DRI2=no)
KDRIVE_HW=yes
;;
*solaris*)
@ -528,7 +528,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(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(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: disabled)]), [RECORD=$enableval], [RECORD=no])
AC_ARG_ENABLE(record, AS_HELP_STRING([--enable-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(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])
@ -544,12 +544,9 @@ AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Mi
AC_ARG_ENABLE(xace, AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
AC_ARG_ENABLE(xselinux, AS_HELP_STRING([--disable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
AC_ARG_ENABLE(appgroup, AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: disabled)]), [APPGROUP=$enableval], [APPGROUP=$XCSECURITY])
AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
AC_ARG_ENABLE(xevie, AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes])
AC_ARG_ENABLE(cup, AS_HELP_STRING([--disable-cup], [Build TOG-CUP extension (default: enabled)]), [CUP=$enableval], [CUP=yes])
AC_ARG_ENABLE(evi, AS_HELP_STRING([--disable-evi], [Build Extended-Visual-Information extension (default: enabled)]), [EVI=$enableval], [EVI=yes])
AC_ARG_ENABLE(multibuffer, AS_HELP_STRING([--enable-multibuffer], [Build Multibuffer extension (default: disabled)]), [MULTIBUFFER=$enableval], [MULTIBUFFER=no])
AC_ARG_ENABLE(fontcache, AS_HELP_STRING([--enable-fontcache], [Build FontCache extension (default: disabled)]), [FONTCACHE=$enableval], [FONTCACHE=no])
AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
@ -647,6 +644,40 @@ XORG_CHECK_LINUXDOC
dnl Handle installing libxf86config
AM_CONDITIONAL(INSTALL_LIBXF86CONFIG, [test "x$INSTALL_LIBXF86CONFIG" = xyes])
dnl XQuartz DDX Detection... Yes, it's ugly to have it here... but we need to handle this early on
case $host_os in
darwin*)
if test x$XQUARTZ = xauto; then
AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -framework Carbon"
AC_LINK_IFELSE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}],
[xorg_cv_Carbon_framework=yes],
[xorg_cv_Carbon_framework=no])
LDFLAGS=$save_LDFLAGS])
if test "X$xorg_cv_Carbon_framework" = Xyes; then
XQUARTZ=yes
else
XQUARTZ=no
fi
fi
if test "x$XQUARTZ" = xyes ; then
XQUARTZ=yes
XVFB=no
XNEST=no
COMPOSITE=no
DGA=no
DPMSExtension=no
XF86BIGFONT=no
XF86MISC=no
XF86VIDMODE=no
fi
;;
esac
dnl ---------------------------------------------------------------------------
dnl Extension section
dnl ---------------------------------------------------------------------------
@ -827,7 +858,7 @@ if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then
PKG_CHECK_MODULES([GL], [glproto >= 1.4.9])
AC_SUBST(XLIB_CFLAGS)
AC_DEFINE(GLXEXT, 1, [Build GLX extension])
GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la'
GLX_LIBS='$(top_builddir)/GL/glx/libglx.la'
test -d GL || mkdir GL
case $host_os in
solaris*)
@ -838,6 +869,7 @@ if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then
if test $? -ne 0; then
AC_MSG_ERROR([Failed to link Mesa source tree. Please specify a proper path to Mesa sources, or disable GLX.])
fi
GLX_SYS_LIBS="$GLX_SYS_LIBS $DLOPEN_LIBS"
else
GLX=no
fi
@ -919,26 +951,6 @@ if test "x$XEVIE" = xyes; then
REQUIRED_MODULES="$REQUIRED_MODULES evieproto"
fi
AM_CONDITIONAL(APPGROUP, [test "x$APPGROUP" = xyes])
if test "x$APPGROUP" = xyes; then
if test "x$XACE" != xyes || test "x$XCSECURITY" != xyes; then
AC_MSG_ERROR([cannot build APPGROUP extension without X-ACE and XC-SECURITY])
fi
AC_DEFINE(XAPPGROUP, 1, [Build APPGROUP extension])
fi
AM_CONDITIONAL(CUP, [test "x$CUP" = xyes])
if test "x$CUP" = xyes; then
AC_DEFINE(TOGCUP, 1, [Build TOG-CUP extension])
# Requires xextproto which is always required
fi
AM_CONDITIONAL(EVI, [test "x$EVI" = xyes])
if test "x$EVI" = xyes; then
AC_DEFINE(EVI, 1, [Build Extended-Visual-Information extension])
# Requires xextproto which is always required
fi
AM_CONDITIONAL(MULTIBUFFER, [test "x$MULTIBUFFER" = xyes])
if test "x$MULTIBUFFER" = xyes; then
AC_DEFINE(MULTIBUFFER, 1, [Build Multibuffer extension])
@ -1101,7 +1113,6 @@ if test "x$DEBUGGING" = xyes; then
fi
AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
AC_DEFINE(MITMISC, 1, [Support MIT Misc extension])
AC_DEFINE(XTEST, 1, [Support XTest extension])
AC_DEFINE(XSYNC, 1, [Support XSync extension])
AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
@ -1129,7 +1140,9 @@ PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
# OpenSSL used for SHA1 hashing in render/glyph.c, but we don't need all of
# the OpenSSL libraries, just libcrypto
PKG_CHECK_MODULES([OPENSSL], [openssl], [OPENSSL_LIB_FLAGS=`$PKG_CONFIG --libs-only-L --libs-only-other openssl`])
PKG_CHECK_EXISTS([openssl],
[PKG_CHECK_MODULES([OPENSSL], [openssl],
[OPENSSL_LIB_FLAGS=`$PKG_CONFIG --libs-only-L --libs-only-other openssl`])])
LIBCRYPTO="$OPENSSL_LIB_FLAGS -lcrypto"
# Autotools has some unfortunate issues with library handling. In order to
@ -1596,7 +1609,7 @@ AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINTMODULES], [printproto x11 xfont $XDMCP_MODULES xau])
XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS"
XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS -DXPRINT"
XPRINT_LIBS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $XKB_LIB $XKB_STUB_LIB"
XPRINT_SYS_LIBS="$XPRINTMODULES_LIBS"
@ -1715,58 +1728,17 @@ AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])
dnl Darwin / OS X DDX
if test "X$XQUARTZ" = Xauto; then
AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -framework Carbon"
AC_LINK_IFELSE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}],
[xorg_cv_Carbon_framework=yes],
[xorg_cv_Carbon_framework=no])
LDFLAGS=$save_LDFLAGS])
if test "X$xorg_cv_Carbon_framework" = Xyes; then
XQUARTZ=yes
else
XQUARTZ=no
fi
fi
if test "x$XQUARTZ" = xyes; then
AC_DEFINE(XQUARTZ,1,[Have Quartz])
AC_DEFINE(ROOTLESS,1,[Build Rootless code])
#glxAGL / glxCGL don't work yet
# AC_CACHE_CHECK([for AGL framework],xorg_cv_AGL_framework,[
# save_LDFLAGS=$LDFLAGS
# LDFLAGS="$LDFLAGS -framework AGL"
# AC_LINK_IFELSE(
# [char aglEnable(); int main() { aglEnable(); return 0;}],
# [xorg_cv_AGL_framework=yes],
# [xorg_cv_AGL_framework=no])
# LDFLAGS=$save_LDFLAGS
# ])
xorg_cv_AGL_framework=no
DARWIN_GLX_LIBS='$(top_builddir)/GL/apple/indirect.o $(top_builddir)/GL/glx/libglx.la'
DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB"
DARWIN_GLX_LIBS='$(top_builddir)/hw/xquartz/GL/libCGLCore.la $(top_builddir)/GL/glx/libglx.la'
DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $DARWIN_GLX_LIBS"
AC_SUBST([DARWIN_LIBS])
AC_CHECK_LIB([Xplugin],[xp_init],[:])
CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -DNO_ALLOCA"
if test "x$XF86MISC" = xyes || test "x$XF86MISC" = xauto; then
AC_MSG_NOTICE([Disabling XF86Misc extension])
XF86MISC=no
fi
if test "x$XF86VIDMODE" = xyes || test "x$XF86VIDMODE" = xauto; then
AC_MSG_NOTICE([Disabling XF86VidMode extension])
XF86VIDMODE=no
fi
if test "x$XF86BIGFONT" = xyes || test "x$XF86BIGFONT" = xauto; then
AC_MSG_NOTICE([Disabling XF86BigFont extension])
XF86BIGFONT=no
fi
if test "x$DGA" = xyes || test "x$DGA" = xauto; then
AC_MSG_NOTICE([Disabling DGA extension])
DGA=no
fi
fi
# Support for objc in autotools is minimal and not documented.
@ -1928,26 +1900,21 @@ if test "$KDRIVE" = yes; then
if test "x$XV" = xyes; then
XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
fi
if test "x$DRI" = xyes && test "x$GLX" = xyes; then
XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS gl libdrm"
fi
PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
if test "x$XEPHYR" = xauto; then
XEPHYR=$xephyr
fi
XEPHYR_DRI=no
if test x$XEPHYR = xyes -a x$DRI = xyes && test "x$GLX" = xyes; then
XEPHYR_DRI=yes
XEPHYR_DRI_LIBS=-lGL
AC_SUBST(XEPHYR_DRI_LIBS)
fi
if test x$XEPHYR_DRI = xyes ; then
AC_DEFINE(XEPHYR_DRI,1,[enable DRI extension in xephyr])
fi
# Xephyr needs nanosleep() which is in librt on Solaris
AC_CHECK_FUNC([nanosleep], [],
AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
if test "x$TSLIB" = xyes; then
PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
PKG_CHECK_MODULES([TSLIB], [tslib-1.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
if test "x$HAVE_TSLIB" = xno; then
AC_MSG_ERROR([tslib must be installed to build the tslib driver. See http://tslib.berlios.de/])
fi
@ -1971,13 +1938,10 @@ if test "$KDRIVE" = yes; then
;;
esac
KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.a'
KDRIVE_LOCAL_LIBS="$TSLIB_LIBS $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB $CONFIG_LIB"
KDRIVE_LOCAL_LIBS="$DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB $CONFIG_LIB"
KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB $OS_LIB $XEXT_LIB"
KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS"
# check if we can build Xephyr
PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
KDRIVE_LIBS="$TSLIB_LIBS $KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS"
AC_SUBST([XEPHYR_LIBS])
AC_SUBST([XEPHYR_INCS])
@ -1998,7 +1962,6 @@ AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
AM_CONDITIONAL(XSDLSERVER, [test x"$XSDL" = xyes])
AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
AM_CONDITIONAL(XEPHYR_HAS_DRI, [test x$XEPHYR_DRI = xyes])
AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
dnl these only go in xkb-config.h (which is shared by the Xorg and Xnest servers)
@ -2107,20 +2070,7 @@ XORG_MANPAGE_SECTIONS
AC_OUTPUT([
Makefile
GL/Makefile
GL/apple/Makefile
GL/glx/Makefile
GL/mesa/Makefile
GL/mesa/glapi/Makefile
GL/mesa/main/Makefile
GL/mesa/math/Makefile
GL/mesa/shader/Makefile
GL/mesa/shader/grammar/Makefile
GL/mesa/shader/slang/Makefile
GL/mesa/swrast/Makefile
GL/mesa/swrast_setup/Makefile
GL/mesa/tnl/Makefile
GL/mesa/vbo/Makefile
GL/mesa/X/Makefile
include/Makefile
afb/Makefile
composite/Makefile
@ -2139,7 +2089,6 @@ miext/damage/Makefile
miext/shadow/Makefile
miext/cw/Makefile
miext/rootless/Makefile
miext/rootless/accel/Makefile
os/Makefile
randr/Makefile
render/Makefile
@ -2214,6 +2163,7 @@ hw/xgl/glxext/module/Makefile
hw/xnest/Makefile
hw/xwin/Makefile
hw/xquartz/Makefile
hw/xquartz/GL/Makefile
hw/xquartz/bundle/Makefile
hw/xquartz/xpr/Makefile
hw/kdrive/Makefile

View file

@ -1,4 +1,10 @@
noinst_LTLIBRARIES = libdix.la libxpstubs.la
standard_dix_libs = libdix.la libxpstubs.la
if XPRINT
noinst_LTLIBRARIES = $(standard_dix_libs) libXpdix.la
else
noinst_LTLIBRARIES = $(standard_dix_libs)
endif
AM_CFLAGS = $(DIX_CFLAGS) \
-DVENDOR_NAME=\""@VENDOR_NAME@"\" \
@ -39,7 +45,11 @@ libdix_la_SOURCES = \
libxpstubs_la_SOURCES = \
xpstubs.c
INCLUDES = -I$(top_srcdir)/Xprint
if XPRINT
libXpdix_la_SOURCES = $(libdix_la_SOURCES)
libXpdix_la_CPPFLAGS = -I$(top_srcdir)/hw/xprint
libXpdix_la_CFLAGS = $(AM_CFLAGS) $(XPRINT_CFLAGS)
endif
EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in

View file

@ -524,8 +524,8 @@ CloseDevice(DeviceIntPtr dev)
#ifdef XKB
if (dev->key->xkbInfo)
XkbFreeInfo(dev->key->xkbInfo);
#endif
dev->key->xkbInfo = NULL;
#endif
xfree(dev->key->curKeySyms.map);
xfree(dev->key->modifierKeyMap);
xfree(dev->key);

View file

@ -136,9 +136,6 @@ int ProcInitialConnection();
#endif
#include "privates.h"
#include "xace.h"
#ifdef XAPPGROUP
#include "appgroup.h"
#endif
#ifdef XKB
#ifndef XKB_IN_SERVER
#define XKB_IN_SERVER
@ -3516,9 +3513,6 @@ void InitClient(ClientPtr client, int i, pointer ospriv)
}
#endif
client->replyBytesRemaining = 0;
#ifdef XAPPGROUP
client->appgroup = NULL;
#endif
client->fontResFunc = NULL;
#ifdef SMART_SCHEDULE
client->smart_priority = 0;
@ -3643,9 +3637,6 @@ SendConnSetup(ClientPtr client, char *reason)
client->requestVector = client->swapped ? SwappedProcVector : ProcVector;
client->sequence = 0;
#ifdef XAPPGROUP
XagConnectionInfo (client, &lconnSetupPrefix, &lConnectionInfo, &numScreens);
#endif
((xConnSetup *)lConnectionInfo)->ridBase = client->clientAsMask;
((xConnSetup *)lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
#ifdef MATCH_CLIENT_ENDIAN

View file

@ -270,7 +270,8 @@ dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
*pClient = clients[clientIndex];
return Success;
bad:
client->errorValue = rid;
if(client)
client->errorValue = rid;
*pClient = NULL;
return rc;
}

View file

@ -407,8 +407,8 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
int num_valuators, int *valuators) {
int numEvents = 0;
CARD32 ms = 0;
KeySym *map = pDev->key->curKeySyms.map;
KeySym sym = map[key_code * pDev->key->curKeySyms.mapWidth];
KeySym *map;
KeySym sym;
deviceKeyButtonPointer *kbp = NULL;
if (!events)
@ -419,11 +419,14 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
return 0;
if (!pDev->key || !pDev->focus || !pDev->kbdfeed ||
(pDev->coreEvents && !inputInfo.keyboard->key))
(pDev->coreEvents && !(inputInfo.keyboard && inputInfo.keyboard->key)))
return 0;
if (key_code < 8 || key_code > 255)
return 0;
map = pDev->key->curKeySyms.map;
sym = map[key_code * pDev->key->curKeySyms.mapWidth];
if (pDev->coreEvents)
numEvents = 2;
@ -539,6 +542,9 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
if ((type == ButtonPress || type == ButtonRelease) && !pDev->button)
return 0;
if(pDev->coreEvents && !cp)
return 0;
/* FIXME: I guess it should, in theory, be possible to post button events
* from devices without valuators. */

View file

@ -113,9 +113,6 @@ Equipment Corporation.
#include "dispatch.h" /* InitProcVectors() */
#endif
#include <pthread.h>
pthread_key_t threadname_key=0;
#ifdef DPMSExtension
#define DPMS_SERVER
#include <X11/extensions/dpms.h>
@ -240,28 +237,16 @@ static int indexForScanlinePad[ 65 ] = {
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifdef __APPLE__
void DarwinHandleGUI(int argc, char **argv, char **envp);
#ifdef XQUARTZ
int dix_main(int argc, char *argv[], char *envp[])
#else
int main(int argc, char *argv[], char *envp[])
#endif
int
main(int argc, char *argv[], char *envp[])
{
int i, j, k, error;
char *xauthfile;
HWEventQueueType alwaysCheckForInput[2];
if(threadname_key == 0) ErrorF("pthread_key_create returned %d\n", pthread_key_create(&threadname_key, NULL));
ErrorF("threadname_key = %d\n", threadname_key);
if(pthread_getspecific(threadname_key) == NULL) {
char *nameptr = malloc(32);
sprintf(nameptr, "main thread %d", random());
// strcpy(nameptr, "main thread");
ErrorF("calling: pthread_setspecific(%d, %s)=%d\n", threadname_key, nameptr, pthread_setspecific(threadname_key, nameptr));
if (pthread_getspecific(threadname_key) != NULL) ErrorF("current thread: %s\n", (char *)pthread_getspecific(threadname_key));
} else {
if (pthread_getspecific(threadname_key) != NULL) ErrorF("thread was already: %s\n", (char *)pthread_getspecific(threadname_key));
}
display = "0";
InitGlobals();
@ -270,13 +255,6 @@ main(int argc, char *argv[], char *envp[])
PrinterInitGlobals();
#endif
#ifdef XQUARTZ
/* Quartz support on Mac OS X requires that the Cocoa event loop be in
* the main thread. This allows the X server main to be called again
* from another thread. */
DarwinHandleGUI(argc, argv, envp);
#endif
CheckUserParameters(argc, argv, envp);
CheckUserAuthorization();
@ -472,7 +450,10 @@ main(int argc, char *argv[], char *envp[])
#endif
config_fini();
memset(WindowTable, 0, MAXSCREENS * sizeof(WindowPtr));
CloseDownDevices();
for (i = screenInfo.numScreens - 1; i >= 0; i--)
{
FreeScratchPixmapsForScreen(i);

View file

@ -123,9 +123,6 @@ Equipment Corporation.
#include "dixevents.h"
#include "globals.h"
#ifdef XAPPGROUP
#include "appgroup.h"
#endif
#include "privates.h"
#include "xace.h"
@ -603,14 +600,6 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
if (!ancwopt)
ancwopt = FindWindowWithOptional(pParent)->optional;
if (visual == CopyFromParent) {
#ifdef XAPPGROUP
VisualID ag_visual;
if (client->appgroup && !pParent->parent &&
(ag_visual = XagRootVisual (client)))
visual = ag_visual;
else
#endif
visual = ancwopt->visual;
}
@ -1290,22 +1279,6 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
pVlist++;
if (cmap == CopyFromParent)
{
#ifdef XAPPGROUP
Colormap ag_colormap;
ClientPtr win_owner;
/*
* win_owner == client for CreateWindow, other clients
* can ChangeWindowAttributes
*/
win_owner = clients[CLIENT_ID(pWin->drawable.id)];
if ( win_owner && win_owner->appgroup &&
!pWin->parent->parent &&
(ag_colormap = XagDefaultColormap (win_owner)))
cmap = ag_colormap;
else
#endif
if (pWin->parent &&
(!pWin->optional ||
pWin->optional->visual == wVisual (pWin->parent)))
@ -2234,10 +2207,6 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
h = pWin->drawable.height,
bw = pWin->borderWidth;
int rc, action, smode = Above;
#ifdef XAPPGROUP
ClientPtr win_owner;
ClientPtr ag_leader = NULL;
#endif
xEvent event;
if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask))
@ -2333,17 +2302,9 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
else
pSib = pWin->nextSib;
#ifdef XAPPGROUP
win_owner = clients[CLIENT_ID(pWin->drawable.id)];
ag_leader = XagLeader (win_owner);
#endif
if ((!pWin->overrideRedirect) &&
(RedirectSend(pParent)
#ifdef XAPPGROUP
|| (win_owner->appgroup && ag_leader &&
XagIsControlledRoot (client, pParent))
#endif
))
{
event.u.u.type = ConfigureRequest;
@ -2368,16 +2329,6 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
event.u.configureRequest.height = h;
event.u.configureRequest.borderWidth = bw;
event.u.configureRequest.valueMask = mask;
#ifdef XAPPGROUP
/* make sure if the ag_leader maps the window it goes to the wm */
if (ag_leader && ag_leader != client &&
XagIsControlledRoot (client, pParent)) {
event.u.configureRequest.parent = XagId (win_owner);
(void) TryClientEvents (ag_leader, &event, 1,
NoEventMask, NoEventMask, NullGrab);
return Success;
}
#endif
event.u.configureRequest.parent = pParent->drawable.id;
if (MaybeDeliverEventsToClient(pParent, &event, 1,
SubstructureRedirectMask, client) == 1)
@ -2754,31 +2705,13 @@ MapWindow(WindowPtr pWin, ClientPtr client)
{
xEvent event;
Bool anyMarked;
#ifdef XAPPGROUP
ClientPtr win_owner = clients[CLIENT_ID(pWin->drawable.id)];
ClientPtr ag_leader = XagLeader (win_owner);
#endif
if ((!pWin->overrideRedirect) &&
(RedirectSend(pParent)
#ifdef XAPPGROUP
|| (win_owner->appgroup && ag_leader &&
XagIsControlledRoot (client, pParent))
#endif
))
{
event.u.u.type = MapRequest;
event.u.mapRequest.window = pWin->drawable.id;
#ifdef XAPPGROUP
/* make sure if the ag_leader maps the window it goes to the wm */
if (ag_leader && ag_leader != client &&
XagIsControlledRoot (client, pParent)) {
event.u.mapRequest.parent = XagId (win_owner);
(void) TryClientEvents (ag_leader, &event, 1,
NoEventMask, NoEventMask, NullGrab);
return Success;
}
#endif
event.u.mapRequest.parent = pParent->drawable.id;
if (MaybeDeliverEventsToClient(pParent, &event, 1,

View file

@ -18,6 +18,7 @@ libexa_la_SOURCES = \
exa.c \
exa.h \
exa_accel.c \
exa_glyphs.c \
exa_migration.c \
exa_offscreen.c \
exa_render.c \

133
exa/exa.c
View file

@ -224,6 +224,43 @@ exaLog2(int val)
return bits - 1;
}
static void
exaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
int w, int h, int bpp)
{
pExaPixmap->accel_blocked = 0;
if (pExaScr->info->maxPitchPixels) {
int max_pitch = pExaScr->info->maxPitchPixels * (bpp + 7) / 8;
if (pExaPixmap->fb_pitch > max_pitch)
pExaPixmap->accel_blocked |= EXA_RANGE_PITCH;
}
if (pExaScr->info->maxPitchBytes &&
pExaPixmap->fb_pitch > pExaScr->info->maxPitchBytes)
pExaPixmap->accel_blocked |= EXA_RANGE_PITCH;
if (w > pExaScr->info->maxX)
pExaPixmap->accel_blocked |= EXA_RANGE_WIDTH;
if (h > pExaScr->info->maxY)
pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT;
}
static void
exaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
int w, int h, int bpp)
{
if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
else
pExaPixmap->fb_pitch = w * bpp / 8;
pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
pExaScr->info->pixmapPitchAlign);
}
/**
* exaCreatePixmap() creates a new pixmap.
*
@ -268,12 +305,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
if (paddedWidth / 4 > 32767 || h > 32767)
return NullPixmap;
if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
else
pExaPixmap->fb_pitch = w * bpp / 8;
pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
pExaScr->info->pixmapPitchAlign);
exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
if (paddedWidth < pExaPixmap->fb_pitch)
paddedWidth = pExaPixmap->fb_pitch;
@ -307,12 +340,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
pExaPixmap->offscreen = FALSE;
pExaPixmap->fb_ptr = NULL;
if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
else
pExaPixmap->fb_pitch = w * bpp / 8;
pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
pExaScr->info->pixmapPitchAlign);
exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
if (pExaPixmap->fb_pitch > 131071) {
@ -339,25 +367,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
REGION_NULL(pScreen, &pExaPixmap->validSys);
REGION_NULL(pScreen, &pExaPixmap->validFB);
/* Check whether this pixmap can be used for acceleration. */
pExaPixmap->accel_blocked = 0;
if (pExaScr->info->maxPitchPixels) {
int max_pitch = pExaScr->info->maxPitchPixels * (bpp + 7) / 8;
if (pExaPixmap->fb_pitch > max_pitch)
pExaPixmap->accel_blocked |= EXA_RANGE_PITCH;
}
if (pExaScr->info->maxPitchBytes &&
pExaPixmap->fb_pitch > pExaScr->info->maxPitchBytes)
pExaPixmap->accel_blocked |= EXA_RANGE_PITCH;
if (w > pExaScr->info->maxX)
pExaPixmap->accel_blocked |= EXA_RANGE_WIDTH;
if (h > pExaScr->info->maxY)
pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT;
exaSetAccelBlock(pExaScr, pExaPixmap,
w, h, bpp);
return pPixmap;
}
@ -373,12 +384,25 @@ exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
if (!pPixmap)
return FALSE;
pExaScr = ExaGetScreenPriv(pPixmap->drawable.pScreen);
pExaPixmap = ExaGetPixmapPriv(pPixmap);
if (pExaPixmap)
pExaPixmap->sys_ptr = pPixData;
if (pExaPixmap) {
if (pPixData)
pExaPixmap->sys_ptr = pPixData;
if (devKind > 0)
pExaPixmap->sys_pitch = devKind;
if (width > 0 && height > 0 && bitsPerPixel > 0) {
exaSetFbPitch(pExaScr, pExaPixmap,
width, height, bitsPerPixel);
exaSetAccelBlock(pExaScr, pExaPixmap,
width, height, bitsPerPixel);
}
}
pExaScr = ExaGetScreenPriv(pPixmap->drawable.pScreen);
if (pExaScr->info->ModifyPixmapHeader) {
ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
@ -675,6 +699,34 @@ exaBitmapToRegion(PixmapPtr pPix)
return ret;
}
static Bool
exaCreateScreenResources(ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
PixmapPtr pScreenPixmap;
Bool b;
pScreen->CreateScreenResources = pExaScr->SavedCreateScreenResources;
b = pScreen->CreateScreenResources(pScreen);
pScreen->CreateScreenResources = exaCreateScreenResources;
if (!b)
return FALSE;
pScreenPixmap = pScreen->GetScreenPixmap(pScreen);
if (pScreenPixmap) {
ExaPixmapPriv(pScreenPixmap);
exaSetAccelBlock(pExaScr, pExaPixmap,
pScreenPixmap->drawable.width,
pScreenPixmap->drawable.height,
pScreenPixmap->drawable.bitsPerPixel);
}
return TRUE;
}
/**
* exaCloseScreen() unwraps its wrapped screen functions and tears down EXA's
* screen private, before calling down to the next CloseSccreen.
@ -687,6 +739,8 @@ exaCloseScreen(int i, ScreenPtr pScreen)
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
exaGlyphsFini(pScreen);
pScreen->CreateGC = pExaScr->SavedCreateGC;
pScreen->CloseScreen = pExaScr->SavedCloseScreen;
pScreen->GetImage = pExaScr->SavedGetImage;
@ -696,11 +750,14 @@ exaCloseScreen(int i, ScreenPtr pScreen)
pScreen->CopyWindow = pExaScr->SavedCopyWindow;
pScreen->ChangeWindowAttributes = pExaScr->SavedChangeWindowAttributes;
pScreen->BitmapToRegion = pExaScr->SavedBitmapToRegion;
pScreen->CreateScreenResources = pExaScr->SavedCreateScreenResources;
#ifdef RENDER
if (ps) {
ps->Composite = pExaScr->SavedComposite;
ps->Glyphs = pExaScr->SavedGlyphs;
ps->Trapezoids = pExaScr->SavedTrapezoids;
ps->AddTraps = pExaScr->SavedAddTraps;
ps->Triangles = pExaScr->SavedTriangles;
}
#endif
@ -854,11 +911,17 @@ exaDriverInit (ScreenPtr pScreen,
pExaScr->SavedBitmapToRegion = pScreen->BitmapToRegion;
pScreen->BitmapToRegion = exaBitmapToRegion;
pExaScr->SavedCreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = exaCreateScreenResources;
#ifdef RENDER
if (ps) {
pExaScr->SavedComposite = ps->Composite;
ps->Composite = exaComposite;
pExaScr->SavedGlyphs = ps->Glyphs;
ps->Glyphs = exaGlyphs;
pExaScr->SavedTriangles = ps->Triangles;
ps->Triangles = exaTriangles;
@ -921,6 +984,8 @@ exaDriverInit (ScreenPtr pScreen,
}
}
exaGlyphsInit(pScreen);
LogMessage(X_INFO, "EXA(%d): Driver registered support for the following"
" operations:\n", pScreen->myNum);
assert(pScreenInfo->PrepareSolid != NULL);

View file

@ -64,6 +64,8 @@ struct _ExaOffscreenArea {
ExaOffscreenState state;
ExaOffscreenArea *next;
unsigned eviction_cost;
};
/**

View file

@ -527,16 +527,36 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
pDstExaPixmap = ExaGetPixmapPriv (pDstPixmap);
/* Check whether the accelerator can use this pixmap.
* FIXME: If it cannot, use temporary pixmaps so that the drawing
* happens within limits.
* If the pitch of the pixmaps is out of range, there's nothing
* we can do but fall back to software rendering.
*/
if (pSrcExaPixmap->accel_blocked || pDstExaPixmap->accel_blocked)
{
if (pSrcExaPixmap->accel_blocked & EXA_RANGE_PITCH ||
pDstExaPixmap->accel_blocked & EXA_RANGE_PITCH)
goto fallback;
} else {
exaDoMigration (pixmaps, 2, TRUE);
/* If the width or the height of either of the pixmaps
* is out of range, check whether the boxes are actually out of the
* addressable range as well. If they aren't, we can still do
* the copying in hardware.
*/
if (pSrcExaPixmap->accel_blocked || pDstExaPixmap->accel_blocked) {
int i;
for (i = 0; i < nbox; i++) {
/* src */
if ((pbox[i].x2 + dx + src_off_x) >= pExaScr->info->maxX ||
(pbox[i].y2 + dy + src_off_y) >= pExaScr->info->maxY)
goto fallback;
/* dst */
if ((pbox[i].x2 + dst_off_x) >= pExaScr->info->maxX ||
(pbox[i].y2 + dst_off_y) >= pExaScr->info->maxY)
goto fallback;
}
}
exaDoMigration (pixmaps, 2, TRUE);
/* Mixed directions must be handled specially if the card is lame */
if ((pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS) &&
reverse != upsidedown) {

897
exa/exa_glyphs.c Normal file
View file

@ -0,0 +1,897 @@
/*
* Copyright © 2008 Red Hat, Inc.
* Partly based on code Copyright © 2000 SuSE, 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 not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. Red Hat makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* Red Hat DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Red Hat
* 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.
*
* 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 SuSE not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* 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.
*
* Author: Owen Taylor <otaylor@fishsoup.net>
* Based on code by: Keith Packard
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include "exa_priv.h"
#include "mipict.h"
#if DEBUG_GLYPH_CACHE
#define DBG_GLYPH_CACHE(a) ErrorF a
#else
#define DBG_GLYPH_CACHE(a)
#endif
/* Width of the pixmaps we use for the caches; this should be less than
* max texture size of the driver; this may need to actually come from
* the driver.
*/
#define CACHE_PICTURE_WIDTH 1024
/* Maximum number of glyphs we buffer on the stack before flushing
* rendering to the mask or destination surface.
*/
#define GLYPH_BUFFER_SIZE 256
typedef struct {
PicturePtr source;
ExaCompositeRectRec rects[GLYPH_BUFFER_SIZE];
int count;
} ExaGlyphBuffer, *ExaGlyphBufferPtr;
typedef enum {
ExaGlyphSuccess, /* Glyph added to render buffer */
ExaGlyphFail, /* out of memory, etc */
ExaGlyphNeedFlush, /* would evict a glyph already in the buffer */
} ExaGlyphCacheResult;
void
exaGlyphsInit(ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
int i = 0;
memset(pExaScr->glyphCaches, 0, sizeof(pExaScr->glyphCaches));
pExaScr->glyphCaches[i].format = PICT_a8;
pExaScr->glyphCaches[i].glyphWidth = pExaScr->glyphCaches[i].glyphHeight = 16;
i++;
pExaScr->glyphCaches[i].format = PICT_a8;
pExaScr->glyphCaches[i].glyphWidth = pExaScr->glyphCaches[i].glyphHeight = 32;
i++;
pExaScr->glyphCaches[i].format = PICT_a8r8g8b8;
pExaScr->glyphCaches[i].glyphWidth = pExaScr->glyphCaches[i].glyphHeight = 16;
i++;
pExaScr->glyphCaches[i].format = PICT_a8r8g8b8;
pExaScr->glyphCaches[i].glyphWidth = pExaScr->glyphCaches[i].glyphHeight = 32;
i++;
assert(i == EXA_NUM_GLYPH_CACHES);
for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
pExaScr->glyphCaches[i].columns = CACHE_PICTURE_WIDTH / pExaScr->glyphCaches[i].glyphWidth;
pExaScr->glyphCaches[i].size = 256;
pExaScr->glyphCaches[i].hashSize = 557;
}
}
static void
exaUnrealizeGlyphCaches(ScreenPtr pScreen,
unsigned int format)
{
ExaScreenPriv(pScreen);
int i;
for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
if (cache->format != format)
continue;
if (cache->picture) {
FreePicture ((pointer) cache->picture, (XID) 0);
cache->picture = NULL;
}
if (cache->hashEntries) {
xfree(cache->hashEntries);
cache->hashEntries = NULL;
}
if (cache->glyphs) {
xfree(cache->glyphs);
cache->glyphs = NULL;
}
cache->glyphCount = 0;
}
}
/* All caches for a single format share a single pixmap for glyph storage,
* allowing mixing glyphs of different sizes without paying a penalty
* for switching between source pixmaps. (Note that for a size of font
* right at the border between two sizes, we might be switching for almost
* every glyph.)
*
* This function allocates the storage pixmap, and then fills in the
* rest of the allocated structures for all caches with the given format.
*/
static Bool
exaRealizeGlyphCaches(ScreenPtr pScreen,
unsigned int format)
{
ExaScreenPriv(pScreen);
int depth = PIXMAN_FORMAT_DEPTH(format);
PictFormatPtr pPictFormat;
PixmapPtr pPixmap;
PicturePtr pPicture;
int height;
int i;
int error;
pPictFormat = PictureMatchFormat(pScreen, depth, format);
if (!pPictFormat)
return FALSE;
/* Compute the total vertical size needed for the format */
height = 0;
for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
int rows;
if (cache->format != format)
continue;
cache->yOffset = height;
rows = (cache->size + cache->columns - 1) / cache->columns;
height += rows * cache->glyphHeight;
}
/* Now allocate the pixmap and picture */
pPixmap = (*pScreen->CreatePixmap) (pScreen,
CACHE_PICTURE_WIDTH,
height, depth, 0);
if (!pPixmap)
return FALSE;
pPicture = CreatePicture(0, &pPixmap->drawable, pPictFormat,
0, 0, serverClient, &error);
(*pScreen->DestroyPixmap) (pPixmap); /* picture holds a refcount */
if (!pPicture)
return FALSE;
/* And store the picture in all the caches for the format */
for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
int j;
if (cache->format != format)
continue;
cache->picture = pPicture;
cache->picture->refcnt++;
cache->hashEntries = xalloc(sizeof(int) * cache->hashSize);
cache->glyphs = xalloc(sizeof(ExaCachedGlyphRec) * cache->size);
cache->glyphCount = 0;
if (!cache->hashEntries || !cache->glyphs)
goto bail;
for (j = 0; j < cache->hashSize; j++)
cache->hashEntries[j] = -1;
cache->evictionPosition = rand() % cache->size;
}
/* Each cache references the picture individually */
FreePicture ((pointer) pPicture, (XID) 0);
return TRUE;
bail:
exaUnrealizeGlyphCaches(pScreen, format);
return FALSE;
}
void
exaGlyphsFini (ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
int i;
for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
if (cache->picture)
exaUnrealizeGlyphCaches(pScreen, cache->format);
}
}
static int
exaGlyphCacheHashLookup(ExaGlyphCachePtr cache,
GlyphPtr pGlyph)
{
int slot;
slot = (*(CARD32 *) pGlyph->sha1) % cache->hashSize;
while (TRUE) { /* hash table can never be full */
int entryPos = cache->hashEntries[slot];
if (entryPos == -1)
return -1;
if (memcmp(pGlyph->sha1, cache->glyphs[entryPos].sha1, sizeof(pGlyph->sha1)) == 0){
return entryPos;
}
slot--;
if (slot < 0)
slot = cache->hashSize - 1;
}
}
static void
exaGlyphCacheHashInsert(ExaGlyphCachePtr cache,
GlyphPtr pGlyph,
int pos)
{
int slot;
memcpy(cache->glyphs[pos].sha1, pGlyph->sha1, sizeof(pGlyph->sha1));
slot = (*(CARD32 *) pGlyph->sha1) % cache->hashSize;
while (TRUE) { /* hash table can never be full */
if (cache->hashEntries[slot] == -1) {
cache->hashEntries[slot] = pos;
return;
}
slot--;
if (slot < 0)
slot = cache->hashSize - 1;
}
}
static void
exaGlyphCacheHashRemove(ExaGlyphCachePtr cache,
int pos)
{
int slot;
int emptiedSlot = -1;
slot = (*(CARD32 *) cache->glyphs[pos].sha1) % cache->hashSize;
while (TRUE) { /* hash table can never be full */
int entryPos = cache->hashEntries[slot];
if (entryPos == -1)
return;
if (entryPos == pos) {
cache->hashEntries[slot] = -1;
emptiedSlot = slot;
} else if (emptiedSlot != -1) {
/* See if we can move this entry into the emptied slot, we can't
* do that if if entry would have hashed between the current position
* and the emptied slot. (taking wrapping into account). Bad positions
* are:
*
* | XXXXXXXXXX |
* i j
*
* |XXX XXXX|
* j i
*
* i - slot, j - emptiedSlot
*
* (Knuth 6.4R)
*/
int entrySlot = (*(CARD32 *) cache->glyphs[entryPos].sha1) % cache->hashSize;
if (!((entrySlot >= slot && entrySlot < emptiedSlot) ||
(emptiedSlot < slot && (entrySlot < emptiedSlot || entrySlot >= slot))))
{
cache->hashEntries[emptiedSlot] = entryPos;
cache->hashEntries[slot] = -1;
emptiedSlot = slot;
}
}
slot--;
if (slot < 0)
slot = cache->hashSize - 1;
}
}
#define CACHE_X(pos) (((pos) % cache->columns) * cache->glyphWidth)
#define CACHE_Y(pos) (cache->yOffset + ((pos) / cache->columns) * cache->glyphHeight)
/* The most efficient thing to way to upload the glyph to the screen
* is to use the UploadToScreen() driver hook; this allows us to
* pipeline glyph uploads and to avoid creating offscreen pixmaps for
* glyphs that we'll never use again.
*/
static Bool
exaGlyphCacheUploadGlyph(ScreenPtr pScreen,
ExaGlyphCachePtr cache,
int pos,
GlyphPtr pGlyph)
{
ExaScreenPriv(pScreen);
PicturePtr pGlyphPicture = GlyphPicture(pGlyph)[pScreen->myNum];
PixmapPtr pGlyphPixmap = (PixmapPtr)pGlyphPicture->pDrawable;
ExaPixmapPriv(pGlyphPixmap);
PixmapPtr pCachePixmap = (PixmapPtr)cache->picture->pDrawable;
ExaMigrationRec pixmaps[1];
int cacheXoff, cacheYoff;
if (!pExaScr->info->UploadToScreen || pExaScr->swappedOut || pExaPixmap->accel_blocked)
return FALSE;
/* If the glyph pixmap is already uploaded, no point in doing
* things this way */
if (exaPixmapIsOffscreen(pGlyphPixmap))
return FALSE;
/* UploadToScreen only works if bpp match */
if (pGlyphPixmap->drawable.bitsPerPixel != pCachePixmap->drawable.bitsPerPixel)
return FALSE;
/* cache pixmap must be offscreen. */
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pCachePixmap;
pixmaps[0].pReg = NULL;
exaDoMigration (pixmaps, 1, TRUE);
pCachePixmap = exaGetOffscreenPixmap ((DrawablePtr)pCachePixmap, &cacheXoff, &cacheYoff);
if (!pCachePixmap)
return FALSE;
if (!pExaScr->info->UploadToScreen(pCachePixmap,
CACHE_X(pos) + cacheXoff,
CACHE_Y(pos) + cacheYoff,
pGlyph->info.width,
pGlyph->info.height,
(char *)pExaPixmap->sys_ptr,
pExaPixmap->sys_pitch))
return FALSE;
exaPixmapDirty (pCachePixmap,
CACHE_X(pos) + cacheXoff,
CACHE_Y(pos) + cacheYoff,
CACHE_X(pos) + cacheXoff + pGlyph->info.width,
CACHE_Y(pos) + cacheYoff + pGlyph->info.height);
return TRUE;
}
static ExaGlyphCacheResult
exaGlyphCacheBufferGlyph(ScreenPtr pScreen,
ExaGlyphCachePtr cache,
ExaGlyphBufferPtr buffer,
GlyphPtr pGlyph,
int xGlyph,
int yGlyph)
{
ExaCompositeRectPtr rect;
int pos;
if (buffer->source && buffer->source != cache->picture)
return ExaGlyphNeedFlush;
if (!cache->picture) {
if (!exaRealizeGlyphCaches(pScreen, cache->format))
return ExaGlyphFail;
}
DBG_GLYPH_CACHE(("(%d,%d,%s): buffering glyph %lx\n",
cache->glyphWidth, cache->glyphHeight, cache->format == PICT_a8 ? "A" : "ARGB",
(long)*(CARD32 *) pGlyph->sha1));
pos = exaGlyphCacheHashLookup(cache, pGlyph);
if (pos != -1) {
DBG_GLYPH_CACHE((" found existing glyph at %d\n", pos));
} else {
if (cache->glyphCount < cache->size) {
/* Space remaining; we fill from the start */
pos = cache->glyphCount;
cache->glyphCount++;
DBG_GLYPH_CACHE((" storing glyph in free space at %d\n", pos));
exaGlyphCacheHashInsert(cache, pGlyph, pos);
} else {
/* Need to evict an entry. We have to see if any glyphs
* already in the output buffer were at this position in
* the cache
*/
pos = cache->evictionPosition;
DBG_GLYPH_CACHE((" evicting glyph at %d\n", pos));
if (buffer->count) {
int x, y;
int i;
x = CACHE_X(pos);
y = CACHE_Y(pos);
for (i = 0; i < buffer->count; i++) {
if (buffer->rects[i].xSrc == x && buffer->rects[i].ySrc == y) {
DBG_GLYPH_CACHE((" must flush buffer\n"));
return ExaGlyphNeedFlush;
}
}
}
/* OK, we're all set, swap in the new glyph */
exaGlyphCacheHashRemove(cache, pos);
exaGlyphCacheHashInsert(cache, pGlyph, pos);
/* And pick a new eviction position */
cache->evictionPosition = rand() % cache->size;
}
/* Now actually upload the glyph into the cache picture; if
* we can't do it with UploadToScreen (because the glyph is
* offscreen, etc), we fall back to CompositePicture.
*/
if (!exaGlyphCacheUploadGlyph(pScreen, cache, pos, pGlyph)) {
CompositePicture (PictOpSrc,
GlyphPicture(pGlyph)[pScreen->myNum],
None,
cache->picture,
0, 0,
0, 0,
CACHE_X(pos),
CACHE_Y(pos),
pGlyph->info.width,
pGlyph->info.height);
}
}
buffer->source = cache->picture;
rect = &buffer->rects[buffer->count];
rect->xSrc = CACHE_X(pos);
rect->ySrc = CACHE_Y(pos);
rect->xDst = xGlyph - pGlyph->info.x;
rect->yDst = yGlyph - pGlyph->info.y;
rect->width = pGlyph->info.width;
rect->height = pGlyph->info.height;
buffer->count++;
return ExaGlyphSuccess;
}
#undef CACHE_X
#undef CACHE_Y
static ExaGlyphCacheResult
exaBufferGlyph(ScreenPtr pScreen,
ExaGlyphBufferPtr buffer,
GlyphPtr pGlyph,
int xGlyph,
int yGlyph)
{
ExaScreenPriv(pScreen);
unsigned int format = (GlyphPicture(pGlyph)[pScreen->myNum])->format;
int width = pGlyph->info.width;
int height = pGlyph->info.height;
ExaCompositeRectPtr rect;
PicturePtr source;
int i;
if (buffer->count == GLYPH_BUFFER_SIZE)
return ExaGlyphNeedFlush;
if (PICT_FORMAT_BPP(format) == 1)
format = PICT_a8;
for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
if (format == cache->format &&
width <= cache->glyphWidth &&
height <= cache->glyphHeight) {
ExaGlyphCacheResult result = exaGlyphCacheBufferGlyph(pScreen, &pExaScr->glyphCaches[i],
buffer,
pGlyph, xGlyph, yGlyph);
switch (result) {
case ExaGlyphFail:
break;
case ExaGlyphSuccess:
case ExaGlyphNeedFlush:
return result;
}
}
}
/* Couldn't find the glyph in the cache, use the glyph picture directly */
source = GlyphPicture(pGlyph)[pScreen->myNum];
if (buffer->source && buffer->source != source)
return ExaGlyphNeedFlush;
buffer->source = source;
rect = &buffer->rects[buffer->count];
rect->xSrc = 0;
rect->ySrc = 0;
rect->xDst = xGlyph - pGlyph->info.x;
rect->yDst = yGlyph - pGlyph->info.y;
rect->width = pGlyph->info.width;
rect->height = pGlyph->info.height;
buffer->count++;
return ExaGlyphSuccess;
}
static void
exaGlyphsToMask(PicturePtr pMask,
ExaGlyphBufferPtr buffer)
{
exaCompositeRects(PictOpAdd, buffer->source, pMask,
buffer->count, buffer->rects);
buffer->count = 0;
buffer->source = NULL;
}
static void
exaGlyphsToDst(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
ExaGlyphBufferPtr buffer,
INT16 xSrc,
INT16 ySrc,
INT16 xDst,
INT16 yDst)
{
int i;
for (i = 0; i < buffer->count; i++) {
ExaCompositeRectPtr rect = &buffer->rects[i];
CompositePicture (op,
pSrc,
buffer->source,
pDst,
xSrc + rect->xDst - xDst,
ySrc + rect->yDst - yDst,
rect->xSrc,
rect->ySrc,
rect->xDst,
rect->yDst,
rect->width,
rect->height);
}
buffer->count = 0;
buffer->source = NULL;
}
/* Cut and paste from render/glyph.c - probably should export it instead */
static void
GlyphExtents (int nlist,
GlyphListPtr list,
GlyphPtr *glyphs,
BoxPtr extents)
{
int x1, x2, y1, y2;
int n;
GlyphPtr glyph;
int x, y;
x = 0;
y = 0;
extents->x1 = MAXSHORT;
extents->x2 = MINSHORT;
extents->y1 = MAXSHORT;
extents->y2 = MINSHORT;
while (nlist--)
{
x += list->xOff;
y += list->yOff;
n = list->len;
list++;
while (n--)
{
glyph = *glyphs++;
x1 = x - glyph->info.x;
if (x1 < MINSHORT)
x1 = MINSHORT;
y1 = y - glyph->info.y;
if (y1 < MINSHORT)
y1 = MINSHORT;
x2 = x1 + glyph->info.width;
if (x2 > MAXSHORT)
x2 = MAXSHORT;
y2 = y1 + glyph->info.height;
if (y2 > MAXSHORT)
y2 = MAXSHORT;
if (x1 < extents->x1)
extents->x1 = x1;
if (x2 > extents->x2)
extents->x2 = x2;
if (y1 < extents->y1)
extents->y1 = y1;
if (y2 > extents->y2)
extents->y2 = y2;
x += glyph->info.xOff;
y += glyph->info.yOff;
}
}
}
/**
* Returns TRUE if the glyphs in the lists intersect. Only checks based on
* bounding box, which appears to be good enough to catch most cases at least.
*/
static Bool
exaGlyphsIntersect(int nlist, GlyphListPtr list, GlyphPtr *glyphs)
{
int x1, x2, y1, y2;
int n;
GlyphPtr glyph;
int x, y;
BoxRec extents;
Bool first = TRUE;
x = 0;
y = 0;
while (nlist--) {
x += list->xOff;
y += list->yOff;
n = list->len;
list++;
while (n--) {
glyph = *glyphs++;
if (glyph->info.width == 0 || glyph->info.height == 0) {
x += glyph->info.xOff;
y += glyph->info.yOff;
continue;
}
x1 = x - glyph->info.x;
if (x1 < MINSHORT)
x1 = MINSHORT;
y1 = y - glyph->info.y;
if (y1 < MINSHORT)
y1 = MINSHORT;
x2 = x1 + glyph->info.width;
if (x2 > MAXSHORT)
x2 = MAXSHORT;
y2 = y1 + glyph->info.height;
if (y2 > MAXSHORT)
y2 = MAXSHORT;
if (first) {
extents.x1 = x1;
extents.y1 = y1;
extents.x2 = x2;
extents.y2 = y2;
first = FALSE;
} else {
if (x1 < extents.x2 && x2 > extents.x1 &&
y1 < extents.y2 && y2 > extents.y1)
{
return TRUE;
}
if (x1 < extents.x1)
extents.x1 = x1;
if (x2 > extents.x2)
extents.x2 = x2;
if (y1 < extents.y1)
extents.y1 = y1;
if (y2 > extents.y2)
extents.y2 = y2;
}
x += glyph->info.xOff;
y += glyph->info.yOff;
}
}
return FALSE;
}
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
void
exaGlyphs (CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc,
INT16 ySrc,
int nlist,
GlyphListPtr list,
GlyphPtr *glyphs)
{
PicturePtr pPicture;
PixmapPtr pMaskPixmap = 0;
PicturePtr pMask;
ScreenPtr pScreen = pDst->pDrawable->pScreen;
int width = 0, height = 0;
int x, y;
int xDst = list->xOff, yDst = list->yOff;
int n;
GlyphPtr glyph;
int error;
BoxRec extents = {0, 0, 0, 0};
CARD32 component_alpha;
ExaGlyphBuffer buffer;
/* If we don't have a mask format but all the glyphs have the same format
* and don't intersect, use the glyph format as mask format for the full
* benefits of the glyph cache.
*/
if (!maskFormat) {
Bool sameFormat = TRUE;
int i;
maskFormat = list[0].format;
for (i = 0; i < nlist; i++) {
if (maskFormat->format != list[i].format->format) {
sameFormat = FALSE;
break;
}
}
if (!sameFormat || (maskFormat->depth != 1 &&
exaGlyphsIntersect(nlist, list, glyphs))) {
maskFormat = NULL;
}
}
if (maskFormat)
{
GCPtr pGC;
xRectangle rect;
GlyphExtents (nlist, list, glyphs, &extents);
if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
return;
width = extents.x2 - extents.x1;
height = extents.y2 - extents.y1;
if (maskFormat->depth == 1) {
PictFormatPtr a8Format = PictureMatchFormat (pScreen, 8, PICT_a8);
if (a8Format)
maskFormat = a8Format;
}
pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
maskFormat->depth,
CREATE_PIXMAP_USAGE_SCRATCH);
if (!pMaskPixmap)
return;
component_alpha = NeedsComponent(maskFormat->format);
pMask = CreatePicture (0, &pMaskPixmap->drawable,
maskFormat, CPComponentAlpha, &component_alpha,
serverClient, &error);
if (!pMask)
{
(*pScreen->DestroyPixmap) (pMaskPixmap);
return;
}
pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
ValidateGC (&pMaskPixmap->drawable, pGC);
rect.x = 0;
rect.y = 0;
rect.width = width;
rect.height = height;
(*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
FreeScratchGC (pGC);
x = -extents.x1;
y = -extents.y1;
}
else
{
pMask = pDst;
x = 0;
y = 0;
}
buffer.count = 0;
buffer.source = NULL;
while (nlist--)
{
x += list->xOff;
y += list->yOff;
n = list->len;
while (n--)
{
glyph = *glyphs++;
pPicture = GlyphPicture (glyph)[pScreen->myNum];
if (glyph->info.width > 0 && glyph->info.height > 0 &&
exaBufferGlyph(pScreen, &buffer, glyph, x, y) == ExaGlyphNeedFlush)
{
if (maskFormat)
exaGlyphsToMask(pMask, &buffer);
else
exaGlyphsToDst(op, pSrc, pDst, &buffer,
xSrc, ySrc, xDst, yDst);
exaBufferGlyph(pScreen, &buffer, glyph, x, y);
}
x += glyph->info.xOff;
y += glyph->info.yOff;
}
list++;
}
if (maskFormat)
exaGlyphsToMask(pMask, &buffer);
else
exaGlyphsToDst(op, pSrc, pDst, &buffer,
xSrc, ySrc, xDst, yDst);
if (maskFormat)
{
x = extents.x1;
y = extents.y1;
CompositePicture (op,
pSrc,
pMask,
pDst,
xSrc + x - xDst,
ySrc + y - yDst,
0, 0,
x, y,
width, height);
FreePicture ((pointer) pMask, (XID) 0);
(*pScreen->DestroyPixmap) (pMaskPixmap);
}
}

View file

@ -21,11 +21,9 @@
*/
/** @file
* This allocator allocates blocks of memory by maintaining a list of areas
* and a score for each area. As an area is marked used, its score is
* incremented, and periodically all of the areas have their scores decayed by
* a fraction. When allocating, the contiguous block of areas with the minimum
* score is found and evicted in order to make room for the new allocation.
* This allocator allocates blocks of memory by maintaining a list of areas.
* When allocating, the contiguous block of areas with the minimum eviction
* cost is found and evicted in order to make room for the new allocation.
*/
#include "exa_priv.h"
@ -71,19 +69,36 @@ ExaOffscreenKickOut (ScreenPtr pScreen, ExaOffscreenArea *area)
return exaOffscreenFree (pScreen, area);
}
#define AREA_SCORE(area) (area->size / (double)(pExaScr->offScreenCounter - area->last_use))
static void
exaUpdateEvictionCost(ExaOffscreenArea *area, unsigned offScreenCounter)
{
unsigned age;
if (area->state == ExaOffscreenAvail)
return;
age = offScreenCounter - area->last_use;
/* This is unlikely to happen, but could result in a division by zero... */
if (age > (UINT_MAX / 2)) {
age = UINT_MAX / 2;
area->last_use = offScreenCounter - age;
}
area->eviction_cost = area->size / age;
}
static ExaOffscreenArea *
exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align)
{
ExaOffscreenArea *begin, *end, *best;
double score, best_score;
unsigned cost, best_cost;
int avail, real_size, tmp;
best_score = UINT_MAX;
best_cost = UINT_MAX;
begin = end = pExaScr->info->offScreenAreas;
avail = 0;
score = 0;
cost = 0;
best = 0;
while (end != NULL)
@ -106,23 +121,24 @@ exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align)
if (end->state == ExaOffscreenLocked) {
/* Can't more room here, restart after this locked area */
avail = 0;
score = 0;
cost = 0;
begin = end;
goto restart;
}
avail += end->size;
score += AREA_SCORE(end);
exaUpdateEvictionCost(end, pExaScr->offScreenCounter);
cost += end->eviction_cost;
end = end->next;
}
/* Check the score, update best */
if (avail >= real_size && score < best_score) {
/* Check the cost, update best */
if (avail >= real_size && cost < best_cost) {
best = begin;
best_score = score;
best_cost = cost;
}
avail -= begin->size;
score -= AREA_SCORE(begin);
cost -= begin->eviction_cost;
begin = begin->next;
}
@ -244,6 +260,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
new_area->state = ExaOffscreenAvail;
new_area->save = NULL;
new_area->last_use = 0;
new_area->eviction_cost = 0;
new_area->next = area->next;
area->next = new_area;
area->size = real_size;
@ -409,6 +426,7 @@ exaOffscreenFree (ScreenPtr pScreen, ExaOffscreenArea *area)
area->state = ExaOffscreenAvail;
area->save = NULL;
area->last_use = 0;
area->eviction_cost = 0;
/*
* Find previous area
*/
@ -474,6 +492,7 @@ exaOffscreenInit (ScreenPtr pScreen)
area->save = NULL;
area->next = NULL;
area->last_use = 0;
area->eviction_cost = 0;
/* Add it to the free areas */
pExaScr->info->offScreenAreas = area;

View file

@ -61,6 +61,7 @@
#define DEBUG_MIGRATE 0
#define DEBUG_PIXMAP 0
#define DEBUG_OFFSCREEN 0
#define DEBUG_GLYPH_CACHE 0
#if DEBUG_TRACE_FALL
#define EXA_FALLBACK(x) \
@ -95,6 +96,38 @@ enum ExaMigrationHeuristic {
ExaMigrationSmart
};
typedef struct {
unsigned char sha1[20];
} ExaCachedGlyphRec, *ExaCachedGlyphPtr;
typedef struct {
/* The identity of the cache, statically configured at initialization */
unsigned int format;
int glyphWidth;
int glyphHeight;
int size; /* Size of cache; eventually this should be dynamically determined */
/* Hash table mapping from glyph sha1 to position in the glyph; we use
* open addressing with a hash table size determined based on size and large
* enough so that we always have a good amount of free space, so we can
* use linear probing. (Linear probing is preferrable to double hashing
* here because it allows us to easily remove entries.)
*/
int *hashEntries;
int hashSize;
ExaCachedGlyphPtr glyphs;
int glyphCount; /* Current number of glyphs */
PicturePtr picture; /* Where the glyphs of the cache are stored */
int yOffset; /* y location within the picture where the cache starts */
int columns; /* Number of columns the glyphs are layed out in */
int evictionPosition; /* Next random position to evict a glyph */
} ExaGlyphCacheRec, *ExaGlyphCachePtr;
#define EXA_NUM_GLYPH_CACHES 4
typedef void (*EnableDisableFBAccessProcPtr)(int, Bool);
typedef struct {
ExaDriverPtr info;
@ -107,6 +140,7 @@ typedef struct {
CopyWindowProcPtr SavedCopyWindow;
ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
BitmapToRegionProcPtr SavedBitmapToRegion;
CreateScreenResourcesProcPtr SavedCreateScreenResources;
ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader;
#ifdef RENDER
CompositeProcPtr SavedComposite;
@ -122,6 +156,8 @@ typedef struct {
unsigned disableFbCount;
Bool optimize_migration;
unsigned offScreenCounter;
ExaGlyphCacheRec glyphCaches[EXA_NUM_GLYPH_CACHES];
} ExaScreenPrivRec, *ExaScreenPrivPtr;
/*
@ -209,6 +245,15 @@ typedef struct _ExaMigrationRec {
RegionPtr pReg;
} ExaMigrationRec, *ExaMigrationPtr;
typedef struct {
INT16 xSrc;
INT16 ySrc;
INT16 xDst;
INT16 yDst;
INT16 width;
INT16 height;
} ExaCompositeRectRec, *ExaCompositeRectPtr;
/**
* exaDDXDriverInit must be implemented by the DDX using EXA, and is the place
* to set EXA options or hook in screen functions to handle using EXA as the AA.
@ -429,6 +474,13 @@ exaComposite(CARD8 op,
CARD16 width,
CARD16 height);
void
exaCompositeRects(CARD8 op,
PicturePtr Src,
PicturePtr pDst,
int nrect,
ExaCompositeRectPtr rects);
void
exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
@ -439,6 +491,13 @@ exaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int ntri, xTriangle *tris);
/* exa_glyph.c */
void
exaGlyphsInit(ScreenPtr pScreen);
void
exaGlyphsFini (ScreenPtr pScreen);
void
exaGlyphs (CARD8 op,
PicturePtr pSrc,

View file

@ -51,6 +51,9 @@ static void exaCompositeFallbackPictDesc(PicturePtr pict, char *string, int n)
case PICT_a8r8g8b8:
snprintf(format, 20, "ARGB8888");
break;
case PICT_x8r8g8b8:
snprintf(format, 20, "XRGB8888");
break;
case PICT_r5g6b5:
snprintf(format, 20, "RGB565 ");
break;
@ -328,6 +331,231 @@ exaTryDriverSolidFill(PicturePtr pSrc,
return 1;
}
static int
exaTryDriverCompositeRects(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
int nrect,
ExaCompositeRectPtr rects)
{
ExaScreenPriv (pDst->pDrawable->pScreen);
int src_off_x, src_off_y, dst_off_x, dst_off_y;
PixmapPtr pSrcPix, pDstPix;
ExaPixmapPrivPtr pSrcExaPix, pDstExaPix;
struct _Pixmap scratch;
ExaMigrationRec pixmaps[2];
if (!pExaScr->info->PrepareComposite)
return -1;
pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable);
pSrcExaPix = ExaGetPixmapPriv(pSrcPix);
pDstPix = exaGetDrawablePixmap(pDst->pDrawable);
pDstExaPix = ExaGetPixmapPriv(pDstPix);
/* Check whether the accelerator can use these pixmaps.
* FIXME: If it cannot, use temporary pixmaps so that the drawing
* happens within limits.
*/
if (pSrcExaPix->accel_blocked ||
pDstExaPix->accel_blocked)
{
return -1;
}
if (pExaScr->info->CheckComposite &&
!(*pExaScr->info->CheckComposite) (op, pSrc, NULL, pDst))
{
return -1;
}
exaGetDrawableDeltas (pDst->pDrawable, pDstPix, &dst_off_x, &dst_off_y);
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = exaOpReadsDestination(op);
pixmaps[0].pPix = pDstPix;
pixmaps[0].pReg = NULL;
pixmaps[1].as_dst = FALSE;
pixmaps[1].as_src = TRUE;
pixmaps[1].pPix = pSrcPix;
pixmaps[1].pReg = NULL;
exaDoMigration(pixmaps, 2, TRUE);
pSrcPix = exaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
if (!exaPixmapIsOffscreen(pDstPix))
return 0;
if (!pSrcPix && pExaScr->info->UploadToScratch)
{
pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable);
if ((*pExaScr->info->UploadToScratch) (pSrcPix, &scratch))
pSrcPix = &scratch;
}
if (!pSrcPix)
return 0;
if (!(*pExaScr->info->PrepareComposite) (op, pSrc, NULL, pDst, pSrcPix,
NULL, pDstPix))
return -1;
while (nrect--)
{
INT16 xDst = rects->xDst + pDst->pDrawable->x;
INT16 yDst = rects->yDst + pDst->pDrawable->y;
INT16 xSrc = rects->xSrc + pSrc->pDrawable->x;
INT16 ySrc = rects->ySrc + pSrc->pDrawable->y;
RegionRec region;
BoxPtr pbox;
int nbox;
if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
xSrc, ySrc, 0, 0, xDst, yDst,
rects->width, rects->height))
goto next_rect;
REGION_TRANSLATE(pScreen, &region, dst_off_x, dst_off_y);
nbox = REGION_NUM_RECTS(&region);
pbox = REGION_RECTS(&region);
xSrc = xSrc + src_off_x - xDst - dst_off_x;
ySrc = ySrc + src_off_y - yDst - dst_off_y;
while (nbox--)
{
(*pExaScr->info->Composite) (pDstPix,
pbox->x1 + xSrc,
pbox->y1 + ySrc,
0, 0,
pbox->x1,
pbox->y1,
pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1);
pbox++;
}
next_rect:
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
rects++;
}
(*pExaScr->info->DoneComposite) (pDstPix);
exaMarkSync(pDst->pDrawable->pScreen);
return 1;
}
/**
* Copy a number of rectangles from source to destination in a single
* operation. This is specialized for building a glyph mask: we don'y
* have a mask argument because we don't need it for that, and we
* don't have he special-case fallbacks found in exaComposite() - if the
* driver can support it, we use the driver functionality, otherwise we
* fallback straight to software.
*/
void
exaCompositeRects(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
int nrect,
ExaCompositeRectPtr rects)
{
PixmapPtr pPixmap = exaGetDrawablePixmap(pDst->pDrawable);
ExaPixmapPriv(pPixmap);
int xoff, yoff;
int x1 = MAXSHORT;
int y1 = MAXSHORT;
int x2 = MINSHORT;
int y2 = MINSHORT;
RegionRec region;
RegionPtr pending_damage;
BoxRec box;
int n;
ExaCompositeRectPtr r;
/* We have to manage the damage ourselves, since CompositeRects isn't
* something in the screen that can be managed by the damage extension,
* and EXA depends on damage to track what needs to be migrated between
* offscreen and onscreen.
*/
/* Compute the overall extents of the composited region - we're making
* the assumption here that we are compositing a bunch of glyphs that
* cluster closely together and damaging each glyph individually would
* be a loss compared to damaging the bounding box.
*/
n = nrect;
r = rects;
while (n--) {
int rect_x2 = r->xDst + r->width;
int rect_y2 = r->yDst + r->width;
if (r->xDst < x1) x1 = r->xDst;
if (r->xDst < y1) y1 = r->xDst;
if (rect_x2 > x2) x2 = rect_x2;
if (rect_y2 > y2) y2 = rect_y2;
r++;
}
if (x2 <= x1 && y2 <= y1)
return;
box.x1 = x1;
box.x2 = x2 < MAXSHORT ? x2 : MAXSHORT;
box.y1 = y1;
box.y2 = y2 < MAXSHORT ? y2 : MAXSHORT;
/* The pixmap migration code relies on pendingDamage indicating
* the bounds of the current rendering, so we need to force
* the actual damage into that region before we do anything, and
* (see use of DamagePendingRegion in exaCopyDirty)
*/
REGION_INIT(pScreen, &region, &box, 1);
exaGetDrawableDeltas(pDst->pDrawable, pPixmap, &xoff, &yoff);
REGION_TRANSLATE(pScreen, &region, xoff, yoff);
pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
REGION_UNION(pScreen, pending_damage, pending_damage, &region);
REGION_TRANSLATE(pScreen, &region, -xoff, -yoff);
/************************************************************/
ValidatePicture (pSrc);
ValidatePicture (pDst);
if (exaTryDriverCompositeRects(op, pSrc, pDst, nrect, rects) != 1) {
n = nrect;
r = rects;
while (n--) {
ExaCheckComposite (op, pSrc, NULL, pDst,
r->xSrc, r->ySrc,
0, 0,
r->xDst, r->yDst,
r->width, r->height);
r++;
}
}
/************************************************************/
/* Now we have to flush the damage out from pendingDamage => damage
* Calling DamageDamageRegion has that effect. (We could pass
* in an empty region here, but we pass in the same region we
* use above; the effect is the same.)
*/
DamageDamageRegion(pDst->pDrawable, &region);
REGION_UNINIT(pScreen, &region);
}
static int
exaTryDriverComposite(CARD8 op,
PicturePtr pSrc,

View file

@ -7,7 +7,7 @@ INCLUDES = \
AM_CFLAGS = $(DIX_CFLAGS)
if XORG
sdk_HEADERS = fb.h fbrop.h fbpseudocolor.h fboverlay.h wfbrename.h
sdk_HEADERS = fb.h fbrop.h fboverlay.h wfbrename.h
endif
libfb_la_CFLAGS = $(AM_CFLAGS)
@ -49,9 +49,7 @@ libfb_la_SOURCES = \
fbtile.c \
fbtrap.c \
fbutil.c \
fbwindow.c \
fbpseudocolor.c \
fbpseudocolor.h
fbwindow.c
libwfb_la_SOURCES = $(libfb_la_SOURCES)

View file

@ -141,7 +141,7 @@ typedef unsigned __int64 FbBits;
defined(ia64) || defined(__ia64__) || \
defined(__sparc64__) || defined(_LP64) || \
defined(__s390x__) || \
defined(amd64) || defined (__amd64__) || \
defined(amd64) || defined (__amd64__) || defined(__x86_64__) || \
defined (__powerpc64__) || \
(defined(sgi) && (_MIPS_SZLONG == 64))
typedef unsigned long FbBits;

File diff suppressed because it is too large Load diff

View file

@ -1,20 +0,0 @@
#ifndef _FB_XX_H_
# define _FB_XX_H_
typedef void (*xxSyncFunc)(ScreenPtr);
extern Bool xxSetup(ScreenPtr pScreen, int myDepth,
int baseDepth, char *addr, xxSyncFunc sync);
extern void xxPrintVisuals(void);
#endif /* _FB_XX_H_ */

View file

@ -187,12 +187,4 @@
#define fbZeroSegment wfbZeroSegment
#define free_pixman_pict wfb_free_pixman_pict
#define image_from_pict wfb_image_from_pict
#define xxScrPrivateKey wfbxxScrPrivateKey
#define xxGCPrivateKey wfbxxGCPrivateKey
#define xxColormapPrivateKey wfbxxColormapPrivateKey
#define xxGeneration wfbxxGeneration
#define xxPrintVisuals wfbxxPrintVisuals
#define xxGCFuncs wfbxxGCFuncs
#define xxGCOps wfbxxGCOps
#define xxSetup wfbxxSetup
#define composeFunctions wfbComposeFunctions

View file

@ -83,8 +83,6 @@
#undef XF86MISC
#undef XFreeXDGA
#undef XF86DRI
#undef TOGCUP
#undef MITMISC
#undef SCREENSAVER
#undef RANDR
#undef XFIXES

View file

@ -1350,7 +1350,6 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
* RTContext
* TagResType
* StalledResType
* RT_APPGROUP
* SecurityAuthorizationResType
* RTEventClient
* __glXContextRes

View file

@ -1,10 +1,10 @@
if KDRIVEVESA
VESA_SUBDIRS = vesa ati chips epson i810 mach64 mga nvidia pm2 r128 \
VESA_SUBDIRS = vesa ati chips i810 mach64 mga nvidia pm2 r128 \
smi via
endif
if BUILD_KDRIVEFBDEVLIB
FBDEV_SUBDIRS = fbdev
FBDEV_SUBDIRS = fbdev epson
endif
if XFAKESERVER

View file

@ -58,6 +58,10 @@ ATI_LIBS = \
$(DRI_LIBS) \
@KDRIVE_LIBS@
if GLX
Xati_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xati_LDADD = \
$(ATI_LIBS) \
@KDRIVE_LIBS@

View file

@ -20,6 +20,10 @@ CHIPS_LIBS = \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
@KDRIVE_LIBS@
if GLX
Xchips_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xchips_LDADD = \
$(CHIPS_LIBS) \
@KDRIVE_LIBS@

View file

@ -1,517 +0,0 @@
/*
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
* (C) Copyright IBM Corporation 2004
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file dri_interface.h
*
* This file contains all the types and functions that define the interface
* between a DRI driver and driver loader. Currently, the most common driver
* loader is the XFree86 libGL.so. However, other loaders do exist, and in
* the future the server-side libglx.a will also be a loader.
*
* \author Kevin E. Martin <kevin@precisioninsight.com>
* \author Ian Romanick <idr@us.ibm.com>
*/
#ifndef DRI_INTERFACE_H
#define DRI_INTERFACE_H
#include <GL/internal/glcore.h>
#include <drm.h>
/**
* \name DRI interface structures
*
* The following structures define the interface between the GLX client
* side library and the DRI (direct rendering infrastructure).
*/
/*@{*/
typedef struct __DRIdisplayRec __DRIdisplay;
typedef struct __DRIscreenRec __DRIscreen;
typedef struct __DRIcontextRec __DRIcontext;
typedef struct __DRIdrawableRec __DRIdrawable;
typedef struct __DRIdriverRec __DRIdriver;
typedef struct __DRIframebufferRec __DRIframebuffer;
typedef struct __DRIversionRec __DRIversion;
typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods;
typedef unsigned long __DRIid;
typedef void __DRInativeDisplay;
/*@}*/
/**
* \name Functions provided by the driver loader.
*/
/*@{*/
/**
* Type of a pointer to \c glXGetScreenDriver, as returned by
* \c glXGetProcAddress. This function is used to get the name of the DRI
* driver for the specified screen of the specified display. The driver
* name is typically used with \c glXGetDriverConfig.
*
* \sa glXGetScreenDriver, glXGetProcAddress, glXGetDriverConfig
*/
typedef const char * (* PFNGLXGETSCREENDRIVERPROC) (__DRInativeDisplay *dpy, int scrNum);
/**
* Type of a pointer to \c glXGetDriverConfig, as returned by
* \c glXGetProcAddress. This function is used to get the XML document
* describing the configuration options available for the specified driver.
*
* \sa glXGetDriverConfig, glXGetProcAddress, glXGetScreenDriver
*/
typedef const char * (* PFNGLXGETDRIVERCONFIGPROC) (const char *driverName);
/**
* Type of a pointer to \c glxEnableExtension, as returned by
* \c __DRIinterfaceMethods::getProcAddress. This function is used to enable
* a GLX extension on the specified screen.
*/
typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) ( void *psc, const char * name );
/*@}*/
/**
* \name Functions and data provided by the driver.
*/
/*@{*/
typedef void *(CREATENEWSCREENFUNC)(__DRInativeDisplay *dpy, int scrn,
__DRIscreen *psc, const __GLcontextModes * modes,
const __DRIversion * ddx_version, const __DRIversion * dri_version,
const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer,
void * pSAREA, int fd, int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes);
typedef CREATENEWSCREENFUNC* PFNCREATENEWSCREENFUNC;
extern CREATENEWSCREENFUNC __driCreateNewScreen_20050727;
/**
* XML document describing the configuration options supported by the
* driver.
*/
extern const char __driConfigOptions[];
/*@}*/
/**
* Stored version of some component (i.e., server-side DRI module, kernel-side
* DRM, etc.).
*
* \todo
* There are several data structures that explicitly store a major version,
* minor version, and patch level. These structures should be modified to
* have a \c __DRIversionRec instead.
*/
struct __DRIversionRec {
int major; /**< Major version number. */
int minor; /**< Minor version number. */
int patch; /**< Patch-level. */
};
typedef void (*__DRIfuncPtr)(void);
struct __DRIinterfaceMethodsRec {
/**
* Get pointer to named function.
*/
__DRIfuncPtr (*getProcAddress)( const char * proc_name );
/**
* Create a list of \c __GLcontextModes structures.
*/
__GLcontextModes * (*createContextModes)(unsigned count,
size_t minimum_bytes_per_struct);
/**
* Destroy a list of \c __GLcontextModes structures.
*
* \todo
* Determine if the drivers actually need to call this.
*/
void (*destroyContextModes)( __GLcontextModes * modes );
/**
* Get the \c __DRIscreen for a given display and screen number.
*/
__DRIscreen *(*getScreen)(__DRInativeDisplay *dpy, int screenNum);
/**
* \name Client/server protocol functions.
*
* These functions implement the DRI client/server protocol for
* context and drawable operations. Platforms that do not implement
* the wire protocol (e.g., EGL) will implement glorified no-op functions.
*/
/*@{*/
/**
* Determine if the specified window ID still exists.
*
* \note
* Implementations may assume that the driver will only pass an ID into
* this function that actually corresponds to a window. On
* implementations where windows can only be destroyed by the DRI driver
* (e.g., EGL), this function is allowed to always return \c GL_TRUE.
*/
GLboolean (*windowExists)(__DRInativeDisplay *dpy, __DRIid draw);
/**
* Create the server-side portion of the GL context.
*/
GLboolean (* createContext)( __DRInativeDisplay *dpy, int screenNum,
int configID, void * contextID, drm_context_t * hw_context );
/**
* Destroy the server-side portion of the GL context.
*/
GLboolean (* destroyContext)( __DRInativeDisplay *dpy, int screenNum,
__DRIid context );
/**
* Create the server-side portion of the drawable.
*/
GLboolean (*createDrawable)( __DRInativeDisplay * ndpy, int screen,
__DRIid drawable, drm_drawable_t * hHWDrawable );
/**
* Destroy the server-side portion of the drawable.
*/
GLboolean (*destroyDrawable)( __DRInativeDisplay * ndpy, int screen,
__DRIid drawable );
/**
* This function is used to get information about the position, size, and
* clip rects of a drawable.
*/
GLboolean (* getDrawableInfo) ( __DRInativeDisplay *dpy, int scrn,
__DRIid draw, unsigned int * index, unsigned int * stamp,
int * x, int * y, int * width, int * height,
int * numClipRects, drm_clip_rect_t ** pClipRects,
int * backX, int * backY,
int * numBackClipRects, drm_clip_rect_t ** pBackClipRects );
/*@}*/
/**
* \name Timing related functions.
*/
/*@{*/
/**
* Get the 64-bit unadjusted system time (UST).
*/
int (*getUST)(int64_t * ust);
/**
* Get the media stream counter (MSC) rate.
*
* Matching the definition in GLX_OML_sync_control, this function returns
* the rate of the "media stream counter". In practical terms, this is
* the frame refresh rate of the display.
*/
GLboolean (*getMSCRate)(__DRInativeDisplay * dpy, __DRIid drawable,
int32_t * numerator, int32_t * denominator);
/*@}*/
/**
* Reports areas of the given drawable which have been modified by the
* driver.
*
* \param drawable which the drawing was done to.
* \param rects rectangles affected, with the drawable origin as the
* origin.
* \param x X offset of the drawable within the screen (used in the
* front_buffer case)
* \param y Y offset of the drawable within the screen.
* \param front_buffer boolean flag for whether the drawing to the
* drawable was actually done directly to the front buffer (instead
* of backing storage, for example)
*/
void (*reportDamage)(__DRInativeDisplay * dpy, int screen,
__DRIid drawable,
int x, int y,
drm_clip_rect_t *rects, int num_rects,
int front_buffer);
};
/**
* Framebuffer information record. Used by libGL to communicate information
* about the framebuffer to the driver's \c __driCreateNewScreen function.
*
* In XFree86, most of this information is derrived from data returned by
* calling \c XF86DRIGetDeviceInfo.
*
* \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen
* __driUtilCreateNewScreen CallCreateNewScreen
*
* \bug This structure could be better named.
*/
struct __DRIframebufferRec {
unsigned char *base; /**< Framebuffer base address in the CPU's
* address space. This value is calculated by
* calling \c drmMap on the framebuffer handle
* returned by \c XF86DRIGetDeviceInfo (or a
* similar function).
*/
int size; /**< Framebuffer size, in bytes. */
int stride; /**< Number of bytes from one line to the next. */
int width; /**< Pixel width of the framebuffer. */
int height; /**< Pixel height of the framebuffer. */
int dev_priv_size; /**< Size of the driver's dev-priv structure. */
void *dev_priv; /**< Pointer to the driver's dev-priv structure. */
};
/**
* Screen dependent methods. This structure is initialized during the
* \c __DRIdisplayRec::createScreen call.
*/
struct __DRIscreenRec {
/**
* Method to destroy the private DRI screen data.
*/
void (*destroyScreen)(__DRInativeDisplay *dpy, int scrn, void *screenPrivate);
/**
* Method to create the private DRI drawable data and initialize the
* drawable dependent methods.
*/
void *(*createNewDrawable)(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
__DRIid draw, __DRIdrawable *pdraw,
int renderType, const int *attrs);
/**
* Method to return a pointer to the DRI drawable data.
*/
__DRIdrawable *(*getDrawable)(__DRInativeDisplay *dpy, __DRIid draw,
void *drawablePrivate);
/**
* Opaque pointer to private per screen direct rendering data. \c NULL
* if direct rendering is not supported on this screen. Never
* dereferenced in libGL.
*/
void *private;
/**
* Get the number of vertical refreshes since some point in time before
* this function was first called (i.e., system start up).
*
* \since Internal API version 20030317.
*/
int (*getMSC)( void *screenPrivate, int64_t *msc );
/**
* Opaque pointer that points back to the containing
* \c __GLXscreenConfigs. This data structure is shared with DRI drivers
* but \c __GLXscreenConfigs is not. However, they are needed by some GLX
* functions called by DRI drivers.
*
* \since Internal API version 20030813.
*/
void *screenConfigs;
/**
* Functions associated with MESA_allocate_memory.
*
* \since Internal API version 20030815.
*/
/*@{*/
void *(*allocateMemory)(__DRInativeDisplay *dpy, int scrn, GLsizei size,
GLfloat readfreq, GLfloat writefreq,
GLfloat priority);
void (*freeMemory)(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer);
GLuint (*memoryOffset)(__DRInativeDisplay *dpy, int scrn, const GLvoid *pointer);
/*@}*/
/**
* Method to create the private DRI context data and initialize the
* context dependent methods.
*
* \since Internal API version 20031201.
*/
void * (*createNewContext)(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
int render_type,
void *sharedPrivate, __DRIcontext *pctx);
/**
* Method to override base texture image with a driver specific 'offset'.
* The depth passed in allows e.g. to ignore the alpha channel of texture
* images where the non-alpha components don't occupy a whole texel.
*
* For GLX_EXT_texture_from_pixmap with AIGLX.
*
* \since Internal API version 20070121.
*/
void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
unsigned long long offset, GLint depth, GLuint pitch);
};
/**
* Context dependent methods. This structure is initialized during the
* \c __DRIscreenRec::createContext call.
*/
struct __DRIcontextRec {
/**
* Method to destroy the private DRI context data.
*/
void (*destroyContext)(__DRInativeDisplay *dpy, int scrn, void *contextPrivate);
/**
* Opaque pointer to private per context direct rendering data.
* \c NULL if direct rendering is not supported on the display or
* screen used to create this context. Never dereferenced in libGL.
*/
void *private;
/**
* Pointer to the mode used to create this context.
*
* \since Internal API version 20040317.
*/
const __GLcontextModes * mode;
/**
* Method to bind a DRI drawable to a DRI graphics context.
*
* \since Internal API version 20050727.
*/
GLboolean (*bindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw,
__DRIid read, __DRIcontext *ctx);
/**
* Method to unbind a DRI drawable from a DRI graphics context.
*
* \since Internal API version 20050727.
*/
GLboolean (*unbindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw,
__DRIid read, __DRIcontext *ctx);
};
/**
* Drawable dependent methods. This structure is initialized during the
* \c __DRIscreenRec::createDrawable call. \c createDrawable is not called
* by libGL at this time. It's currently used via the dri_util.c utility code
* instead.
*/
struct __DRIdrawableRec {
/**
* Method to destroy the private DRI drawable data.
*/
void (*destroyDrawable)(__DRInativeDisplay *dpy, void *drawablePrivate);
/**
* Method to swap the front and back buffers.
*/
void (*swapBuffers)(__DRInativeDisplay *dpy, void *drawablePrivate);
/**
* Opaque pointer to private per drawable direct rendering data.
* \c NULL if direct rendering is not supported on the display or
* screen used to create this drawable. Never dereferenced in libGL.
*/
void *private;
/**
* Get the number of completed swap buffers for this drawable.
*
* \since Internal API version 20030317.
*/
int (*getSBC)(__DRInativeDisplay *dpy, void *drawablePrivate, int64_t *sbc );
/**
* Wait for the SBC to be greater than or equal target_sbc.
*
* \since Internal API version 20030317.
*/
int (*waitForSBC)( __DRInativeDisplay * dpy, void *drawablePriv,
int64_t target_sbc,
int64_t * msc, int64_t * sbc );
/**
* Wait for the MSC to equal target_msc, or, if that has already passed,
* the next time (MSC % divisor) is equal to remainder. If divisor is
* zero, the function will return as soon as MSC is greater than or equal
* to target_msc.
*
* \since Internal API version 20030317.
*/
int (*waitForMSC)( __DRInativeDisplay * dpy, void *drawablePriv,
int64_t target_msc, int64_t divisor, int64_t remainder,
int64_t * msc, int64_t * sbc );
/**
* Like \c swapBuffers, but does NOT have an implicit \c glFlush. Once
* rendering is complete, waits until MSC is equal to target_msc, or
* if that has already passed, waits until (MSC % divisor) is equal
* to remainder. If divisor is zero, the swap will happen as soon as
* MSC is greater than or equal to target_msc.
*
* \since Internal API version 20030317.
*/
int64_t (*swapBuffersMSC)(__DRInativeDisplay *dpy, void *drawablePrivate,
int64_t target_msc,
int64_t divisor, int64_t remainder);
/**
* Enable or disable frame usage tracking.
*
* \since Internal API version 20030317.
*/
int (*frameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate, GLboolean enable);
/**
* Retrieve frame usage information.
*
* \since Internal API version 20030317.
*/
int (*queryFrameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate,
int64_t * sbc, int64_t * missedFrames,
float * lastMissedUsage, float * usage );
/**
* Used by drivers that implement the GLX_SGI_swap_control or
* GLX_MESA_swap_control extension.
*
* \since Internal API version 20030317.
*/
unsigned swap_interval;
/**
* Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
*
* \since Internal API version 20060314.
*/
void (*copySubBuffer)(__DRInativeDisplay *dpy, void *drawablePrivate,
int x, int y, int w, int h);
};
#endif

View file

@ -1,89 +1,90 @@
INCLUDES = \
@KDRIVE_INCS@ \
@KDRIVE_CFLAGS@ \
-I$(srcdir)/../../../exa
INCLUDES = \
@KDRIVE_INCS@ \
@KDRIVE_CFLAGS@ \
@XEPHYR_INCS@ \
@XEPHYR_CFLAGS@ \
@DRIPROTO_CFLAGS@ \
-I$(top_srcdir) \
-I$(top_srcdir)/exa
if XV
LIBXEPHYR_HOSTXV=libxephyr-hostxv.a
else
LIBXEPHYR_HOSTXV=
LIBXEPHYR_HOSTXV=libxephyr-hostxv.a
endif
if XEPHYR_HAS_DRI
LIBXEPHYR_HOSTDRI=libxephyr-hostdri.a
else
LIBXEPHYR_HOSTDRI=
if DRI
LIBXEPHYR_HOSTDRI=libxephyr-hostdri.a
endif
noinst_LIBRARIES = libxephyr-hostx.a $(LIBXEPHYR_HOSTXV) $(LIBXEPHYR_HOSTDRI) libxephyr.a
bin_PROGRAMS = Xephyr
libxephyr_hostx_a_SOURCES = \
hostx.c \
HOSTX_SRCS = \
hostx.c \
hostx.h
libxephyr_hostxv_a_INCLUDES = @XEPHYR_INCS@
HOSTVIDEO_SRCS = \
ephyrvideo.c \
ephyrhostvideo.c \
ephyrhostvideo.h
HOSTDRI_SRCS = \
ephyrdriext.c \
ephyrdriext.h \
ephyrdri.c \
ephyrdri.h \
XF86dri.c \
xf86dri.h \
ephyrglxext.c \
ephyrglxext.h \
ephyrhostglx.c \
ephyrhostglx.h
XEPHYR_SRCS = \
ephyr.c \
ephyr.h \
ephyrlog.h \
ephyr_draw.c \
os.c
libxephyr_hostx_a_SOURCES = $(HOSTX_SRCS)
if XV
libxephyr_hostxv_a_SOURCES= \
ephyrhostvideo.c \
ephyrhostvideo.h
libxephyr_hostxv_a_SOURCES = $(HOSTVIDEO_SRCS)
endif
if XEPHYR_HAS_DRI
libxephyr_hostdri_a_SOURCES= \
ephyrdriext.c \
ephyrdriext.h \
ephyrdri.c \
ephyrdri.h \
XF86dri.c \
ephyrglxext.c \
ephyrglxext.h \
ephyrhostglx.c \
ephyrhostglx.h
libxephyr_hostdri_a_CFLAGS= \
-I$(top_srcdir) \
@LIBDRM_CFLAGS@ \
@DRIPROTO_CFLAGS@
if DRI
libxephyr_hostdri_a_SOURCES = $(HOSTDRI_SRCS)
endif
libxephyr_a_SOURCES = \
ephyr.c \
ephyr_draw.c \
ephyrvideo.c \
os.c \
hostx.h \
ephyr.h \
ephyrlog.h
libxephyr_a_CFLAGS = \
-I$(top_srcdir) \
@LIBDRM_CFLAGS@
libxephyr_a_SOURCES = $(XEPHYR_SRCS)
Xephyr_SOURCES = \
ephyrinit.c
if GLX
Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xephyr_LDADD = \
libxephyr.a \
libxephyr-hostx.a \
libxephyr-hostx.a \
$(LIBXEPHYR_HOSTXV) \
$(LIBXEPHYR_HOSTDRI) \
../../../exa/libexa.la \
$(top_builddir)/exa/libexa.la \
@KDRIVE_LIBS@ \
@XEPHYR_LIBS@ \
@LIBDRM_LIBS@ \
@XEPHYR_DRI_LIBS@
@XEPHYR_LIBS@
Xephyr_DEPENDENCIES = \
libxephyr.a \
libxephyr-hostx.a \
libxephyr-hostx.a \
$(LIBXEPHYR_HOSTXV) \
$(LIBXEPHYR_HOSTDRI) \
@KDRIVE_LOCAL_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
EXTRA_DIST = \
$(HOSTVIDEO_SRCS) \
$(HOSTDRI_SRCS)

View file

@ -46,8 +46,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <kdrive-config.h>
#endif
#ifdef XEPHYR_DRI
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#define NEED_REPLIES
@ -55,9 +53,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
#include <GL/glx.h>
#include <X11/dri/xf86dri.h>
#include "xf86dri.h"
#include <X11/dri/xf86dristr.h>
#include "GL/internal/dri_interface.h"
static XExtensionInfo _xf86dri_info_data;
static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
@ -640,5 +637,3 @@ XF86DRICloseFullScreen(Display *dpy, int screen, Drawable drawable)
(void) drawable;
return True;
}
#endif /*EPHYR_DRI*/

View file

@ -32,11 +32,11 @@
#include "scrnintstr.h"
#include "ephyrlog.h"
#ifdef XEPHYR_DRI
#ifdef XF86DRI
#include "ephyrdri.h"
#include "ephyrdriext.h"
#include "ephyrglxext.h"
#endif /*XEPHYR_DRI*/
#endif /* XF86DRI */
extern int KdTsPhyScreen;
#ifdef GLXEXT
@ -150,11 +150,22 @@ ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
screen->fb[0].depth = 16;
screen->fb[0].bitsPerPixel = 16;
}
else
else if (screen->fb[0].depth <= 24)
{
screen->fb[0].depth = 24;
screen->fb[0].bitsPerPixel = 32;
}
else if (screen->fb[0].depth <= 30)
{
screen->fb[0].depth = 30;
screen->fb[0].bitsPerPixel = 32;
}
else
{
ErrorF("\nXephyr: Unsupported screen depth %d\n",
screen->fb[0].depth);
return FALSE;
}
hostx_get_visual_masks (screen, &redMask, &greenMask, &blueMask);
@ -631,7 +642,7 @@ ephyrInitScreen (ScreenPtr pScreen)
}
#endif /*XV*/
#ifdef XEPHYR_DRI
#ifdef XF86DRI
if (!ephyrNoDRI && !hostx_has_dri ()) {
EPHYR_LOG ("host x does not support DRI. Disabling DRI forwarding\n") ;
ephyrNoDRI = TRUE ;
@ -841,7 +852,7 @@ miPointerScreenFuncRec ephyrPointerScreenFuncs =
ephyrWarpCursor
};
#ifdef XEPHYR_DRI
#ifdef XF86DRI
/**
* find if the remote window denoted by a_remote
* is paired with an internal Window within the Xephyr server.
@ -873,7 +884,7 @@ ephyrExposePairedWindow (int a_remote)
screen->WindowExposures (pair->local, &reg, NullRegion);
REGION_UNINIT (screen, &reg);
}
#endif /*XEPHYR_DRI*/
#endif /* XF86DRI */
void
ephyrPoll(void)
@ -908,14 +919,14 @@ ephyrPoll(void)
else
{
int x=0, y=0;
#ifdef XEPHYR_DRI
#ifdef XF86DRI
EphyrWindowPair *pair = NULL;
#endif
EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ;
x = ev.data.mouse_motion.x;
y = ev.data.mouse_motion.y;
EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ;
#ifdef XEPHYR_DRI
#ifdef XF86DRI
EPHYR_LOG ("is this window peered by a gl drawable ?\n") ;
if (findWindowPairFromRemote (ev.data.mouse_motion.window,
&pair))
@ -972,7 +983,7 @@ ephyrPoll(void)
KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE);
break;
#ifdef XEPHYR_DRI
#ifdef XF86DRI
case EPHYR_EV_EXPOSE:
/*
* We only receive expose events when the expose event have
@ -982,7 +993,7 @@ ephyrPoll(void)
*/
ephyrExposePairedWindow (ev.data.expose.window);
break;
#endif /*XEPHYR_DRI*/
#endif /* XF86DRI */
default:
break;

View file

@ -29,13 +29,10 @@
#include <kdrive-config.h>
#endif
#ifdef XEPHYR_DRI
#include <X11/Xutil.h>
#include <X11/Xlibint.h>
/*#define _XF86DRI_SERVER_*/
#include <GL/glx.h>
#include <X11/dri/xf86dri.h>
#include "xf86dri.h"
#include "hostx.h"
#include "ephyrdri.h"
#define _HAVE_XALLOC_DECLS
@ -287,5 +284,3 @@ ephyrDRIGetDeviceInfo (int a_screen,
EPHYR_LOG ("leave:%d\n", is_ok) ;
return is_ok ;
}
#endif /*EPHYR_DRI*/

View file

@ -32,8 +32,6 @@
#include <kdrive-config.h>
#endif
#ifdef XEPHYR_DRI
#include <string.h>
#define NEED_REPLIES
@ -1439,5 +1437,3 @@ SProcXF86DRIDispatch (register ClientPtr client)
}
}
}
#endif /*XEPHYR_DRI*/

View file

@ -42,8 +42,6 @@
#include "hostx.h"
#ifdef XEPHYR_DRI
#ifndef TRUE
#define TRUE 1
#endif
@ -727,6 +725,3 @@ ephyrGLXIsDirectSwap (__GLXclientState *a_cl, GLbyte *a_pc)
{
return ephyrGLXIsDirectReal (a_cl, a_pc, TRUE) ;
}
#endif /*XEPHYR_DRI*/

View file

@ -41,7 +41,6 @@
#include "ephyrlog.h"
#include "hostx.h"
#ifdef XEPHYR_DRI
enum VisualConfRequestType {
EPHYR_GET_FB_CONFIG,
EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
@ -687,6 +686,3 @@ out:
EPHYR_LOG ("leave\n") ;
return is_ok ;
}
#endif /*XEPHYR_DRI*/

View file

@ -45,12 +45,12 @@
#include <X11/keysym.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/shape.h>
#ifdef XEPHYR_DRI
#ifdef XF86DRI
#include <GL/glx.h>
#endif /*XEPHYR_DRI*/
#endif /* XF86DRI */
#include "ephyrlog.h"
#ifdef XEPHYR_DRI
#ifdef XF86DRI
extern Bool XF86DRIQueryExtension (Display *dpy,
int *event_basep,
int *error_basep);
@ -1315,7 +1315,7 @@ hostx_has_xshape (void)
return TRUE;
}
#ifdef XEPHYR_DRI
#ifdef XF86DRI
typedef struct {
int is_valid ;
int local_id ;
@ -1418,5 +1418,4 @@ hostx_has_glx (void)
return TRUE ;
}
#endif /*XEPHYR_DRI*/
#endif /* XF86DRI */

View file

@ -244,7 +244,7 @@ int hostx_set_window_clipping_rectangles (int a_window,
int a_num_rects) ;
int hostx_has_xshape (void) ;
#ifdef XEPHYR_DRI
#ifdef XF86DRI
int hostx_lookup_peer_window (void *a_local_window,
int *a_host_peer /*out parameter*/) ;
int
@ -256,6 +256,6 @@ hostx_get_resource_id_peer (int a_local_resource_id,
int hostx_has_dri (void) ;
int hostx_has_glx (void) ;
#endif /*XEPHYR_DRI*/
#endif /* XF86DRI */
#endif /*_XLIBS_STUFF_H_*/

120
hw/kdrive/ephyr/xf86dri.h Normal file
View file

@ -0,0 +1,120 @@
/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.8 2002/10/30 12:51:25 alanh Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/**
* \file xf86dri.h
* Protocol numbers and function prototypes for DRI X protocol.
*
* \author Kevin E. Martin <martin@valinux.com>
* \author Jens Owen <jens@tungstengraphics.com>
* \author Rickard E. (Rik) Faith <faith@valinux.com>
*/
#ifndef _XF86DRI_H_
#define _XF86DRI_H_
#include <X11/Xfuncproto.h>
#include <xf86drm.h>
#define X_XF86DRIQueryVersion 0
#define X_XF86DRIQueryDirectRenderingCapable 1
#define X_XF86DRIOpenConnection 2
#define X_XF86DRICloseConnection 3
#define X_XF86DRIGetClientDriverName 4
#define X_XF86DRICreateContext 5
#define X_XF86DRIDestroyContext 6
#define X_XF86DRICreateDrawable 7
#define X_XF86DRIDestroyDrawable 8
#define X_XF86DRIGetDrawableInfo 9
#define X_XF86DRIGetDeviceInfo 10
#define X_XF86DRIAuthConnection 11
#define X_XF86DRIOpenFullScreen 12 /* Deprecated */
#define X_XF86DRICloseFullScreen 13 /* Deprecated */
#define XF86DRINumberEvents 0
#define XF86DRIClientNotLocal 0
#define XF86DRIOperationNotSupported 1
#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1)
#ifndef _XF86DRI_SERVER_
_XFUNCPROTOBEGIN
Bool XF86DRIQueryExtension( Display *dpy, int *event_base, int *error_base );
Bool XF86DRIQueryVersion( Display *dpy, int *majorVersion, int *minorVersion,
int *patchVersion );
Bool XF86DRIQueryDirectRenderingCapable( Display *dpy, int screen,
Bool *isCapable );
Bool XF86DRIOpenConnection( Display *dpy, int screen, drm_handle_t *hSAREA,
char **busIDString );
Bool XF86DRIAuthConnection( Display *dpy, int screen, drm_magic_t magic );
Bool XF86DRICloseConnection( Display *dpy, int screen );
Bool XF86DRIGetClientDriverName( Display *dpy, int screen,
int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
int *ddxDriverPatchVersion, char **clientDriverName );
Bool XF86DRICreateContext( Display *dpy, int screen, Visual *visual,
XID *ptr_to_returned_context_id, drm_context_t *hHWContext );
Bool XF86DRICreateContextWithConfig( Display *dpy, int screen, int configID,
XID *ptr_to_returned_context_id, drm_context_t *hHWContext );
extern GLboolean XF86DRIDestroyContext( Display *dpy, int screen,
XID context_id );
extern GLboolean XF86DRICreateDrawable( Display *dpy, int screen,
XID drawable, drm_drawable_t *hHWDrawable );
extern GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen,
XID drawable);
Bool XF86DRIGetDrawableInfo( Display *dpy, int screen, Drawable drawable,
unsigned int *index, unsigned int *stamp,
int *X, int *Y, int *W, int *H,
int *numClipRects, drm_clip_rect_t ** pClipRects,
int *backX, int *backY,
int *numBackClipRects, drm_clip_rect_t **pBackClipRects );
Bool XF86DRIGetDeviceInfo( Display *dpy, int screen,
drm_handle_t *hFrameBuffer, int *fbOrigin, int *fbSize,
int *fbStride, int *devPrivateSize, void **pDevPrivate );
_XFUNCPROTOEND
#endif /* _XF86DRI_SERVER_ */
#endif /* _XF86DRI_H_ */

View file

@ -20,6 +20,10 @@ EPSON_LIBS = \
libepson.a \
@KDRIVE_LIBS@
if GLX
Xepson_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xepson_LDADD = \
$(EPSON_LIBS) \
@KDRIVE_LIBS@

View file

@ -16,6 +16,10 @@ libfake_a_SOURCES = \
Xfake_SOURCES = \
fakeinit.c
if GLX
Xfake_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xfake_LDADD = \
libfake.a \
@KDRIVE_LIBS@ \

View file

@ -14,6 +14,10 @@ bin_PROGRAMS = Xfbdev
Xfbdev_SOURCES = \
fbinit.c
if GLX
Xfbdev_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xfbdev_LDADD = \
libfbdev.a \
@KDRIVE_LIBS@

View file

@ -179,16 +179,24 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
screen->rate = 103; /* FIXME: should get proper value from fb driver */
}
if (!screen->fb[0].depth)
screen->fb[0].depth = 16;
{
if (k >= 0)
screen->fb[0].depth = var.bits_per_pixel;
else
screen->fb[0].depth = 16;
}
t = KdFindMode (screen, fbdevModeSupported);
screen->rate = t->rate;
screen->width = t->horizontal;
screen->height = t->vertical;
if ((screen->width != var.xres) || (screen->height != var.yres))
{
t = KdFindMode (screen, fbdevModeSupported);
screen->rate = t->rate;
screen->width = t->horizontal;
screen->height = t->vertical;
/* Now try setting the mode */
if (k < 0 || (t->horizontal != var.xres || t->vertical != var.yres))
fbdevConvertMonitorTiming (t, &var);
/* Now try setting the mode */
if (k < 0 || (t->horizontal != var.xres || t->vertical != var.yres))
fbdevConvertMonitorTiming (t, &var);
}
var.activate = FB_ACTIVATE_NOW;
var.bits_per_pixel = screen->fb[0].depth;

View file

@ -23,6 +23,10 @@ I810_LIBS = \
libi810.a \
@KDRIVE_LIBS@
if GLX
Xi810_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xi810_LDADD = \
$(I810_LIBS) \
@KDRIVE_LIBS@

View file

@ -42,6 +42,8 @@
#include <sys/ioctl.h>
extern int LinuxConsoleFd;
static unsigned char mediumraw_data, mediumraw_up;
static enum { DEFAULT, EXTBYTE1, EXTBYTE2 } mediumraw_state = DEFAULT;
static const KeySym linux_to_x[256] = {
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
@ -701,7 +703,29 @@ LinuxKeyboardRead (int fd, void *closure)
else
#endif
scancode = b[0] & 0x7f;
KdEnqueueKeyboardEvent (closure, scancode, b[0] & 0x80);
/* This is extended medium raw mode interpreter
see linux/drivers/keyboard.c (kbd->kbdmode == VC_MEDIUMRAW) */
switch (mediumraw_state)
{
case DEFAULT:
if (scancode == 0)
{
mediumraw_state = EXTBYTE1;
mediumraw_up = b[0] & 0x80;
}
else
KdEnqueueKeyboardEvent (closure, scancode, b[0] & 0x80);
break;
case EXTBYTE1:
mediumraw_data = scancode;
mediumraw_state = EXTBYTE2;
break;
case EXTBYTE2:
/* Note: Only codes < 256 will pass correctly through KdEnqueueKeyboardEvent() */
KdEnqueueKeyboardEvent (closure, (int)mediumraw_data << 7 | scancode, mediumraw_up);
mediumraw_state = DEFAULT;
break;
}
b++;
}
}

View file

@ -114,6 +114,10 @@ TslibEnable (KdPointerInfo *pi)
private->raw_event_hook = NULL;
private->raw_event_closure = NULL;
if (!pi->path) {
pi->path = "/dev/input/touchscreen0";
ErrorF("[tslib/TslibEnable] no device path given, trying %s\n", pi->path);
}
private->tsDev = ts_open(pi->path, 0);
private->fd = ts_fd(private->tsDev);
if (!private->tsDev || ts_config(private->tsDev) || private->fd < 0) {

View file

@ -27,6 +27,10 @@ MACH64_LIBS = \
$(top_builddir)/hw/kdrive/vesa/libvesa.a
if GLX
Xmach64_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xmach64_LDADD = \
$(MACH64_LIBS) \
@KDRIVE_LIBS@

View file

@ -22,6 +22,10 @@ MGA_LIBS = \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
@KDRIVE_LIBS@
if GLX
Xmga_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xmga_LDADD = \
$(MGA_LIBS) \
@KDRIVE_LIBS@

View file

@ -32,6 +32,10 @@ NEOMAGIC_LIBS = \
${VESA_LIBS} \
@KDRIVE_LIBS@
if GLX
Xneomagic_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xneomagic_LDADD = \
$(NEOMAGIC_LIBS) \
@KDRIVE_LIBS@ \

View file

@ -23,6 +23,10 @@ NVIDIA_LIBS = \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
@KDRIVE_LIBS@
if GLX
Xnvidia_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xnvidia_LDADD = \
$(NVIDIA_LIBS) \
@KDRIVE_LIBS@

View file

@ -21,6 +21,10 @@ PM2_LIBS = \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
@KDRIVE_LIBS@
if GLX
Xpm2_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xpm2_LDADD = \
$(PM2_LIBS) \
@KDRIVE_LIBS@

View file

@ -20,6 +20,10 @@ R128_LIBS = \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
@KDRIVE_LIBS@
if GLX
Xr128_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xr128_LDADD = \
$(R128_LIBS) \
@KDRIVE_LIBS@

View file

@ -7,6 +7,10 @@ bin_PROGRAMS = Xsdl
Xsdl_SOURCES = sdl.c
if GLX
Xsdl_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xsdl_LDADD = \
@KDRIVE_LIBS@ \
@XSDL_LIBS@

View file

@ -34,6 +34,10 @@ SIS_LIBS = \
$(VESA_LIBS) \
@KDRIVE_LIBS@
if GLX
Xsis_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xsis_LDADD = \
$(SIS_LIBS) \
@KDRIVE_LIBS@ \

View file

@ -25,6 +25,10 @@ SMI_LIBS = \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
@KDRIVE_LIBS@
if GLX
Xsmi_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xsmi_LDADD = \
$(SMI_LIBS) \
@KDRIVE_LIBS@

View file

@ -19,6 +19,10 @@ libvesa_a_SOURCES = \
Xvesa_SOURCES = \
vesainit.c
if GLX
Xvesa_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xvesa_LDADD = \
libvesa.a \
@KDRIVE_LIBS@

View file

@ -21,6 +21,10 @@ VIA_LIBS = \
libvia.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a
if GLX
Xvia_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
endif
Xvia_LDADD = \
$(VIA_LIBS) \
@KDRIVE_LIBS@

View file

@ -498,7 +498,7 @@ extern unsigned int inb(unsigned long port);
extern unsigned int inw(unsigned long port);
extern unsigned int inl(unsigned long port);
# elif defined(linux) && defined(__amd64__)
# elif defined(linux) && (defined(__amd64__) || defined(__x86_64__))
# include <inttypes.h>
@ -1363,7 +1363,7 @@ do { \
# define write_mem_barrier() /* NOP */
# if !defined(__SUNPRO_C)
# if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__)
# if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__m32r__)
# ifdef GCCUSESGAS
/*
@ -1472,7 +1472,7 @@ inl(unsigned short port)
# endif /* GCCUSESGAS */
# else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__)*/
# else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__m32r__) */
static __inline__ void
outb(unsigned short port, unsigned char val)

View file

@ -71,6 +71,7 @@ extern Bool sbusSlotClaimed;
#endif
extern confDRIRec xf86ConfigDRI;
extern Bool xf86inSuspend;
extern Bool xf86DRI2Enabled(void);
#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \
xf86ScreenKey))

View file

@ -146,7 +146,11 @@ videoPtrToDriverName(struct pci_device *dev)
switch (dev->vendor_id)
{
case 0x1022: return "amd";
case 0x1022:
if (dev->device_id == 0x2081)
return "geode";
else
return NULL;
case 0x1142: return "apm";
case 0xedd8: return "ark";
case 0x1a03: return "ast";
@ -326,86 +330,87 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
int i, j;
idsdir = opendir(PCI_TXT_IDS_PATH);
if (idsdir) {
xf86Msg(X_INFO, "Scanning %s directory for additional PCI ID's supported by the drivers\n", PCI_TXT_IDS_PATH);
direntry = readdir(idsdir);
/* Read the directory */
while (direntry) {
if (direntry->d_name[0] == '.') {
direntry = readdir(idsdir);
continue;
}
len = strlen(direntry->d_name);
/* A tiny bit of sanity checking. We should probably do better */
if (strncmp(&(direntry->d_name[len-4]), ".ids", 4) == 0) {
/* We need the full path name to open the file */
strncpy(path_name, PCI_TXT_IDS_PATH, 256);
strncat(path_name, "/", 1);
strncat(path_name, direntry->d_name, (256 - strlen(path_name) - 1));
fp = fopen(path_name, "r");
if (fp == NULL) {
xf86Msg(X_ERROR, "Could not open %s for reading. Exiting.\n", path_name);
goto end;
}
/* Read the file */
#ifdef __GLIBC__
while ((read = getline(&line, &len, fp)) != -1) {
#else
while ((line = fgetln(fp, &len)) != (char *)NULL) {
#endif /* __GLIBC __ */
xchomp(line);
if (isdigit(line[0])) {
strncpy(vendor_str, line, 4);
vendor_str[4] = '\0';
vendor = (int)strtol(vendor_str, NULL, 16);
if ((strlen(&line[4])) == 0) {
chip_str[0] = '\0';
chip = -1;
} else {
/* Handle trailing whitespace */
if (isspace(line[4])) {
chip_str[0] = '\0';
chip = -1;
} else {
/* Ok, it's a real ID */
strncpy(chip_str, &line[4], 4);
chip_str[4] = '\0';
chip = (int)strtol(chip_str, NULL, 16);
}
}
if (vendor == match_vendor && chip == match_chip ) {
i = 0;
while (matches[i]) {
i++;
}
matches[i] = (char*)xalloc(sizeof(char) * strlen(direntry->d_name) - 3);
if (!matches[i]) {
xf86Msg(X_ERROR, "Could not allocate space for the module name. Exiting.\n");
goto end;
}
/* hack off the .ids suffix. This should guard
* against other problems, but it will end up
* taking off anything after the first '.' */
for (j = 0; j < (strlen(direntry->d_name) - 3) ; j++) {
if (direntry->d_name[j] == '.') {
matches[i][j] = '\0';
break;
} else {
matches[i][j] = direntry->d_name[j];
}
}
xf86Msg(X_INFO, "Matched %s from file name %s\n", matches[i], direntry->d_name);
}
} else {
/* TODO Handle driver overrides here */
}
}
fclose(fp);
}
if (!idsdir)
return;
xf86Msg(X_INFO, "Scanning %s directory for additional PCI ID's supported by the drivers\n", PCI_TXT_IDS_PATH);
direntry = readdir(idsdir);
/* Read the directory */
while (direntry) {
if (direntry->d_name[0] == '.') {
direntry = readdir(idsdir);
continue;
}
len = strlen(direntry->d_name);
/* A tiny bit of sanity checking. We should probably do better */
if (strncmp(&(direntry->d_name[len-4]), ".ids", 4) == 0) {
/* We need the full path name to open the file */
strncpy(path_name, PCI_TXT_IDS_PATH, 256);
strncat(path_name, "/", 1);
strncat(path_name, direntry->d_name, (256 - strlen(path_name) - 1));
fp = fopen(path_name, "r");
if (fp == NULL) {
xf86Msg(X_ERROR, "Could not open %s for reading. Exiting.\n", path_name);
goto end;
}
/* Read the file */
#ifdef __GLIBC__
while ((read = getline(&line, &len, fp)) != -1) {
#else
while ((line = fgetln(fp, &len)) != (char *)NULL) {
#endif /* __GLIBC __ */
xchomp(line);
if (isdigit(line[0])) {
strncpy(vendor_str, line, 4);
vendor_str[4] = '\0';
vendor = (int)strtol(vendor_str, NULL, 16);
if ((strlen(&line[4])) == 0) {
chip_str[0] = '\0';
chip = -1;
} else {
/* Handle trailing whitespace */
if (isspace(line[4])) {
chip_str[0] = '\0';
chip = -1;
} else {
/* Ok, it's a real ID */
strncpy(chip_str, &line[4], 4);
chip_str[4] = '\0';
chip = (int)strtol(chip_str, NULL, 16);
}
}
if (vendor == match_vendor && chip == match_chip ) {
i = 0;
while (matches[i]) {
i++;
}
matches[i] = (char*)xalloc(sizeof(char) * strlen(direntry->d_name) - 3);
if (!matches[i]) {
xf86Msg(X_ERROR, "Could not allocate space for the module name. Exiting.\n");
goto end;
}
/* hack off the .ids suffix. This should guard
* against other problems, but it will end up
* taking off anything after the first '.' */
for (j = 0; j < (strlen(direntry->d_name) - 3) ; j++) {
if (direntry->d_name[j] == '.') {
matches[i][j] = '\0';
break;
} else {
matches[i][j] = direntry->d_name[j];
}
}
xf86Msg(X_INFO, "Matched %s from file name %s\n", matches[i], direntry->d_name);
}
} else {
/* TODO Handle driver overrides here */
}
}
fclose(fp);
}
direntry = readdir(idsdir);
}
end:
end:
xfree(line);
closedir(idsdir);
}
@ -449,7 +454,7 @@ chooseVideoDriver(void)
if (info != NULL)
chosen_driver = videoPtrToDriverName(info);
if (chosen_driver == NULL) {
#if defined __i386__ || defined __amd64__ || defined __hurd__
#if defined __i386__ || defined __amd64__ || defined __x86_64__ || defined __hurd__
chosen_driver = "vesa";
#elif defined __sparc__
chosen_driver = "sunffb";

View file

@ -2773,7 +2773,7 @@ xf86FindPrimaryDevice()
}
}
#if !defined(__sparc) && !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__arm__)
#if !defined(__sparc) && !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__arm__) && !defined(__m32r__)
#include "vgaHW.h"
#include "compiler.h"
#endif
@ -2785,7 +2785,7 @@ static void
CheckGenericGA()
{
/* This needs to be changed for multiple domains */
#if !defined(__sparc__) && !defined(__sparc) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__arm__) && !defined(__s390__)
#if !defined(__sparc__) && !defined(__sparc) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__)
IOADDRESS GenericIOBase = VGAHW_GET_IOBASE();
CARD8 CurrentValue, TestValue;

View file

@ -766,6 +766,7 @@ typedef enum {
FLAG_AUTO_ADD_DEVICES,
FLAG_AUTO_ENABLE_DEVICES,
FLAG_GLX_VISUALS,
FLAG_DRI2,
} FlagValues;
static OptionInfoRec FlagOptions[] = {
@ -837,16 +838,18 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_ALLOW_EMPTY_INPUT, "AllowEmptyInput", OPTV_BOOLEAN,
{0}, FALSE },
{ FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
{ FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
{0}, FALSE },
{ FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
{ FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
{0}, FALSE },
{ FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN,
{ FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN,
{0}, TRUE },
{ FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN,
{ FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN,
{0}, TRUE },
{ FLAG_GLX_VISUALS, "GlxVisuals", OPTV_STRING,
{0}, FALSE },
{ FLAG_DRI2, "DRI2", OPTV_BOOLEAN,
{0}, FALSE },
{ -1, NULL, OPTV_NONE,
{0}, FALSE },
};
@ -1179,9 +1182,23 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Msg(from, "Xinerama: enabled\n");
#endif
#ifdef DRI2
xf86Info.dri2 = FALSE;
xf86Info.dri2From = X_DEFAULT;
if (xf86GetOptValBool(FlagOptions, FLAG_DRI2, &value)) {
xf86Info.dri2 = value;
xf86Info.dri2From = X_CONFIG;
}
#endif
return TRUE;
}
Bool xf86DRI2Enabled(void)
{
return xf86Info.dri2;
}
/*
* Locate the core input devices. These can be specified/located in
* the following ways, in order of priority:

View file

@ -1123,37 +1123,35 @@ InitInput(argc, argv)
xf86Info.vtRequestsPending = FALSE;
xf86Info.inputPending = FALSE;
if (serverGeneration == 1) {
/* Call the PreInit function for each input device instance. */
for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
/* Replace obsolete keyboard driver with kbd */
if (!xf86NameCmp((*pDev)->driver, "keyboard")) {
strcpy((*pDev)->driver, "kbd");
}
/* Call the PreInit function for each input device instance. */
for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
/* Replace obsolete keyboard driver with kbd */
if (!xf86NameCmp((*pDev)->driver, "keyboard")) {
strcpy((*pDev)->driver, "kbd");
}
if ((pDrv = xf86LookupInputDriver((*pDev)->driver)) == NULL) {
xf86Msg(X_ERROR, "No Input driver matching `%s'\n", (*pDev)->driver);
/* XXX For now, just continue. */
continue;
}
if (!pDrv->PreInit) {
xf86MsgVerb(X_WARNING, 0,
"Input driver `%s' has no PreInit function (ignoring)\n",
pDrv->driverName);
continue;
}
pInfo = pDrv->PreInit(pDrv, *pDev, 0);
if (!pInfo) {
xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n",
(*pDev)->identifier);
continue;
} else if (!(pInfo->flags & XI86_CONFIGURED)) {
xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
(*pDev)->identifier);
xf86DeleteInput(pInfo, 0);
continue;
}
}
if ((pDrv = xf86LookupInputDriver((*pDev)->driver)) == NULL) {
xf86Msg(X_ERROR, "No Input driver matching `%s'\n", (*pDev)->driver);
/* XXX For now, just continue. */
continue;
}
if (!pDrv->PreInit) {
xf86MsgVerb(X_WARNING, 0,
"Input driver `%s' has no PreInit function (ignoring)\n",
pDrv->driverName);
continue;
}
pInfo = pDrv->PreInit(pDrv, *pDev, 0);
if (!pInfo) {
xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n",
(*pDev)->identifier);
continue;
} else if (!(pInfo->flags & XI86_CONFIGURED)) {
xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
(*pDev)->identifier);
xf86DeleteInput(pInfo, 0);
continue;
}
}
/* Initialise all input devices. */

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