Merge accel_indirect branch to HEAD.
This commit is contained in:
parent
b1b731c286
commit
c3342c8000
118
ChangeLog
118
ChangeLog
|
@ -1,3 +1,121 @@
|
|||
2006-03-10 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* Merge accel_indirect branch to HEAD.
|
||||
|
||||
2006-03-05 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/glxcmds.c (DoGetDrawableAttributes): Add
|
||||
GLX_Y_INVERTED_EXT to the drawable attributes we report.
|
||||
|
||||
2006-03-05 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/glxcmds.c (__glXCreateARGBConfig): Create the fbconfig
|
||||
for the composite 32 visual after the fact here.
|
||||
|
||||
* GL/glx/glxdri.c (__glXDRIbindTexImage): Use 4bpp for 32 bit
|
||||
visuals too, but only fill the alpha channel for 24 depth
|
||||
drawables.
|
||||
|
||||
2006-03-03 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/glxdri.c (getDrawableInfo): Work around i915 driver that
|
||||
tries to render to drawable even if it no longer exists.
|
||||
Returning 0 cliprects (as dri_util.c does) doesn't seem to do it,
|
||||
so we set the width and height to 0.
|
||||
|
||||
* GL/glx/g_disptab.h:
|
||||
* GL/glx/glxcmdsswap.c: Fix a couple of warnings.
|
||||
|
||||
2006-03-03 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/glxdri.c (__glXDRIscreenProbe): Log full DRI driver path
|
||||
when dlopen() fails.
|
||||
|
||||
* GL/glx/glxscreens.c (__glXInitScreens): Log the provider name
|
||||
when we initialize a GLX screen.
|
||||
|
||||
* GL/symlink-mesa.sh:
|
||||
* GL/mesa/swrast/Makefile.am: Update to work with mesa head.
|
||||
|
||||
2006-03-01 Kevin E. Martin <kem-at-freedesktop-dot-org>
|
||||
|
||||
* GL/glx/glxdri.c: (__glXDRIscreenProbe):
|
||||
Pass err_msg when dev_priv allocation fails.
|
||||
|
||||
2006-03-01 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/glxdri.c (__glXDRIscreenProbe): Handle failing allocation
|
||||
of dev_priv.
|
||||
|
||||
* GL/glx/glxdri.c (__glXDRIscreenProbe): The DRI driver
|
||||
_mesa_free()'s the dev_priv passed in so we need to give it a
|
||||
copy.
|
||||
|
||||
2006-03-01 Kevin E. Martin <kem-at-freedesktop-dot-org>
|
||||
|
||||
* GL/glx/glxserver.h:
|
||||
Fix Xvfb, Xnest and Xprt build.
|
||||
|
||||
2006-02-28 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/glxdri.c (__glXDRIscreenProbe): Fix enter/leave confusion.
|
||||
|
||||
* configure.ac:
|
||||
* hw/xfree86/common/xf86Config.c (configServerFlags): Enable AIGLX
|
||||
by default at configure time and at runtime.
|
||||
|
||||
2006-02-27 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/glxserver.h:
|
||||
* GL/glx/glxext.c:
|
||||
* GL/mesa/X/xf86glx.c: Complete the prepare/finish dispatch to
|
||||
enter/leave server rename.
|
||||
|
||||
* GL/glx/glxcmdsswap.c (__glXSwapGetDrawableAttributesSGIX): Add
|
||||
byte swapping function.
|
||||
|
||||
* GL/mesa/swrast/Makefile.am (INCLUDES): Add -I../shader/slang.
|
||||
|
||||
* GL/glx/glxcmds.c: Make GLX_EXT_texture_from_pixmap entrypoints
|
||||
non-static so we can get at them from glxcmdsswap.c.
|
||||
|
||||
2006-02-25 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/glxcmds.c: Add more GLX_EXT_texture_from_pixmap tokens
|
||||
here as a temporary fix.
|
||||
|
||||
2006-02-24 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/glxcmds.c:
|
||||
* GL/glx/glxcmdsswap.c:
|
||||
* GL/glx/glxcontext.h:
|
||||
* GL/glx/glxdri.c:
|
||||
* GL/glx/glxscreens.c:
|
||||
* GL/glx/glxserver.h: Add hooks for GLX_EXT_texture_from_pixmap
|
||||
and port over naive glTexImage2D implementation. Add support for
|
||||
glXQueryDrawable.
|
||||
|
||||
2006-02-24 Kevin E. Martin <kem-at-freedesktop-dot-org>
|
||||
|
||||
* GL/glx/Makefile.am:
|
||||
Include from Mesa sources before any installed versions.
|
||||
|
||||
* GL/glx/glxdri.c: (__glXDRIleaveServer), (__glXDRIenterServer),
|
||||
(createContext), (destroyContext), (createDrawable),
|
||||
(destroyDrawable), (getDrawableInfo), (__glXDRIscreenProbe):
|
||||
Wrap the __DRIinterfaceMethods methods with enter/leaveServer to
|
||||
make sure server locks are held when calling into the card driver.
|
||||
|
||||
2006-02-24 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/glxdri.c:
|
||||
* GL/glx/glxvisuals.c: Add these files.
|
||||
|
||||
2006-02-24 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/*: Land rewritten accelerated indirect rendering on
|
||||
accel_indirect_branch.
|
||||
|
||||
2006-03-10 Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
|
||||
* hw/xfree86/utils/xorgcfg/help.c:
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
noinst_LTLIBRARIES = libglx.la
|
||||
if AIGLX
|
||||
GLXDRI_LIBRARY = libglxdri.la
|
||||
endif
|
||||
|
||||
noinst_LTLIBRARIES = libglx.la $(GLXDRI_LIBRARY)
|
||||
|
||||
AM_CFLAGS = \
|
||||
-I@MESA_SOURCE@/include \
|
||||
@DIX_CFLAGS@ \
|
||||
@GL_CFLAGS@ \
|
||||
@XLIB_CFLAGS@ \
|
||||
-I@MESA_SOURCE@/include \
|
||||
@LIBDRM_CFLAGS@ \
|
||||
@DRIPROTO_CFLAGS@ \
|
||||
-I@MESA_SOURCE@/src/mesa/glapi \
|
||||
-I@MESA_SOURCE@/src/mesa/main \
|
||||
@SERVER_DEFINES@ \
|
||||
|
@ -15,10 +21,20 @@ AM_CFLAGS = \
|
|||
# none yet
|
||||
#sdk_HEADERS =
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/GL/include -I$(top_srcdir)/hw/xfree86/os-support
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir)/GL/include \
|
||||
-I$(top_srcdir)/hw/xfree86/os-support \
|
||||
-I$(top_srcdir)/hw/xfree86/os-support/bus \
|
||||
-I$(top_srcdir)/hw/xfree86/common \
|
||||
-I$(top_srcdir)/hw/xfree86/dri \
|
||||
-I$(top_srcdir)/mi
|
||||
|
||||
|
||||
nodist_libglx_la_SOURCES = indirect_size.h
|
||||
|
||||
libglxdri_la_SOURCES = \
|
||||
glxdri.c
|
||||
|
||||
libglx_la_SOURCES = \
|
||||
g_disptab.c \
|
||||
g_disptab.h \
|
||||
|
@ -29,8 +45,6 @@ libglx_la_SOURCES = \
|
|||
glcontextmodes.h \
|
||||
global.c \
|
||||
glthread.c \
|
||||
glxbuf.c \
|
||||
glxbuf.h \
|
||||
glxcmds.c \
|
||||
glxcmdsswap.c \
|
||||
glxcontext.h \
|
||||
|
@ -38,14 +52,7 @@ libglx_la_SOURCES = \
|
|||
glxerror.h \
|
||||
glxext.c \
|
||||
glxext.h \
|
||||
glxfb.c \
|
||||
glxfb.h \
|
||||
glximports.c \
|
||||
glximports.h \
|
||||
glxmem.c \
|
||||
glxmem.h \
|
||||
glxpix.c \
|
||||
glxpix.h \
|
||||
glxvisuals.c \
|
||||
glxscreens.c \
|
||||
glxscreens.h \
|
||||
glxserver.h \
|
||||
|
|
|
@ -46,6 +46,9 @@ extern int __glXWaitGL(__GLXclientState*, GLbyte*);
|
|||
extern int __glXWaitX(__GLXclientState*, GLbyte*);
|
||||
extern int __glXCopyContext(__GLXclientState*, GLbyte*);
|
||||
extern int __glXSwapBuffers(__GLXclientState*, GLbyte*);
|
||||
extern int __glXBindTexImageEXT(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXGetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXUseXFont(__GLXclientState*, GLbyte*);
|
||||
extern int __glXCreateGLXPixmap(__GLXclientState*, GLbyte*);
|
||||
extern int __glXGetVisualConfigs(__GLXclientState*, GLbyte*);
|
||||
|
@ -71,6 +74,9 @@ extern int __glXSwapWaitGL(__GLXclientState*, GLbyte*);
|
|||
extern int __glXSwapWaitX(__GLXclientState*, GLbyte*);
|
||||
extern int __glXSwapCopyContext(__GLXclientState*, GLbyte*);
|
||||
extern int __glXSwapSwapBuffers(__GLXclientState*, GLbyte*);
|
||||
extern int __glXSwapBindTexImageEXT(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXSwapReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXSwapGetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
extern int __glXSwapUseXFont(__GLXclientState*, GLbyte*);
|
||||
extern int __glXSwapCreateGLXPixmap(__GLXclientState*, GLbyte*);
|
||||
extern int __glXSwapGetVisualConfigs(__GLXclientState*, GLbyte*);
|
||||
|
|
|
@ -53,6 +53,7 @@ __GLXcontext *__glXLastContext;
|
|||
RESTYPE __glXContextRes;
|
||||
RESTYPE __glXClientRes;
|
||||
RESTYPE __glXPixmapRes;
|
||||
RESTYPE __glXDrawableRes;
|
||||
RESTYPE __glXSwapBarrierRes;
|
||||
|
||||
/*
|
||||
|
|
296
GL/glx/glxbuf.c
296
GL/glx/glxbuf.c
|
@ -1,296 +0,0 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.c,v 1.6 2001/03/25 05:32:01 tsi Exp $ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
#include "glxbuf.h"
|
||||
#include "glxfb.h"
|
||||
#include "glxmem.h"
|
||||
#include "glxpix.h"
|
||||
|
||||
void
|
||||
__glXFBInitDrawable(__GLXdrawablePrivate *glxPriv, __GLcontextModes *modes)
|
||||
{
|
||||
__GLdrawablePrivate *glPriv;
|
||||
GLint rgbBits;
|
||||
GLint accumBits;
|
||||
|
||||
glPriv = &glxPriv->glPriv;
|
||||
rgbBits = modes->rgbBits;
|
||||
accumBits = modes->accumRedBits + modes->accumGreenBits +
|
||||
modes->accumBlueBits + modes->accumAlphaBits;
|
||||
|
||||
#if defined(__GL_ALIGNED_BUFFERS)
|
||||
/* initialize pixel alignments (for more details see context.h) */
|
||||
glPriv->xAlignment = 1;
|
||||
glPriv->yAlignment = 1;
|
||||
#endif
|
||||
|
||||
glxPriv->swapBuffers = __glXFBMemSwapBuffers;
|
||||
|
||||
glPriv->yInverted = GL_TRUE; /* Y is upside-down */
|
||||
|
||||
if (modes->doubleBufferMode) {
|
||||
if (modes->colorIndexMode) {
|
||||
__glXInitFB(&glPriv->frontBuffer, glPriv, modes->indexBits);
|
||||
__glXInitMem(&glPriv->backBuffer, glPriv, modes->indexBits);
|
||||
} else {
|
||||
__glXInitFB(&glPriv->frontBuffer, glPriv, rgbBits);
|
||||
__glXInitMem(&glPriv->backBuffer, glPriv, rgbBits);
|
||||
}
|
||||
} else {
|
||||
if (modes->colorIndexMode) {
|
||||
__glXInitFB(&glPriv->frontBuffer, glPriv, modes->indexBits);
|
||||
} else {
|
||||
__glXInitFB(&glPriv->frontBuffer, glPriv, rgbBits);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0)
|
||||
if (modes->maxAuxBuffers > 0) {
|
||||
GLint i;
|
||||
|
||||
for (i=0; i < modes->maxAuxBuffers; i++) {
|
||||
if (modes->colorIndexMode) {
|
||||
__glXInitMem(&glPriv->auxBuffer[i], glPriv, modes->indexBits);
|
||||
} else {
|
||||
__glXInitMem(&glPriv->auxBuffer[i], glPriv, rgbBits);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (modes->haveAccumBuffer) {
|
||||
__glXInitMem(&glPriv->accumBuffer, glPriv, accumBits);
|
||||
}
|
||||
if (modes->haveDepthBuffer) {
|
||||
__glXInitMem(&glPriv->depthBuffer, glPriv, modes->depthBits);
|
||||
}
|
||||
if (modes->haveStencilBuffer) {
|
||||
__glXInitMem(&glPriv->stencilBuffer, glPriv, modes->stencilBits);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__glXPixInitDrawable(__GLXdrawablePrivate *glxPriv, __GLcontextModes *modes)
|
||||
{
|
||||
__GLdrawablePrivate *glPriv;
|
||||
GLint rgbBits;
|
||||
GLint accumBits;
|
||||
|
||||
assert(glxPriv->pGlxPixmap);
|
||||
|
||||
glPriv = &glxPriv->glPriv;
|
||||
rgbBits = modes->rgbBits;
|
||||
accumBits = modes->accumRedBits + modes->accumGreenBits +
|
||||
modes->accumBlueBits + modes->accumAlphaBits;
|
||||
|
||||
#if defined(__GL_ALIGNED_BUFFERS)
|
||||
/* initialize pixel alignments (for more details see context.h) */
|
||||
glPriv->xAlignment = 1;
|
||||
glPriv->yAlignment = 1;
|
||||
#endif
|
||||
|
||||
glxPriv->swapBuffers = (GLboolean (*)(__GLXdrawablePrivate *))__glXNop;
|
||||
|
||||
glPriv->yInverted = GL_FALSE;
|
||||
|
||||
if (modes->doubleBufferMode) {
|
||||
if (modes->colorIndexMode) {
|
||||
__glXInitPix(&glPriv->frontBuffer, glPriv, rgbBits,
|
||||
glxPriv->drawId, glxPriv->pGlxPixmap);
|
||||
__glXInitMem(&glPriv->backBuffer, glPriv, modes->indexBits);
|
||||
} else {
|
||||
__glXInitPix(&glPriv->frontBuffer, glPriv, rgbBits,
|
||||
glxPriv->drawId, glxPriv->pGlxPixmap);
|
||||
__glXInitMem(&glPriv->backBuffer, glPriv, rgbBits);
|
||||
}
|
||||
} else {
|
||||
if (modes->colorIndexMode) {
|
||||
__glXInitPix(&glPriv->frontBuffer, glPriv, rgbBits,
|
||||
glxPriv->drawId, glxPriv->pGlxPixmap);
|
||||
} else {
|
||||
__glXInitPix(&glPriv->frontBuffer, glPriv, rgbBits,
|
||||
glxPriv->drawId, glxPriv->pGlxPixmap);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0)
|
||||
if (modes->maxAuxBuffers > 0) {
|
||||
GLint i;
|
||||
|
||||
for (i=0; i < modes->maxAuxBuffers; i++) {
|
||||
if (modes->colorIndexMode) {
|
||||
__glXInitMem(&glPriv->auxBuffer[i], glPriv, modes->indexBits);
|
||||
} else {
|
||||
__glXInitMem(&glPriv->auxBuffer[i], glPriv, rgbBits);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (modes->haveAccumBuffer) {
|
||||
__glXInitMem(&glPriv->accumBuffer, glPriv, accumBits);
|
||||
}
|
||||
if (modes->haveDepthBuffer) {
|
||||
__glXInitMem(&glPriv->depthBuffer, glPriv, modes->depthBits);
|
||||
}
|
||||
if (modes->haveStencilBuffer) {
|
||||
__glXInitMem(&glPriv->stencilBuffer, glPriv, modes->stencilBits);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define __GLX_SET_ACCEL_BUFFER_MASK(bm) \
|
||||
if (status == GL_FALSE) return GL_FALSE; \
|
||||
if (status == GL_TRUE) accelBufferMask |= bm; \
|
||||
/* for __GL_BUFFER_FALLBACK don't do anything */
|
||||
|
||||
GLboolean
|
||||
__glXResizeBuffers(__GLdrawablePrivate *glPriv,
|
||||
GLint x, GLint y, GLuint width, GLuint height)
|
||||
{
|
||||
__GLcontextModes *modes;
|
||||
__GLdrawableRegion *glRegion;
|
||||
GLboolean status;
|
||||
GLuint accelBufferMask;
|
||||
|
||||
modes = glPriv->modes;
|
||||
accelBufferMask = 0;
|
||||
|
||||
status = (*glPriv->frontBuffer.resize)(&glPriv->frontBuffer,
|
||||
x, y, width, height, glPriv,
|
||||
__GL_FRONT_BUFFER_MASK);
|
||||
__GLX_SET_ACCEL_BUFFER_MASK(__GL_FRONT_BUFFER_MASK);
|
||||
|
||||
if (modes->doubleBufferMode) {
|
||||
status = (*glPriv->backBuffer.resize)(&glPriv->backBuffer,
|
||||
x, y, width, height, glPriv,
|
||||
__GL_BACK_BUFFER_MASK);
|
||||
__GLX_SET_ACCEL_BUFFER_MASK(__GL_BACK_BUFFER_MASK);
|
||||
}
|
||||
|
||||
#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0)
|
||||
if (modes->maxAuxBuffers > 0) {
|
||||
GLint i;
|
||||
|
||||
for (i=0; i < modes->maxAuxBuffers; i++) {
|
||||
status = (*glPriv->auxBuffers[i].resize)(&glPriv->auxBuffer[i],
|
||||
x, y, width, height,
|
||||
glPriv,
|
||||
__GL_AUX_BUFFER_MASK(i));
|
||||
__GLX_SET_ACCEL_BUFFER_MASK(__GL_AUX_BUFFER_MASK(i));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (modes->haveAccumBuffer) {
|
||||
status = (*glPriv->accumBuffer.resize)(&glPriv->accumBuffer,
|
||||
x, y, width, height, glPriv,
|
||||
__GL_ACCUM_BUFFER_MASK);
|
||||
__GLX_SET_ACCEL_BUFFER_MASK(__GL_ACCUM_BUFFER_MASK);
|
||||
}
|
||||
|
||||
if (modes->haveDepthBuffer) {
|
||||
status = (*glPriv->depthBuffer.resize)(&glPriv->depthBuffer,
|
||||
x, y, width, height, glPriv,
|
||||
__GL_DEPTH_BUFFER_MASK);
|
||||
__GLX_SET_ACCEL_BUFFER_MASK(__GL_DEPTH_BUFFER_MASK);
|
||||
}
|
||||
|
||||
if (modes->haveStencilBuffer) {
|
||||
status = (*glPriv->stencilBuffer.resize)(&glPriv->stencilBuffer,
|
||||
x, y, width, height, glPriv,
|
||||
__GL_STENCIL_BUFFER_MASK);
|
||||
__GLX_SET_ACCEL_BUFFER_MASK(__GL_STENCIL_BUFFER_MASK);
|
||||
}
|
||||
|
||||
glPriv->accelBufferMask = accelBufferMask;
|
||||
|
||||
/* finally, update the ownership region */
|
||||
glRegion = &glPriv->ownershipRegion;
|
||||
glRegion->numRects = 1;
|
||||
glRegion->rects[0].x0 = 0;
|
||||
glRegion->rects[0].y0 = 0;
|
||||
glRegion->rects[0].x1 = width;
|
||||
glRegion->rects[0].y1 = height;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
__glXFreeBuffers(__GLXdrawablePrivate *glxPriv)
|
||||
{
|
||||
__GLdrawablePrivate *glPriv = &glxPriv->glPriv;
|
||||
#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0)
|
||||
__GLcontextModes *modes = glPriv->modes;
|
||||
#endif
|
||||
|
||||
if (glPriv->frontBuffer.free) {
|
||||
(*glPriv->frontBuffer.free)(&glPriv->frontBuffer, glPriv);
|
||||
}
|
||||
if (glPriv->backBuffer.free) {
|
||||
(*glPriv->backBuffer.free)(&glPriv->backBuffer, glPriv);
|
||||
}
|
||||
|
||||
#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0)
|
||||
if (modes->maxAuxBuffers > 0) {
|
||||
GLint i;
|
||||
|
||||
for (i=0; i < modes->maxAuxBuffers; i++) {
|
||||
if (glPriv->auxBuffer[i].free) {
|
||||
(*glPriv->auxBuffer[i].free)(&glPriv->auxBuffer[i], glPriv);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (glPriv->accumBuffer.free) {
|
||||
(*glPriv->accumBuffer.free)(&glPriv->accumBuffer, glPriv);
|
||||
}
|
||||
|
||||
if (glPriv->depthBuffer.free) {
|
||||
(*glPriv->depthBuffer.free)(&glPriv->depthBuffer, glPriv);
|
||||
}
|
||||
|
||||
if (glPriv->stencilBuffer.free) {
|
||||
(*glPriv->stencilBuffer.free)(&glPriv->stencilBuffer, glPriv);
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
/* $XFree86$ */
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef _glxbuf_h_
|
||||
#define _glxbuf_h_
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
*/
|
||||
|
||||
extern void __glXFBInitDrawable(__GLXdrawablePrivate *glxPriv,
|
||||
__GLcontextModes *modes);
|
||||
extern void __glXPixInitDrawable(__GLXdrawablePrivate *glxPriv,
|
||||
__GLcontextModes *modes);
|
||||
|
||||
extern GLboolean __glXResizeBuffers(__GLdrawablePrivate *glPriv,
|
||||
GLint x, GLint y,
|
||||
GLuint width, GLuint height);
|
||||
|
||||
extern void __glXFreeBuffers(__GLXdrawablePrivate *glxPriv);
|
||||
extern void __glXUpdatePalette(__GLXdrawablePrivate *);
|
||||
|
||||
#endif /* _glxbuf_h_ */
|
||||
|
330
GL/glx/glxcmds.c
330
GL/glx/glxcmds.c
|
@ -49,7 +49,6 @@
|
|||
#include <pixmapstr.h>
|
||||
#include <windowstr.h>
|
||||
#include "g_disptab_EXT.h"
|
||||
#include "glximports.h"
|
||||
#include "glxutil.h"
|
||||
#include "glxext.h"
|
||||
#include "GL/glx_ansic.h"
|
||||
|
@ -61,24 +60,6 @@
|
|||
|
||||
/************************************************************************/
|
||||
|
||||
static __GLimports imports = {
|
||||
__glXImpMalloc,
|
||||
__glXImpCalloc,
|
||||
__glXImpRealloc,
|
||||
__glXImpFree,
|
||||
__glXImpWarning,
|
||||
__glXImpFatal,
|
||||
__glXImpGetenv,
|
||||
__glXImpAtoi,
|
||||
__glXImpSprintf,
|
||||
__glXImpFopen,
|
||||
__glXImpFclose,
|
||||
__glXImpFprintf,
|
||||
__glXImpGetDrawablePrivate,
|
||||
__glXImpGetReadablePrivate,
|
||||
NULL
|
||||
};
|
||||
|
||||
static int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
static int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
static int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc);
|
||||
|
@ -94,6 +75,27 @@ static int __glxHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc);
|
|||
|
||||
/************************************************************************/
|
||||
|
||||
static void __glXdirectContextDestroy(__GLXcontext *context)
|
||||
{
|
||||
__glXFree(context);
|
||||
}
|
||||
|
||||
static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXcontext *shareContext)
|
||||
{
|
||||
__GLXcontext *context;
|
||||
|
||||
context = __glXMalloc (sizeof (__GLXcontext));
|
||||
if (context == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(context, 0, sizeof *context);
|
||||
context->destroy = __glXdirectContextDestroy;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a GL context with the given properties. This routine is used
|
||||
* to implement \c glXCreateContext, \c glXCreateNewContext, and
|
||||
|
@ -111,8 +113,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
|||
ScreenPtr pScreen;
|
||||
__GLXcontext *glxc, *shareglxc;
|
||||
__GLcontextModes *modes;
|
||||
__GLXscreenInfo *pGlxScreen;
|
||||
__GLinterface *shareGC;
|
||||
__GLXscreen *pGlxScreen;
|
||||
GLint i;
|
||||
|
||||
LEGAL_NEW_RESOURCE(gcId, client);
|
||||
|
@ -125,7 +126,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
|||
return BadValue;
|
||||
}
|
||||
pScreen = screenInfo.screens[screen];
|
||||
pGlxScreen = &__glXActiveScreens[screen];
|
||||
pGlxScreen = __glXActiveScreens[screen];
|
||||
|
||||
/*
|
||||
** Check if the visual ID is valid for this screen.
|
||||
|
@ -167,7 +168,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
|||
** for multithreaded servers, we don't do this.
|
||||
*/
|
||||
if (shareList == None) {
|
||||
shareGC = 0;
|
||||
shareglxc = 0;
|
||||
} else {
|
||||
shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes);
|
||||
if (!shareglxc) {
|
||||
|
@ -193,17 +194,18 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
|||
*/
|
||||
isDirect = GL_FALSE;
|
||||
}
|
||||
shareGC = shareglxc->gc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Allocate memory for the new context
|
||||
*/
|
||||
glxc = (__GLXcontext *) __glXMalloc(sizeof(__GLXcontext));
|
||||
if (!isDirect)
|
||||
glxc = pGlxScreen->createContext(pGlxScreen, modes, shareglxc);
|
||||
else
|
||||
glxc = __glXdirectContextCreate(pGlxScreen, modes, shareglxc);
|
||||
if (!glxc) {
|
||||
return BadAlloc;
|
||||
}
|
||||
__glXMemset(glxc, 0, sizeof(__GLXcontext));
|
||||
|
||||
/*
|
||||
** Initially, setup the part of the context that could be used by
|
||||
|
@ -214,32 +216,11 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
|||
glxc->pVisual = pVisual;
|
||||
glxc->modes = modes;
|
||||
|
||||
if (!isDirect) {
|
||||
|
||||
/*
|
||||
** Allocate a GL context
|
||||
*/
|
||||
imports.other = (void *)glxc;
|
||||
glxc->gc = (*pGlxScreen->createContext)(&imports, glxc->modes, shareGC);
|
||||
if (!glxc->gc) {
|
||||
__glXFree(glxc);
|
||||
client->errorValue = gcId;
|
||||
return BadAlloc;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
** Don't need local GL context for a direct context.
|
||||
*/
|
||||
glxc->gc = 0;
|
||||
}
|
||||
/*
|
||||
** Register this context as a resource.
|
||||
*/
|
||||
if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
|
||||
if (!isDirect) {
|
||||
(*glxc->gc->exports.destroyContext)((__GLcontext *)glxc->gc);
|
||||
}
|
||||
__glXFree(glxc);
|
||||
(*glxc->destroy)(glxc);
|
||||
client->errorValue = gcId;
|
||||
return BadAlloc;
|
||||
}
|
||||
|
@ -520,9 +501,8 @@ int DoMakeCurrent( __GLXclientState *cl,
|
|||
__GLXpixmap *drawPixmap = NULL;
|
||||
__GLXpixmap *readPixmap = NULL;
|
||||
__GLXcontext *glxc, *prevglxc;
|
||||
__GLinterface *gc, *prevgc;
|
||||
__GLXdrawablePrivate *drawPriv = NULL;
|
||||
__GLXdrawablePrivate *readPriv = NULL;
|
||||
__GLXdrawable *drawPriv = NULL;
|
||||
__GLXdrawable *readPriv = NULL;
|
||||
GLint error;
|
||||
GLuint mask;
|
||||
|
||||
|
@ -554,10 +534,8 @@ int DoMakeCurrent( __GLXclientState *cl,
|
|||
client->errorValue = prevglxc->id;
|
||||
return __glXBadContextState;
|
||||
}
|
||||
prevgc = prevglxc->gc;
|
||||
} else {
|
||||
prevglxc = 0;
|
||||
prevgc = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -575,8 +553,6 @@ int DoMakeCurrent( __GLXclientState *cl,
|
|||
/* Context is current to somebody else */
|
||||
return BadAccess;
|
||||
}
|
||||
gc = glxc->gc;
|
||||
|
||||
|
||||
assert( drawId != None );
|
||||
assert( readId != None );
|
||||
|
@ -600,14 +576,14 @@ int DoMakeCurrent( __GLXclientState *cl,
|
|||
/* FIXME: Finish refactoring this. - idr */
|
||||
/* get the drawable private */
|
||||
if (pDraw) {
|
||||
drawPriv = __glXGetDrawablePrivate(pDraw, drawId, glxc->modes);
|
||||
drawPriv = __glXGetDrawable(glxc, pDraw, drawId);
|
||||
if (drawPriv == NULL) {
|
||||
return __glXBadDrawable;
|
||||
}
|
||||
}
|
||||
|
||||
if (pRead != pDraw) {
|
||||
readPriv = __glXGetDrawablePrivate(pRead, readId, glxc->modes);
|
||||
readPriv = __glXGetDrawable(glxc, pRead, readId);
|
||||
if (readPriv == NULL) {
|
||||
return __glXBadDrawable;
|
||||
}
|
||||
|
@ -618,7 +594,6 @@ int DoMakeCurrent( __GLXclientState *cl,
|
|||
} else {
|
||||
/* Switching to no context. Ignore new drawable. */
|
||||
glxc = 0;
|
||||
gc = 0;
|
||||
pDraw = 0;
|
||||
pRead = 0;
|
||||
}
|
||||
|
@ -640,7 +615,7 @@ int DoMakeCurrent( __GLXclientState *cl,
|
|||
/*
|
||||
** Make the previous context not current.
|
||||
*/
|
||||
if (!(*prevgc->exports.loseCurrent)((__GLcontext *)prevgc)) {
|
||||
if (!(*prevglxc->loseCurrent)(prevglxc)) {
|
||||
return __glXBadContext;
|
||||
}
|
||||
__glXDeassociateContext(prevglxc);
|
||||
|
@ -651,19 +626,18 @@ int DoMakeCurrent( __GLXclientState *cl,
|
|||
|
||||
glxc->drawPriv = drawPriv;
|
||||
glxc->readPriv = readPriv;
|
||||
__glXCacheDrawableSize(drawPriv);
|
||||
|
||||
/* make the context current */
|
||||
if (!(*gc->exports.makeCurrent)((__GLcontext *)gc)) {
|
||||
if (!(*glxc->makeCurrent)(glxc)) {
|
||||
glxc->drawPriv = NULL;
|
||||
glxc->readPriv = NULL;
|
||||
return __glXBadContext;
|
||||
}
|
||||
|
||||
/* resize the buffers */
|
||||
if (!__glXResizeDrawableBuffers(drawPriv)) {
|
||||
if (!(*drawPriv->resize)(drawPriv)) {
|
||||
/* could not do initial resize. make current failed */
|
||||
(*gc->exports.loseCurrent)((__GLcontext *)gc);
|
||||
(*glxc->loseCurrent)(glxc);
|
||||
glxc->drawPriv = NULL;
|
||||
glxc->readPriv = NULL;
|
||||
return __glXBadContext;
|
||||
|
@ -911,9 +885,7 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
|
|||
/*
|
||||
** Issue copy. The only reason for failure is a bad mask.
|
||||
*/
|
||||
if (!(*dst->gc->exports.copyContext)((__GLcontext *)dst->gc,
|
||||
(__GLcontext *)src->gc,
|
||||
mask)) {
|
||||
if (!(*dst->copy)(dst, src, mask)) {
|
||||
client->errorValue = mask;
|
||||
return BadValue;
|
||||
}
|
||||
|
@ -926,7 +898,7 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen,
|
|||
{
|
||||
ClientPtr client = cl->client;
|
||||
xGLXGetVisualConfigsReply reply;
|
||||
__GLXscreenInfo *pGlxScreen;
|
||||
__GLXscreen *pGlxScreen;
|
||||
__GLcontextModes *modes;
|
||||
CARD32 buf[__GLX_TOTAL_CONFIG];
|
||||
int p;
|
||||
|
@ -938,7 +910,7 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen,
|
|||
client->errorValue = screen;
|
||||
return BadValue;
|
||||
}
|
||||
pGlxScreen = &__glXActiveScreens[screen];
|
||||
pGlxScreen = __glXActiveScreens[screen];
|
||||
|
||||
reply.numVisuals = pGlxScreen->numUsableVisuals;
|
||||
reply.numProps = __GLX_TOTAL_CONFIG;
|
||||
|
@ -1017,6 +989,68 @@ int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
|
|||
}
|
||||
|
||||
|
||||
/* Composite adds a 32 bit ARGB visual after glxvisuals.c have created
|
||||
* the context modes for the screens. This visual is useful for GLX
|
||||
* pixmaps, so we create a single mode for this visual with no extra
|
||||
* buffers. */
|
||||
static void
|
||||
__glXCreateARGBConfig(__GLXscreen *screen)
|
||||
{
|
||||
__GLcontextModes *modes;
|
||||
VisualPtr visual;
|
||||
int i;
|
||||
|
||||
visual = NULL;
|
||||
for (i = 0; i < screen->pScreen->numVisuals; i++)
|
||||
if (screen->pScreen->visuals[i].nplanes == 32) {
|
||||
visual = &screen->pScreen->visuals[i];
|
||||
break;
|
||||
}
|
||||
|
||||
if (visual == NULL || visual->class != TrueColor)
|
||||
return;
|
||||
|
||||
if (_gl_context_modes_find_visual (screen->modes, visual->vid))
|
||||
return;
|
||||
|
||||
/* Stop now if we already added the mode. */
|
||||
modes = _gl_context_modes_create(1, sizeof(__GLcontextModes));
|
||||
if (modes == NULL)
|
||||
return;
|
||||
|
||||
modes->next = screen->modes;
|
||||
screen->modes = modes;
|
||||
screen->numUsableVisuals++;
|
||||
screen->numVisuals++;
|
||||
|
||||
modes->visualID = visual->vid;
|
||||
modes->fbconfigID = visual->vid;
|
||||
modes->visualType = GLX_TRUE_COLOR;
|
||||
modes->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
|
||||
modes->renderType = GLX_RGBA_BIT;
|
||||
modes->xRenderable = GL_TRUE;
|
||||
modes->rgbMode = TRUE;
|
||||
modes->colorIndexMode = FALSE;
|
||||
modes->doubleBufferMode = FALSE;
|
||||
modes->stereoMode = FALSE;
|
||||
modes->haveAccumBuffer = FALSE;
|
||||
|
||||
modes->redBits = visual->bitsPerRGBValue;;
|
||||
modes->greenBits = visual->bitsPerRGBValue;
|
||||
modes->blueBits = visual->bitsPerRGBValue;
|
||||
modes->alphaBits = visual->bitsPerRGBValue;
|
||||
|
||||
modes->rgbBits = 4 * visual->bitsPerRGBValue;
|
||||
modes->indexBits = 0;
|
||||
modes->level = 0;
|
||||
modes->numAuxBuffers = 0;
|
||||
|
||||
modes->haveDepthBuffer = FALSE;
|
||||
modes->depthBits = 0;
|
||||
modes->haveStencilBuffer = FALSE;
|
||||
modes->stencilBits = 0;
|
||||
}
|
||||
|
||||
|
||||
#define __GLX_TOTAL_FBCONFIG_ATTRIBS (28)
|
||||
#define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2)
|
||||
|
@ -1034,7 +1068,7 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap)
|
|||
{
|
||||
ClientPtr client = cl->client;
|
||||
xGLXGetFBConfigsReply reply;
|
||||
__GLXscreenInfo *pGlxScreen;
|
||||
__GLXscreen *pGlxScreen;
|
||||
CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH];
|
||||
int p;
|
||||
__GLcontextModes *modes;
|
||||
|
@ -1047,7 +1081,9 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap)
|
|||
client->errorValue = screen;
|
||||
return BadValue;
|
||||
}
|
||||
pGlxScreen = &__glXActiveScreens[screen];
|
||||
pGlxScreen = __glXActiveScreens[screen];
|
||||
|
||||
__glXCreateARGBConfig(pGlxScreen);
|
||||
|
||||
reply.numFBConfigs = pGlxScreen->numUsableVisuals;
|
||||
reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS;
|
||||
|
@ -1145,7 +1181,7 @@ int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual,
|
|||
ScreenPtr pScreen;
|
||||
VisualPtr pVisual;
|
||||
__GLXpixmap *pGlxPixmap;
|
||||
__GLXscreenInfo *pGlxScreen;
|
||||
__GLXscreen *pGlxScreen;
|
||||
__GLcontextModes *modes;
|
||||
int i;
|
||||
|
||||
|
@ -1188,7 +1224,7 @@ int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual,
|
|||
/*
|
||||
** Get configuration of the visual.
|
||||
*/
|
||||
pGlxScreen = &__glXActiveScreens[screenNum];
|
||||
pGlxScreen = __glXActiveScreens[screenNum];
|
||||
modes = _gl_context_modes_find_visual( pGlxScreen->modes, visual );
|
||||
if (modes == NULL) {
|
||||
/*
|
||||
|
@ -1339,16 +1375,16 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
|
|||
}
|
||||
|
||||
if (pDraw) {
|
||||
__GLXdrawablePrivate *glxPriv;
|
||||
__GLXdrawable *glxPriv;
|
||||
|
||||
if (glxc) {
|
||||
glxPriv = __glXGetDrawablePrivate(pDraw, drawId, glxc->modes);
|
||||
glxPriv = __glXGetDrawable(glxc, pDraw, drawId);
|
||||
if (glxPriv == NULL) {
|
||||
return __glXBadDrawable;
|
||||
}
|
||||
}
|
||||
else {
|
||||
glxPriv = __glXFindDrawablePrivate(drawId);
|
||||
glxPriv = __glXFindDrawable(drawId);
|
||||
if (glxPriv == NULL) {
|
||||
/* This is a window we've never seen before, do nothing */
|
||||
return Success;
|
||||
|
@ -1412,6 +1448,136 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
|
|||
}
|
||||
|
||||
|
||||
int __glXBindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
|
||||
ClientPtr client = cl->client;
|
||||
__GLXpixmap *pGlxPixmap;
|
||||
__GLXcontext *context;
|
||||
GLXDrawable drawId;
|
||||
int buffer;
|
||||
int error;
|
||||
|
||||
pc += __GLX_VENDPRIV_HDR_SIZE;
|
||||
|
||||
drawId = *((CARD32 *) (pc));
|
||||
buffer = *((INT32 *) (pc + 4));
|
||||
|
||||
if (buffer != GLX_FRONT_LEFT_EXT)
|
||||
return __glXBadPixmap;
|
||||
|
||||
context = __glXForceCurrent (cl, req->contextTag, &error);
|
||||
if (!context)
|
||||
return error;
|
||||
|
||||
pGlxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
|
||||
if (!pGlxPixmap) {
|
||||
client->errorValue = drawId;
|
||||
return __glXBadPixmap;
|
||||
}
|
||||
|
||||
if (!context->textureFromPixmap)
|
||||
return __glXUnsupportedPrivateRequest;
|
||||
|
||||
return context->textureFromPixmap->bindTexImage(context,
|
||||
buffer,
|
||||
pGlxPixmap);
|
||||
}
|
||||
|
||||
int __glXReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
|
||||
ClientPtr client = cl->client;
|
||||
__GLXpixmap *pGlxPixmap;
|
||||
__GLXcontext *context;
|
||||
GLXDrawable drawId;
|
||||
int buffer;
|
||||
int error;
|
||||
|
||||
pc += __GLX_VENDPRIV_HDR_SIZE;
|
||||
|
||||
drawId = *((CARD32 *) (pc));
|
||||
buffer = *((INT32 *) (pc + 4));
|
||||
|
||||
context = __glXForceCurrent (cl, req->contextTag, &error);
|
||||
if (!context)
|
||||
return error;
|
||||
|
||||
pGlxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
|
||||
if (!pGlxPixmap) {
|
||||
client->errorValue = drawId;
|
||||
return __glXBadDrawable;
|
||||
}
|
||||
|
||||
if (!context->textureFromPixmap)
|
||||
return __glXUnsupportedPrivateRequest;
|
||||
|
||||
return context->textureFromPixmap->releaseTexImage(context,
|
||||
buffer,
|
||||
pGlxPixmap);
|
||||
}
|
||||
|
||||
#ifndef GLX_TEXTURE_TARGET_EXT
|
||||
#define GLX_TEXTURE_TARGET_EXT 0x6001
|
||||
#define GLX_TEXTURE_2D_EXT 0x6002
|
||||
#define GLX_TEXTURE_RECTANGLE_EXT 0x6003
|
||||
#define GLX_NO_TEXTURE_EXT 0x6004
|
||||
#define GLX_Y_INVERTED_EXT 0x6006
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Get drawable attributes
|
||||
*/
|
||||
static int
|
||||
DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
|
||||
{
|
||||
ClientPtr client = cl->client;
|
||||
__GLXpixmap *glxPixmap;
|
||||
xGLXGetDrawableAttributesReply reply;
|
||||
CARD32 attributes[2];
|
||||
int numAttribs;
|
||||
|
||||
glxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
|
||||
if (!glxPixmap) {
|
||||
client->errorValue = drawId;
|
||||
return __glXBadPixmap;
|
||||
}
|
||||
|
||||
numAttribs = 2;
|
||||
reply.length = numAttribs << 1;
|
||||
reply.type = X_Reply;
|
||||
reply.sequenceNumber = client->sequence;
|
||||
reply.numAttribs = numAttribs;
|
||||
|
||||
attributes[0] = GLX_TEXTURE_TARGET_EXT;
|
||||
attributes[1] = GLX_TEXTURE_RECTANGLE_EXT;
|
||||
attributes[2] = GLX_Y_INVERTED_EXT;
|
||||
attributes[3] = GL_FALSE;
|
||||
|
||||
if (client->swapped) {
|
||||
__glXSwapGetDrawableAttributesReply(client, &reply, attributes);
|
||||
} else {
|
||||
WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
|
||||
(char *)&reply);
|
||||
WriteToClient(client, reply.length * sizeof (CARD32),
|
||||
(char *)attributes);
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
int __glXGetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *)pc;
|
||||
CARD32 *data;
|
||||
XID drawable;
|
||||
|
||||
data = (CARD32 *) (req + 1);
|
||||
drawable = data[0];
|
||||
|
||||
return DoGetDrawableAttributes(cl, drawable);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -1985,6 +2151,10 @@ int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc)
|
|||
return Success;
|
||||
case X_GLXvop_BindSwapBarrierSGIX:
|
||||
return __glXBindSwapBarrierSGIX(cl, pc);
|
||||
case X_GLXvop_BindTexImageEXT:
|
||||
return __glXBindTexImageEXT(cl, pc);
|
||||
case X_GLXvop_ReleaseTexImageEXT:
|
||||
return __glXReleaseTexImageEXT(cl, pc);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2030,6 +2200,8 @@ int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
|
|||
return __glXCreateContextWithConfigSGIX(cl, pc);
|
||||
case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
|
||||
return __glXCreateGLXPixmapWithConfigSGIX(cl, pc);
|
||||
case X_GLXvop_GetDrawableAttributesSGIX:
|
||||
return __glXGetDrawableAttributesSGIX(cl, pc);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2064,7 +2236,7 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
|
|||
return BadValue;
|
||||
}
|
||||
|
||||
ptr = __glXActiveScreens[screen].GLXextensions;
|
||||
ptr = __glXActiveScreens[screen]->GLXextensions;
|
||||
|
||||
n = __glXStrlen(ptr) + 1;
|
||||
length = __GLX_PAD(n) >> 2;
|
||||
|
@ -2111,13 +2283,13 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
|
|||
}
|
||||
switch(name) {
|
||||
case GLX_VENDOR:
|
||||
ptr = __glXActiveScreens[screen].GLXvendor;
|
||||
ptr = __glXActiveScreens[screen]->GLXvendor;
|
||||
break;
|
||||
case GLX_VERSION:
|
||||
ptr = __glXActiveScreens[screen].GLXversion;
|
||||
ptr = __glXActiveScreens[screen]->GLXversion;
|
||||
break;
|
||||
case GLX_EXTENSIONS:
|
||||
ptr = __glXActiveScreens[screen].GLXextensions;
|
||||
ptr = __glXActiveScreens[screen]->GLXextensions;
|
||||
break;
|
||||
default:
|
||||
return BadValue;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
#include <GL/glxtokens.h>
|
||||
|
@ -389,6 +390,64 @@ int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
|
|||
return __glXQueryContextInfoEXT(cl, pc);
|
||||
}
|
||||
|
||||
int __glXSwapBindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
|
||||
GLXDrawable *drawId;
|
||||
int *buffer;
|
||||
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
pc += __GLX_VENDPRIV_HDR_SIZE;
|
||||
|
||||
drawId = ((GLXDrawable *) (pc));
|
||||
buffer = ((int *) (pc + 4));
|
||||
|
||||
__GLX_SWAP_SHORT(&req->length);
|
||||
__GLX_SWAP_INT(&req->contextTag);
|
||||
__GLX_SWAP_INT(drawId);
|
||||
__GLX_SWAP_INT(buffer);
|
||||
|
||||
return __glXBindTexImageEXT(cl, (GLbyte *)pc);
|
||||
}
|
||||
|
||||
int __glXSwapReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
|
||||
GLXDrawable *drawId;
|
||||
int *buffer;
|
||||
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
pc += __GLX_VENDPRIV_HDR_SIZE;
|
||||
|
||||
drawId = ((GLXDrawable *) (pc));
|
||||
buffer = ((int *) (pc + 4));
|
||||
|
||||
__GLX_SWAP_SHORT(&req->length);
|
||||
__GLX_SWAP_INT(&req->contextTag);
|
||||
__GLX_SWAP_INT(drawId);
|
||||
__GLX_SWAP_INT(buffer);
|
||||
|
||||
return __glXReleaseTexImageEXT(cl, (GLbyte *)pc);
|
||||
}
|
||||
|
||||
int __glXSwapGetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *)pc;
|
||||
CARD32 *data;
|
||||
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
||||
data = (CARD32 *) (req + 1);
|
||||
__GLX_SWAP_SHORT(&req->length);
|
||||
__GLX_SWAP_INT(&req->contextTag);
|
||||
__GLX_SWAP_INT(data);
|
||||
|
||||
return __glXGetDrawableAttributesSGIX(cl, (GLbyte *)pc);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -463,6 +522,19 @@ void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXT
|
|||
WriteToClient(client, length << 2, (char *)buf);
|
||||
}
|
||||
|
||||
void __glXSwapGetDrawableAttributesReply(ClientPtr client,
|
||||
xGLXGetDrawableAttributesReply *reply, CARD32 *buf)
|
||||
{
|
||||
int length = reply->length;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
|
||||
__GLX_SWAP_SHORT(&reply->sequenceNumber);
|
||||
__GLX_SWAP_INT(&reply->length);
|
||||
__GLX_SWAP_INT(&reply->numAttribs);
|
||||
WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply);
|
||||
__GLX_SWAP_INT_ARRAY((int *)buf, length);
|
||||
WriteToClient(client, length << 2, (char *)buf);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
@ -824,6 +896,10 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLX_SWAP_INT(pc + 4);
|
||||
CALL_SamplePatternSGIS( GET_DISPATCH(), (*(GLenum *)(pc + 4)) );
|
||||
return Success;
|
||||
case X_GLXvop_BindTexImageEXT:
|
||||
return __glXSwapBindTexImageEXT(cl, pc);
|
||||
case X_GLXvop_ReleaseTexImageEXT:
|
||||
return __glXSwapReleaseTexImageEXT(cl, pc);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -861,6 +937,8 @@ int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
|
|||
return __glXSwapCreateContextWithConfigSGIX(cl, pc);
|
||||
case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
|
||||
return __glXSwapCreateGLXPixmapWithConfigSGIX(cl, pc);
|
||||
case X_GLXvop_GetDrawableAttributesSGIX:
|
||||
return __glXSwapGetDrawableAttributesSGIX(cl, pc);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -41,32 +41,48 @@
|
|||
**
|
||||
*/
|
||||
|
||||
typedef struct __GLXcontextRec __GLXcontext;
|
||||
|
||||
/* XXX: should be defined somewhere globally */
|
||||
#define CAPI
|
||||
|
||||
#include "GL/internal/glcore.h"
|
||||
|
||||
struct __GLXcontextRec {
|
||||
typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
|
||||
struct __GLXtextureFromPixmap {
|
||||
int (*bindTexImage) (__GLXcontext *baseContext,
|
||||
int buffer,
|
||||
__GLXpixmap *pixmap);
|
||||
int (*releaseTexImage) (__GLXcontext *baseContext,
|
||||
int buffer,
|
||||
__GLXpixmap *pixmap);
|
||||
};
|
||||
|
||||
|
||||
struct __GLXcontext {
|
||||
void (*destroy) (__GLXcontext *context);
|
||||
int (*makeCurrent) (__GLXcontext *context);
|
||||
int (*loseCurrent) (__GLXcontext *context);
|
||||
int (*copy) (__GLXcontext *dst,
|
||||
__GLXcontext *src,
|
||||
unsigned long mask);
|
||||
int (*forceCurrent) (__GLXcontext *context);
|
||||
|
||||
__GLXdrawable *(*createDrawable)(__GLXcontext *context,
|
||||
DrawablePtr pDraw,
|
||||
XID drawId);
|
||||
|
||||
__GLXtextureFromPixmap *textureFromPixmap;
|
||||
|
||||
/*
|
||||
** list of context structs
|
||||
*/
|
||||
struct __GLXcontextRec *last;
|
||||
struct __GLXcontextRec *next;
|
||||
__GLXcontext *last;
|
||||
__GLXcontext *next;
|
||||
|
||||
/*
|
||||
** list of contexts bound to the same drawable
|
||||
*/
|
||||
struct __GLXcontextRec *nextDrawPriv;
|
||||
struct __GLXcontextRec *nextReadPriv;
|
||||
|
||||
/*
|
||||
** Opaque pointer the context object created by the GL that the
|
||||
** server is bound with. Never dereferenced by this code, but used
|
||||
** as a handle to feed to the routines in the screen info struct.
|
||||
*/
|
||||
__GLinterface *gc;
|
||||
__GLXcontext *nextDrawPriv;
|
||||
__GLXcontext *nextReadPriv;
|
||||
|
||||
/*
|
||||
** mode struct for this context
|
||||
|
@ -78,7 +94,7 @@ struct __GLXcontextRec {
|
|||
** when the context is created.
|
||||
*/
|
||||
ScreenPtr pScreen;
|
||||
__GLXscreenInfo *pGlxScreen;
|
||||
__GLXscreen *pGlxScreen;
|
||||
|
||||
/*
|
||||
** This context is created with respect to this visual.
|
||||
|
@ -152,8 +168,8 @@ struct __GLXcontextRec {
|
|||
/*
|
||||
** The drawable private this context is bound to
|
||||
*/
|
||||
__GLXdrawablePrivate *drawPriv;
|
||||
__GLXdrawablePrivate *readPriv;
|
||||
__GLXdrawable *drawPriv;
|
||||
__GLXdrawable *readPriv;
|
||||
};
|
||||
|
||||
/* pending state defines */
|
||||
|
|
|
@ -45,19 +45,23 @@ typedef struct {
|
|||
|
||||
DrawablePtr pDraw;
|
||||
__GLcontextModes *modes;
|
||||
__GLXscreenInfo *pGlxScreen;
|
||||
__GLXscreen *pGlxScreen;
|
||||
ScreenPtr pScreen;
|
||||
Bool idExists;
|
||||
int refcnt;
|
||||
|
||||
} __GLXpixmap;
|
||||
|
||||
struct __GLXdrawablePrivateRec {
|
||||
struct __GLXdrawable {
|
||||
void (*destroy)(__GLXdrawable *private);
|
||||
GLboolean (*resize)(__GLXdrawable *private);
|
||||
GLboolean (*swapBuffers)(__GLXdrawable *);
|
||||
|
||||
/*
|
||||
** list of drawable private structs
|
||||
*/
|
||||
struct __GLXdrawablePrivateRec *last;
|
||||
struct __GLXdrawablePrivateRec *next;
|
||||
__GLXdrawable *last;
|
||||
__GLXdrawable *next;
|
||||
|
||||
DrawablePtr pDraw;
|
||||
XID drawId;
|
||||
|
@ -75,33 +79,14 @@ struct __GLXdrawablePrivateRec {
|
|||
*/
|
||||
__GLcontextModes *modes;
|
||||
|
||||
/*
|
||||
** cached drawable size and origin
|
||||
*/
|
||||
|
||||
GLint xorigin, yorigin;
|
||||
GLint width, height;
|
||||
|
||||
/*
|
||||
** Lists of contexts bound to this drawable. There are two lists here.
|
||||
** One list is of the contexts that have this drawable bound for drawing,
|
||||
** and the other is the list of contexts that have this drawable bound
|
||||
** for reading.
|
||||
*/
|
||||
struct __GLXcontextRec *drawGlxc;
|
||||
struct __GLXcontextRec *readGlxc;
|
||||
|
||||
/*
|
||||
** "methods" that the drawble should be able to respond to.
|
||||
*/
|
||||
void (*freeBuffers)(struct __GLXdrawablePrivateRec *);
|
||||
void (*updatePalette)(struct __GLXdrawablePrivateRec *);
|
||||
GLboolean (*swapBuffers)(struct __GLXdrawablePrivateRec *);
|
||||
|
||||
/*
|
||||
** The GL drawable (information shared between GLX and the GL core)
|
||||
*/
|
||||
__GLdrawablePrivate glPriv;
|
||||
__GLXcontext *drawGlxc;
|
||||
__GLXcontext *readGlxc;
|
||||
|
||||
/*
|
||||
** reference count
|
||||
|
|
926
GL/glx/glxdri.c
Normal file
926
GL/glx/glxdri.c
Normal file
|
@ -0,0 +1,926 @@
|
|||
/*
|
||||
* Copyright © 2006 Red Hat, Inc
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of Red Hat,
|
||||
* Inc not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. Red Hat, Inc makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* RED HAT, INC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
* NO EVENT SHALL RED HAT, INC BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <drm.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/internal/dri_interface.h>
|
||||
|
||||
#include <windowstr.h>
|
||||
#include <os.h>
|
||||
|
||||
#define _XF86DRI_SERVER_
|
||||
#include <drm_sarea.h>
|
||||
#include <xf86drm.h>
|
||||
#include <xf86dristr.h>
|
||||
#include <xf86str.h>
|
||||
#include <xf86.h>
|
||||
#include <dri.h>
|
||||
|
||||
#define DRI_NEW_INTERFACE_ONLY
|
||||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
#include "g_disptab.h"
|
||||
#include "g_disptab_EXT.h"
|
||||
#include "glapitable.h"
|
||||
#include "glapi.h"
|
||||
#include "glthread.h"
|
||||
#include "dispatch.h"
|
||||
|
||||
|
||||
#define STRINGIFY(macro_or_string) STRINGIFY_ARG (macro_or_string)
|
||||
#define STRINGIFY_ARG(contents) #contents
|
||||
|
||||
typedef struct __GLXDRIscreen __GLXDRIscreen;
|
||||
typedef struct __GLXDRIcontext __GLXDRIcontext;
|
||||
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
|
||||
|
||||
struct __GLXDRIscreen {
|
||||
__GLXscreen base;
|
||||
|
||||
__DRIscreen driScreen;
|
||||
void *driver;
|
||||
};
|
||||
|
||||
struct __GLXDRIcontext {
|
||||
__GLXcontext base;
|
||||
|
||||
__DRIcontext driContext;
|
||||
};
|
||||
|
||||
struct __GLXDRIdrawable {
|
||||
__GLXdrawable base;
|
||||
|
||||
__DRIdrawable *driDrawable;
|
||||
};
|
||||
|
||||
/* History:
|
||||
* 20021121 - Initial version
|
||||
* 20021128 - Added __glXWindowExists() function
|
||||
* 20021207 - Added support for dynamic GLX extensions,
|
||||
* GLX_SGI_swap_control, GLX_SGI_video_sync,
|
||||
* GLX_OML_sync_control, and GLX_MESA_swap_control.
|
||||
* Never officially released. Do NOT test against
|
||||
* this version. Use 20030317 instead.
|
||||
* 20030317 - Added support GLX_SGIX_fbconfig,
|
||||
* GLX_MESA_swap_frame_usage, GLX_OML_swap_method,
|
||||
* GLX_{ARB,SGIS}_multisample, and
|
||||
* GLX_SGIX_visual_select_group.
|
||||
* 20030606 - Added support for GLX_SGI_make_current_read.
|
||||
* 20030813 - Made support for dynamic extensions multi-head aware.
|
||||
* 20030818 - Added support for GLX_MESA_allocate_memory in place of the
|
||||
* deprecated GLX_NV_vertex_array_range & GLX_MESA_agp_offset
|
||||
* interfaces.
|
||||
* 20031201 - Added support for the first round of DRI interface changes.
|
||||
* Do NOT test against this version! It has binary
|
||||
* compatibility bugs, use 20040317 instead.
|
||||
* 20040317 - Added the 'mode' field to __DRIcontextRec.
|
||||
* 20040415 - Added support for bindContext3 and unbindContext3.
|
||||
* 20040602 - Add __glXGetDrawableInfo. I though that was there
|
||||
* months ago. :(
|
||||
* 20050727 - Gut all the old interfaces. This breaks compatability with
|
||||
* any DRI driver built to any previous version.
|
||||
*/
|
||||
#define INTERNAL_VERSION 20050727
|
||||
|
||||
static const char CREATE_NEW_SCREEN_FUNC[] =
|
||||
"__driCreateNewScreen_" STRINGIFY (INTERNAL_VERSION);
|
||||
|
||||
static void
|
||||
__glXDRIleaveServer(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
DRIDoBlockHandler(i, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
__glXDRIenterServer(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
DRIDoWakeupHandler(i, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
__glXDRIdrawableDestroy(__GLXdrawable *private)
|
||||
{
|
||||
#if 0
|
||||
(*glxPriv->driDrawable.destroyDrawable)(NULL,
|
||||
glxPriv->driDrawable.private);
|
||||
#endif
|
||||
|
||||
__glXFree(private);
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
__glXDRIdrawableResize(__GLXdrawable *glxPriv)
|
||||
{
|
||||
/* Nothing to do here, the DRI driver asks the server for drawable
|
||||
* geometry when it sess the SAREA timestamps change.*/
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
__glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate)
|
||||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
|
||||
__GLXDRIscreen *screen;
|
||||
|
||||
/* FIXME: We're jumping through hoops here to get the DRIdrawable
|
||||
* which the dri driver tries to keep to it self... cf. FIXME in
|
||||
* createDrawable. */
|
||||
|
||||
screen = (__GLXDRIscreen *) __glXgetActiveScreen(private->base.pDraw->pScreen->myNum);
|
||||
private->driDrawable = (screen->driScreen.getDrawable)(NULL,
|
||||
private->base.drawId,
|
||||
screen->driScreen.private);
|
||||
|
||||
(*private->driDrawable->swapBuffers)(NULL,
|
||||
private->driDrawable->private);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static __GLXdrawable *
|
||||
__glXDRIcontextCreateDrawable(__GLXcontext *context,
|
||||
DrawablePtr pDraw,
|
||||
XID drawId)
|
||||
{
|
||||
__GLXDRIdrawable *private;
|
||||
|
||||
private = __glXMalloc(sizeof *private);
|
||||
if (private == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(private, 0, sizeof *private);
|
||||
|
||||
if (!__glXDrawableInit(&private->base, context, pDraw, drawId)) {
|
||||
__glXFree(private);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
private->base.destroy = __glXDRIdrawableDestroy;
|
||||
private->base.resize = __glXDRIdrawableResize;
|
||||
private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
|
||||
|
||||
#if 0
|
||||
/* FIXME: It would only be natural that we called
|
||||
* driScreen->createNewDrawable here but the DRI drivers manage
|
||||
* them a little oddly. FIXME: describe this better.*/
|
||||
|
||||
/* The last argument is 'attrs', which is used with pbuffers which
|
||||
* we currently don't support. */
|
||||
|
||||
glxPriv->driDrawable.private =
|
||||
(pGlxScreen->driScreen.createNewDrawable)(NULL, modes,
|
||||
drawId,
|
||||
&glxPriv->driDrawable,
|
||||
0,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
return &private->base;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
__glXDRIcontextDestroy(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
|
||||
context->driContext.destroyContext(NULL,
|
||||
context->base.pScreen->myNum,
|
||||
context->driContext.private);
|
||||
__glXFree(context);
|
||||
}
|
||||
|
||||
static int
|
||||
__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
|
||||
return (*context->driContext.bindContext)(NULL,
|
||||
context->base.pScreen->myNum,
|
||||
baseContext->drawPriv->drawId,
|
||||
baseContext->readPriv->drawId,
|
||||
&context->driContext);
|
||||
}
|
||||
|
||||
static int
|
||||
__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
|
||||
return (*context->driContext.unbindContext)(NULL,
|
||||
context->base.pScreen->myNum,
|
||||
baseContext->drawPriv->drawId,
|
||||
baseContext->readPriv->drawId,
|
||||
&context->driContext);
|
||||
}
|
||||
|
||||
static int
|
||||
__glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
|
||||
unsigned long mask)
|
||||
{
|
||||
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
|
||||
__GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
|
||||
|
||||
/* FIXME: We will need to add DRIcontext::copyContext for this. */
|
||||
|
||||
(void) dst;
|
||||
(void) src;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
__glXDRIcontextForceCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
|
||||
return (*context->driContext.bindContext)(NULL,
|
||||
context->base.pScreen->myNum,
|
||||
baseContext->drawPriv->drawId,
|
||||
baseContext->readPriv->drawId,
|
||||
&context->driContext);
|
||||
}
|
||||
|
||||
static int
|
||||
glxCountBits(int word)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
while (word) {
|
||||
ret += (word & 1);
|
||||
word >>= 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
glxFillAlphaChannel (PixmapPtr pixmap)
|
||||
{
|
||||
int i, j;
|
||||
CARD32 *pixels = (CARD32 *)pixmap->devPrivate.ptr;
|
||||
CARD32 rowstride = pixmap->devKind / 4;
|
||||
CARD32 x, y;
|
||||
|
||||
x = pixmap->drawable.x;
|
||||
y = pixmap->drawable.y;
|
||||
|
||||
for (i = y; i < pixmap->drawable.height + y; ++i)
|
||||
{
|
||||
for (j = x; j < pixmap->drawable.width + x; ++j)
|
||||
{
|
||||
int index = i * rowstride + j;
|
||||
|
||||
pixels[index] |= 0xFF000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (sticking this here for lack of a better place)
|
||||
* Known issues with the GLX_EXT_texture_from_pixmap implementation:
|
||||
* - In general we ignore the fbconfig, lots of examples follow
|
||||
* - No fbconfig handling for multiple mipmap levels
|
||||
* - No fbconfig handling for 1D textures
|
||||
* - No fbconfig handling for TEXTURE_TARGET
|
||||
* - No fbconfig exposure of Y inversion state
|
||||
* - No GenerateMipmapEXT support (due to no FBO support)
|
||||
* - No damage tracking between binds
|
||||
* - No support for anything but 16bpp and 32bpp-sparse pixmaps
|
||||
*/
|
||||
|
||||
static int
|
||||
__glXDRIbindTexImage(__GLXcontext *baseContext,
|
||||
int buffer,
|
||||
__GLXpixmap *glxPixmap)
|
||||
{
|
||||
PixmapPtr pixmap;
|
||||
int bpp;
|
||||
Bool npot;
|
||||
|
||||
pixmap = (PixmapPtr) glxPixmap->pDraw;
|
||||
bpp = pixmap->drawable.depth >= 24 ? 4 : 2; /* XXX 24bpp packed, 8, etc */
|
||||
|
||||
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
|
||||
pixmap->devKind / bpp) );
|
||||
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS,
|
||||
pixmap->drawable.y) );
|
||||
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS,
|
||||
pixmap->drawable.x) );
|
||||
|
||||
if (pixmap->drawable.depth == 24)
|
||||
glxFillAlphaChannel(pixmap);
|
||||
|
||||
npot = !(glxCountBits(pixmap->drawable.width) == 1 &&
|
||||
glxCountBits(pixmap->drawable.height) == 1) /* ||
|
||||
strstr(CALL_GetString(GL_EXTENSIONS,
|
||||
"GL_ARB_texture_non_power_of_two")) */ ;
|
||||
|
||||
CALL_TexImage2D( GET_DISPATCH(),
|
||||
( npot ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D,
|
||||
0,
|
||||
bpp == 4 ? 4 : 3,
|
||||
pixmap->drawable.width,
|
||||
pixmap->drawable.height,
|
||||
0,
|
||||
bpp == 4 ? GL_BGRA : GL_RGB,
|
||||
bpp == 4 ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT_5_6_5,
|
||||
pixmap->devPrivate.ptr ) );
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
__glXDRIreleaseTexImage(__GLXcontext *baseContext,
|
||||
int buffer,
|
||||
__GLXpixmap *pixmap)
|
||||
{
|
||||
return Success;
|
||||
}
|
||||
|
||||
static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
|
||||
__glXDRIbindTexImage,
|
||||
__glXDRIreleaseTexImage
|
||||
};
|
||||
|
||||
static void
|
||||
__glXDRIscreenDestroy(__GLXscreen *baseScreen)
|
||||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
|
||||
screen->driScreen.destroyScreen(NULL,
|
||||
screen->base.pScreen->myNum,
|
||||
screen->driScreen.private);
|
||||
|
||||
dlclose(screen->driver);
|
||||
|
||||
__glXScreenDestroy(baseScreen);
|
||||
|
||||
__glXFree(screen);
|
||||
}
|
||||
|
||||
static __GLXcontext *
|
||||
__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXcontext *baseShareContext)
|
||||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
__GLXDRIcontext *context, *shareContext;
|
||||
void *sharePrivate;
|
||||
|
||||
shareContext = (__GLXDRIcontext *) baseShareContext;
|
||||
if (shareContext)
|
||||
sharePrivate = shareContext->driContext.private;
|
||||
else
|
||||
sharePrivate = NULL;
|
||||
|
||||
context = __glXMalloc(sizeof *context);
|
||||
if (context == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(context, 0, sizeof *context);
|
||||
context->base.destroy = __glXDRIcontextDestroy;
|
||||
context->base.makeCurrent = __glXDRIcontextMakeCurrent;
|
||||
context->base.loseCurrent = __glXDRIcontextLoseCurrent;
|
||||
context->base.copy = __glXDRIcontextCopy;
|
||||
context->base.forceCurrent = __glXDRIcontextForceCurrent;
|
||||
context->base.createDrawable = __glXDRIcontextCreateDrawable;
|
||||
|
||||
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
|
||||
|
||||
context->driContext.private =
|
||||
screen->driScreen.createNewContext(NULL, modes,
|
||||
0, /* render type */
|
||||
sharePrivate,
|
||||
&context->driContext);
|
||||
|
||||
context->driContext.mode = modes;
|
||||
|
||||
return &context->base;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
filter_modes(__GLcontextModes **server_modes,
|
||||
const __GLcontextModes *driver_modes)
|
||||
{
|
||||
__GLcontextModes * m;
|
||||
__GLcontextModes ** prev_next;
|
||||
const __GLcontextModes * check;
|
||||
unsigned modes_count = 0;
|
||||
|
||||
if ( driver_modes == NULL ) {
|
||||
LogMessage(X_WARNING,
|
||||
"AIGLX: 3D driver returned no fbconfigs.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* For each mode in server_modes, check to see if a matching mode exists
|
||||
* in driver_modes. If not, then the mode is not available.
|
||||
*/
|
||||
|
||||
prev_next = server_modes;
|
||||
for ( m = *prev_next ; m != NULL ; m = *prev_next ) {
|
||||
GLboolean do_delete = GL_TRUE;
|
||||
|
||||
for ( check = driver_modes ; check != NULL ; check = check->next ) {
|
||||
if ( _gl_context_modes_are_same( m, check ) ) {
|
||||
do_delete = GL_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The 3D has to support all the modes that match the GLX visuals
|
||||
* sent from the X server.
|
||||
*/
|
||||
if ( do_delete && (m->visualID != 0) ) {
|
||||
do_delete = GL_FALSE;
|
||||
|
||||
LogMessage(X_WARNING,
|
||||
"AIGLX: 3D driver claims to not support "
|
||||
"visual 0x%02x\n", m->visualID);
|
||||
}
|
||||
|
||||
if ( do_delete ) {
|
||||
*prev_next = m->next;
|
||||
|
||||
m->next = NULL;
|
||||
_gl_context_modes_destroy( m );
|
||||
}
|
||||
else {
|
||||
modes_count++;
|
||||
prev_next = & m->next;
|
||||
}
|
||||
}
|
||||
|
||||
return modes_count;
|
||||
}
|
||||
|
||||
|
||||
static __DRIfuncPtr getProcAddress(const char *proc_name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static __DRIscreen *findScreen(__DRInativeDisplay *dpy, int scrn)
|
||||
{
|
||||
__GLXDRIscreen *screen =
|
||||
(__GLXDRIscreen *) __glXgetActiveScreen(scrn);
|
||||
|
||||
return &screen->driScreen;
|
||||
}
|
||||
|
||||
static GLboolean windowExists(__DRInativeDisplay *dpy, __DRIid draw)
|
||||
{
|
||||
WindowPtr pWin = (WindowPtr) LookupIDByType(draw, RT_WINDOW);
|
||||
|
||||
return pWin == NULL ? GL_FALSE : GL_TRUE;
|
||||
}
|
||||
|
||||
static GLboolean createContext(__DRInativeDisplay *dpy, int screen,
|
||||
int configID, void *contextID,
|
||||
drm_context_t *hw_context)
|
||||
{
|
||||
XID fakeID;
|
||||
VisualPtr visual;
|
||||
int i;
|
||||
ScreenPtr pScreen;
|
||||
GLboolean retval;
|
||||
|
||||
pScreen = screenInfo.screens[screen];
|
||||
|
||||
/* Find the requested X visual */
|
||||
visual = pScreen->visuals;
|
||||
for (i = 0; i < pScreen->numVisuals; i++, visual++)
|
||||
if (visual->vid == configID)
|
||||
break;
|
||||
if (i == pScreen->numVisuals)
|
||||
return GL_FALSE;
|
||||
|
||||
fakeID = FakeClientID(0);
|
||||
*(XID *) contextID = fakeID;
|
||||
|
||||
__glXDRIenterServer();
|
||||
retval = DRICreateContext(pScreen, visual, fakeID, hw_context);
|
||||
__glXDRIleaveServer();
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GLboolean destroyContext(__DRInativeDisplay *dpy, int screen,
|
||||
__DRIid context)
|
||||
{
|
||||
GLboolean retval;
|
||||
|
||||
__glXDRIenterServer();
|
||||
retval = DRIDestroyContext(screenInfo.screens[screen], context);
|
||||
__glXDRIleaveServer();
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
createDrawable(__DRInativeDisplay *dpy, int screen,
|
||||
__DRIid drawable, drm_drawable_t *hHWDrawable)
|
||||
{
|
||||
DrawablePtr pDrawable;
|
||||
GLboolean retval;
|
||||
|
||||
pDrawable = (DrawablePtr) LookupIDByClass(drawable, RC_DRAWABLE);
|
||||
if (!pDrawable)
|
||||
return GL_FALSE;
|
||||
|
||||
__glXDRIenterServer();
|
||||
retval = DRICreateDrawable(screenInfo.screens[screen],
|
||||
drawable,
|
||||
pDrawable,
|
||||
hHWDrawable);
|
||||
__glXDRIleaveServer();
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
destroyDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable)
|
||||
{
|
||||
DrawablePtr pDrawable;
|
||||
GLboolean retval;
|
||||
|
||||
pDrawable = (DrawablePtr) LookupIDByClass(drawable, RC_DRAWABLE);
|
||||
if (!pDrawable)
|
||||
return GL_FALSE;
|
||||
|
||||
__glXDRIenterServer();
|
||||
retval = DRIDestroyDrawable(screenInfo.screens[screen],
|
||||
drawable,
|
||||
pDrawable);
|
||||
__glXDRIleaveServer();
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
getDrawableInfo(__DRInativeDisplay *dpy, int screen,
|
||||
__DRIid drawable, unsigned int *index, unsigned int *stamp,
|
||||
int *x, int *y, int *width, int *height,
|
||||
int *numClipRects, drm_clip_rect_t **ppClipRects,
|
||||
int *backX, int *backY,
|
||||
int *numBackClipRects, drm_clip_rect_t **ppBackClipRects)
|
||||
{
|
||||
DrawablePtr pDrawable;
|
||||
drm_clip_rect_t *pClipRects, *pBackClipRects;
|
||||
GLboolean retval;
|
||||
size_t size;
|
||||
|
||||
pDrawable = (DrawablePtr) LookupIDByClass(drawable, RC_DRAWABLE);
|
||||
if (!pDrawable) {
|
||||
ErrorF("getDrawableInfo failed to look up window\n");
|
||||
|
||||
*index = 0;
|
||||
*stamp = 0;
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
*numClipRects = 0;
|
||||
*ppClipRects = NULL;
|
||||
*backX = 0;
|
||||
*backY = 0;
|
||||
*numBackClipRects = 0;
|
||||
*ppBackClipRects = NULL;
|
||||
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
__glXDRIenterServer();
|
||||
retval = DRIGetDrawableInfo(screenInfo.screens[screen],
|
||||
pDrawable, index, stamp,
|
||||
x, y, width, height,
|
||||
numClipRects, &pClipRects,
|
||||
backX, backY,
|
||||
numBackClipRects, &pBackClipRects);
|
||||
__glXDRIleaveServer();
|
||||
|
||||
if (*numClipRects > 0) {
|
||||
size = sizeof (drm_clip_rect_t) * *numClipRects;
|
||||
*ppClipRects = __glXMalloc (size);
|
||||
if (*ppClipRects != NULL)
|
||||
memcpy (*ppClipRects, pClipRects, size);
|
||||
}
|
||||
else {
|
||||
*ppClipRects = NULL;
|
||||
}
|
||||
|
||||
if (*numBackClipRects > 0) {
|
||||
size = sizeof (drm_clip_rect_t) * *numBackClipRects;
|
||||
*ppBackClipRects = __glXMalloc (size);
|
||||
if (*ppBackClipRects != NULL)
|
||||
memcpy (*ppBackClipRects, pBackClipRects, size);
|
||||
}
|
||||
else {
|
||||
*ppBackClipRects = NULL;
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
getUST(int64_t *ust)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
if (ust == NULL)
|
||||
return -EFAULT;
|
||||
|
||||
if (gettimeofday(&tv, NULL) == 0) {
|
||||
ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
|
||||
return 0;
|
||||
} else {
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
||||
/* Table of functions that we export to the driver. */
|
||||
static const __DRIinterfaceMethods interface_methods = {
|
||||
getProcAddress,
|
||||
|
||||
_gl_context_modes_create,
|
||||
_gl_context_modes_destroy,
|
||||
|
||||
findScreen,
|
||||
windowExists,
|
||||
|
||||
createContext,
|
||||
destroyContext,
|
||||
|
||||
createDrawable,
|
||||
destroyDrawable,
|
||||
getDrawableInfo,
|
||||
|
||||
getUST,
|
||||
NULL, /* glXGetMscRateOML, */
|
||||
};
|
||||
|
||||
static const char dri_driver_path[] = DRI_DRIVER_PATH;
|
||||
|
||||
static __GLXscreen *
|
||||
__glXDRIscreenProbe(ScreenPtr pScreen)
|
||||
{
|
||||
PFNCREATENEWSCREENFUNC createNewScreen;
|
||||
drm_handle_t hSAREA;
|
||||
drmAddress pSAREA = NULL;
|
||||
char *BusID;
|
||||
__DRIversion ddx_version;
|
||||
__DRIversion dri_version;
|
||||
__DRIversion drm_version;
|
||||
__DRIframebuffer framebuffer;
|
||||
int fd = -1;
|
||||
int status;
|
||||
const char *err_msg;
|
||||
const char *err_extra = NULL;
|
||||
int api_ver = INTERNAL_VERSION;
|
||||
drm_magic_t magic;
|
||||
drmVersionPtr version;
|
||||
char *driverName;
|
||||
drm_handle_t hFB;
|
||||
int junk;
|
||||
__GLcontextModes * driver_modes;
|
||||
__GLXDRIscreen *screen;
|
||||
void *dev_priv = NULL;
|
||||
char filename[128];
|
||||
|
||||
screen = __glXMalloc(sizeof *screen);
|
||||
if (screen == NULL)
|
||||
return NULL;
|
||||
memset(screen, 0, sizeof *screen);
|
||||
|
||||
screen->base.destroy = __glXDRIscreenDestroy;
|
||||
screen->base.createContext = __glXDRIscreenCreateContext;
|
||||
screen->base.pScreen = pScreen;
|
||||
|
||||
/* DRI protocol version. */
|
||||
dri_version.major = XF86DRI_MAJOR_VERSION;
|
||||
dri_version.minor = XF86DRI_MINOR_VERSION;
|
||||
dri_version.patch = XF86DRI_PATCH_VERSION;
|
||||
|
||||
framebuffer.base = NULL;
|
||||
framebuffer.dev_priv = NULL;
|
||||
|
||||
if (!DRIOpenConnection(pScreen, &hSAREA, &BusID)) {
|
||||
err_msg = "DRIOpenConnection";
|
||||
err_extra = NULL;
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
fd = drmOpen(NULL, BusID);
|
||||
|
||||
if (fd < 0) {
|
||||
err_msg = "open DRM";
|
||||
err_extra = strerror( -fd );
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
if (drmGetMagic(fd, &magic)) {
|
||||
err_msg = "drmGetMagic";
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
version = drmGetVersion(fd);
|
||||
if (version) {
|
||||
drm_version.major = version->version_major;
|
||||
drm_version.minor = version->version_minor;
|
||||
drm_version.patch = version->version_patchlevel;
|
||||
drmFreeVersion(version);
|
||||
}
|
||||
else {
|
||||
drm_version.major = -1;
|
||||
drm_version.minor = -1;
|
||||
drm_version.patch = -1;
|
||||
}
|
||||
|
||||
if (!DRIAuthConnection(pScreen, magic)) {
|
||||
err_msg = "DRIAuthConnection";
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
/* Get device name (like "tdfx") and the ddx version numbers.
|
||||
* We'll check the version in each DRI driver's "createNewScreen"
|
||||
* function. */
|
||||
if (!DRIGetClientDriverName(pScreen,
|
||||
&ddx_version.major,
|
||||
&ddx_version.minor,
|
||||
&ddx_version.patch,
|
||||
&driverName)) {
|
||||
err_msg = "DRIGetClientDriverName";
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
snprintf(filename, sizeof filename, "%s/%s_dri.so",
|
||||
dri_driver_path, driverName);
|
||||
|
||||
screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
|
||||
if (screen->driver == NULL) {
|
||||
err_msg = "Loading driver";
|
||||
err_extra = filename;
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
createNewScreen = dlsym(screen->driver, CREATE_NEW_SCREEN_FUNC);
|
||||
if (createNewScreen == NULL) {
|
||||
err_msg = "Driver entry point lookup";
|
||||
err_extra = CREATE_NEW_SCREEN_FUNC;
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get device-specific info. pDevPriv will point to a struct
|
||||
* (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) that
|
||||
* has information about the screen size, depth, pitch, ancilliary
|
||||
* buffers, DRM mmap handles, etc.
|
||||
*/
|
||||
if (!DRIGetDeviceInfo(pScreen, &hFB, &junk,
|
||||
&framebuffer.size, &framebuffer.stride,
|
||||
&framebuffer.dev_priv_size, &framebuffer.dev_priv)) {
|
||||
err_msg = "XF86DRIGetDeviceInfo";
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
/* Sigh... the DRI interface is broken; the DRI driver will free
|
||||
* the dev private pointer using _mesa_free() on screen destroy,
|
||||
* but we can't use _mesa_malloc() here. In fact, the DRI driver
|
||||
* shouldn't free data it didn't allocate itself, but what can you
|
||||
* do... */
|
||||
dev_priv = __glXMalloc(framebuffer.dev_priv_size);
|
||||
if (dev_priv == NULL) {
|
||||
err_msg = "dev_priv allocation";
|
||||
goto handle_error;
|
||||
}
|
||||
memcpy(dev_priv, framebuffer.dev_priv, framebuffer.dev_priv_size);
|
||||
framebuffer.dev_priv = dev_priv;
|
||||
|
||||
framebuffer.width = pScreen->width;
|
||||
framebuffer.height = pScreen->height;
|
||||
|
||||
/* Map the framebuffer region. */
|
||||
status = drmMap(fd, hFB, framebuffer.size,
|
||||
(drmAddressPtr)&framebuffer.base);
|
||||
if (status != 0) {
|
||||
err_msg = "drmMap of framebuffer";
|
||||
err_extra = strerror( -status );
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
/* Map the SAREA region. Further mmap regions may be setup in
|
||||
* each DRI driver's "createNewScreen" function.
|
||||
*/
|
||||
status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA);
|
||||
if (status != 0) {
|
||||
err_msg = "drmMap of sarea";
|
||||
err_extra = strerror( -status );
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
driver_modes = NULL;
|
||||
screen->driScreen.private =
|
||||
(*createNewScreen)(NULL, pScreen->myNum,
|
||||
&screen->driScreen,
|
||||
screen->base.modes,
|
||||
&ddx_version,
|
||||
&dri_version,
|
||||
&drm_version,
|
||||
&framebuffer,
|
||||
pSAREA,
|
||||
fd,
|
||||
api_ver,
|
||||
&interface_methods,
|
||||
&driver_modes);
|
||||
|
||||
if (screen->driScreen.private == NULL) {
|
||||
err_msg = "InitDriver";
|
||||
err_extra = NULL;
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
__glXScreenInit(&screen->base, pScreen);
|
||||
|
||||
filter_modes(&screen->base.modes, driver_modes);
|
||||
_gl_context_modes_destroy(driver_modes);
|
||||
|
||||
__glXsetEnterLeaveServerFuncs(__glXDRIenterServer, __glXDRIleaveServer);
|
||||
|
||||
LogMessage(X_INFO,
|
||||
"AIGLX: Loaded and initialized %s\n", filename);
|
||||
|
||||
return &screen->base;
|
||||
|
||||
handle_error:
|
||||
if (pSAREA != NULL)
|
||||
drmUnmap(pSAREA, SAREA_MAX);
|
||||
|
||||
if (framebuffer.base != NULL)
|
||||
drmUnmap((drmAddress)framebuffer.base, framebuffer.size);
|
||||
|
||||
if (dev_priv != NULL)
|
||||
__glXFree(dev_priv);
|
||||
|
||||
if (fd >= 0)
|
||||
drmClose(fd);
|
||||
|
||||
DRICloseConnection(pScreen);
|
||||
|
||||
if (screen->driver)
|
||||
dlclose(screen->driver);
|
||||
|
||||
xfree(screen);
|
||||
|
||||
if (err_extra != NULL)
|
||||
LogMessage(X_ERROR,
|
||||
"AIGLX error: %s failed (%s)\n", err_msg, err_extra);
|
||||
else
|
||||
LogMessage(X_ERROR, "AIGLX error: %s failed\n", err_msg);
|
||||
|
||||
ErrorF("GLX-DRI: reverting to software rendering\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
__GLXprovider __glXDRIProvider = {
|
||||
__glXDRIscreenProbe,
|
||||
"DRI",
|
||||
NULL
|
||||
};
|
213
GL/glx/glxext.c
213
GL/glx/glxext.c
|
@ -23,6 +23,7 @@
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include "glxserver.h"
|
||||
#include <windowstr.h>
|
||||
#include <propertyst.h>
|
||||
|
@ -31,19 +32,12 @@
|
|||
#include "unpack.h"
|
||||
#include "glxutil.h"
|
||||
#include "glxext.h"
|
||||
#include "micmap.h"
|
||||
|
||||
|
||||
void GlxWrapInitVisuals(miInitVisualsProcPtr *);
|
||||
void GlxSetVisualConfigs(int nconfigs,
|
||||
__GLXvisualConfig *configs, void **privates);
|
||||
|
||||
static __GLXextensionInfo *__glXExt /* = &__glDDXExtensionInfo */;
|
||||
static Bool inDispatch;
|
||||
|
||||
/*
|
||||
** Forward declarations.
|
||||
*/
|
||||
static int __glXSwapDispatch(ClientPtr);
|
||||
static int __glXDispatch(ClientPtr);
|
||||
|
||||
/*
|
||||
|
@ -52,8 +46,7 @@ static int __glXDispatch(ClientPtr);
|
|||
static void ResetExtension(ExtensionEntry* extEntry)
|
||||
{
|
||||
__glXFlushContextCache();
|
||||
(*__glXExt->resetExtension)();
|
||||
__glXScreenReset();
|
||||
__glXResetScreens();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -158,6 +151,40 @@ static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id)
|
|||
return True;
|
||||
}
|
||||
|
||||
/*
|
||||
** Destroy routine that gets called when a drawable is freed. A drawable
|
||||
** contains the ancillary buffers needed for rendering.
|
||||
*/
|
||||
static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
|
||||
{
|
||||
__GLXcontext *cx, *cx1;
|
||||
|
||||
/*
|
||||
** Use glxPriv->type to figure out what kind of drawable this is. Don't
|
||||
** use glxPriv->pDraw->type because by the time this routine is called,
|
||||
** the pDraw might already have been freed.
|
||||
*/
|
||||
if (glxPriv->type == DRAWABLE_WINDOW) {
|
||||
/*
|
||||
** When a window is destroyed, notify all context bound to
|
||||
** it, that there are no longer bound to anything.
|
||||
*/
|
||||
for (cx = glxPriv->drawGlxc; cx; cx = cx1) {
|
||||
cx1 = cx->nextDrawPriv;
|
||||
cx->pendingState |= __GLX_PENDING_DESTROY;
|
||||
}
|
||||
|
||||
for (cx = glxPriv->readGlxc; cx; cx = cx1) {
|
||||
cx1 = cx->nextReadPriv;
|
||||
cx->pendingState |= __GLX_PENDING_DESTROY;
|
||||
}
|
||||
}
|
||||
|
||||
__glXUnrefDrawable(glxPriv);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*
|
||||
** Free a context.
|
||||
*/
|
||||
|
@ -165,18 +192,24 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
|
|||
{
|
||||
if (cx->idExists || cx->isCurrent) return GL_FALSE;
|
||||
|
||||
if (!cx->isDirect) {
|
||||
if ((*cx->gc->exports.destroyContext)((__GLcontext *)cx->gc) == GL_FALSE) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
if (cx->feedbackBuf) __glXFree(cx->feedbackBuf);
|
||||
if (cx->selectBuf) __glXFree(cx->selectBuf);
|
||||
__glXFree(cx);
|
||||
if (cx == __glXLastContext) {
|
||||
__glXFlushContextCache();
|
||||
}
|
||||
|
||||
/* We can get here through both regular dispatching from
|
||||
* __glXDispatch() or as a callback from the resource manager. In
|
||||
* the latter case we need to lift the DRI lock manually. */
|
||||
|
||||
if (!inDispatch)
|
||||
__glXleaveServer();
|
||||
|
||||
cx->destroy(cx);
|
||||
|
||||
if (!inDispatch)
|
||||
__glXenterServer();
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
@ -240,13 +273,14 @@ void GlxExtensionInit(void)
|
|||
__glXContextRes = CreateNewResourceType((DeleteType)ContextGone);
|
||||
__glXClientRes = CreateNewResourceType((DeleteType)ClientGone);
|
||||
__glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone);
|
||||
__glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
|
||||
|
||||
/*
|
||||
** Add extension to server extensions.
|
||||
*/
|
||||
extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
|
||||
__GLX_NUMBER_ERRORS, __glXDispatch,
|
||||
__glXSwapDispatch, ResetExtension,
|
||||
__glXDispatch, ResetExtension,
|
||||
StandardMinorOpcode);
|
||||
if (!extEntry) {
|
||||
FatalError("__glXExtensionInit: AddExtensions failed\n");
|
||||
|
@ -280,53 +314,7 @@ void GlxExtensionInit(void)
|
|||
/*
|
||||
** Initialize screen specific data.
|
||||
*/
|
||||
__glXScreenInit(screenInfo.numScreens);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
Bool __glXCoreType(void)
|
||||
{
|
||||
return __glXExt->type;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
void GlxSetVisualConfigs(int nconfigs,
|
||||
__GLXvisualConfig *configs, void **privates)
|
||||
{
|
||||
(*__glXExt->setVisualConfigs)(nconfigs, configs, privates);
|
||||
}
|
||||
|
||||
static miInitVisualsProcPtr saveInitVisualsProc;
|
||||
|
||||
Bool GlxInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
|
||||
int *nvisualp, int *ndepthp,
|
||||
int *rootDepthp, VisualID *defaultVisp,
|
||||
unsigned long sizes, int bitsPerRGB,
|
||||
int preferredVis)
|
||||
{
|
||||
Bool ret;
|
||||
|
||||
if (saveInitVisualsProc) {
|
||||
ret = saveInitVisualsProc(visualp, depthp, nvisualp, ndepthp,
|
||||
rootDepthp, defaultVisp, sizes, bitsPerRGB,
|
||||
preferredVis);
|
||||
if (!ret)
|
||||
return False;
|
||||
}
|
||||
(*__glXExt->initVisuals)(visualp, depthp, nvisualp, ndepthp, rootDepthp,
|
||||
defaultVisp, sizes, bitsPerRGB);
|
||||
return True;
|
||||
}
|
||||
|
||||
void
|
||||
GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc)
|
||||
{
|
||||
saveInitVisualsProc = *initVisProc;
|
||||
*initVisProc = GlxInitVisuals;
|
||||
/* HACK: this shouldn't be done here but it's the earliest time */
|
||||
__glXExt = __glXglDDXExtensionInfo(); /* from GLcore */
|
||||
__glXInitScreens();
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -377,7 +365,7 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
|
|||
|
||||
/* Make this context the current one for the GL. */
|
||||
if (!cx->isDirect) {
|
||||
if (!(*cx->gc->exports.forceCurrent)((__GLcontext *)cx->gc)) {
|
||||
if (!(*cx->forceCurrent)(cx)) {
|
||||
/* Bind failed, and set the error code. Bummer */
|
||||
cl->client->errorValue = cx->id;
|
||||
*error = __glXBadContextState;
|
||||
|
@ -390,6 +378,44 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
|
|||
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
** Top level dispatcher; all commands are executed from here down.
|
||||
*/
|
||||
|
||||
/* I cried when I wrote this. Damn you XAA! */
|
||||
|
||||
static void
|
||||
__glXnopEnterServer(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
__glXnopLeaveServer(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void (*__glXenterServerFunc)(void) = __glXnopEnterServer;
|
||||
static void (*__glXleaveServerFunc)(void) = __glXnopLeaveServer;
|
||||
|
||||
void __glXsetEnterLeaveServerFuncs(void (*enter)(void),
|
||||
void (*leave)(void))
|
||||
{
|
||||
__glXenterServerFunc = enter;
|
||||
__glXleaveServerFunc = leave;
|
||||
}
|
||||
|
||||
|
||||
void __glXenterServer(void)
|
||||
{
|
||||
(*__glXenterServerFunc)();
|
||||
}
|
||||
|
||||
void __glXleaveServer(void)
|
||||
{
|
||||
(*__glXleaveServerFunc)();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Top level dispatcher; all commands are executed from here down.
|
||||
*/
|
||||
|
@ -399,6 +425,7 @@ static int __glXDispatch(ClientPtr client)
|
|||
CARD8 opcode;
|
||||
int (*proc)(__GLXclientState *cl, GLbyte *pc);
|
||||
__GLXclientState *cl;
|
||||
int retval;
|
||||
|
||||
opcode = stuff->glxCode;
|
||||
cl = __glXClients[client->index];
|
||||
|
@ -443,54 +470,22 @@ static int __glXDispatch(ClientPtr client)
|
|||
/*
|
||||
** Use the opcode to index into the procedure table.
|
||||
*/
|
||||
proc = __glXSingleTable[opcode];
|
||||
return (*proc)(cl, (GLbyte *) stuff);
|
||||
}
|
||||
if (client->swapped)
|
||||
proc = __glXSwapSingleTable[opcode];
|
||||
else
|
||||
proc = __glXSingleTable[opcode];
|
||||
|
||||
static int __glXSwapDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGLXSingleReq);
|
||||
CARD8 opcode;
|
||||
int (*proc)(__GLXclientState *cl, GLbyte *pc);
|
||||
__GLXclientState *cl;
|
||||
__glXleaveServer();
|
||||
|
||||
opcode = stuff->glxCode;
|
||||
cl = __glXClients[client->index];
|
||||
if (!cl) {
|
||||
cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
|
||||
__glXClients[client->index] = cl;
|
||||
if (!cl) {
|
||||
return BadAlloc;
|
||||
}
|
||||
__glXMemset(cl, 0, sizeof(__GLXclientState));
|
||||
}
|
||||
|
||||
if (!cl->inUse) {
|
||||
/*
|
||||
** This is first request from this client. Associate a resource
|
||||
** with the client so we will be notified when the client dies.
|
||||
*/
|
||||
XID xid = FakeClientID(client->index);
|
||||
if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) {
|
||||
return BadAlloc;
|
||||
}
|
||||
ResetClientState(client->index);
|
||||
cl->inUse = GL_TRUE;
|
||||
cl->client = client;
|
||||
}
|
||||
inDispatch = True;
|
||||
|
||||
/*
|
||||
** Check for valid opcode.
|
||||
*/
|
||||
if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
|
||||
return BadRequest;
|
||||
}
|
||||
retval = proc(cl, (GLbyte *) stuff);
|
||||
|
||||
/*
|
||||
** Use the opcode to index into the procedure table.
|
||||
*/
|
||||
proc = __glXSwapSingleTable[opcode];
|
||||
return (*proc)(cl, (GLbyte *) stuff);
|
||||
inDispatch = False;
|
||||
|
||||
__glXenterServer();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int __glXNoSuchSingleOpcode(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
183
GL/glx/glxfb.c
183
GL/glx/glxfb.c
|
@ -1,183 +0,0 @@
|
|||
/* $XFree86$ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
*/
|
||||
|
||||
/*
|
||||
** An implementation of a buffer which is part of the front buffer
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
#include "glxfb.h"
|
||||
|
||||
#include <gcstruct.h>
|
||||
|
||||
/* so we don't include glmath.h */
|
||||
extern GLuint __glFloorLog2(GLuint);
|
||||
|
||||
typedef struct __GLFBbufferInfoRec {
|
||||
GCPtr pGC;
|
||||
} __GLFBbufferInfo;
|
||||
|
||||
extern PixmapPtr __glXPrivPixGetPtr(__GLdrawableBuffer *);
|
||||
|
||||
/* ---------------------------------------------------------- */
|
||||
|
||||
static GLboolean
|
||||
Resize(__GLdrawableBuffer *buf,
|
||||
GLint x, GLint y, GLuint width, GLuint height,
|
||||
__GLdrawablePrivate *glPriv, GLuint bufferMask)
|
||||
{
|
||||
buf->width = width;
|
||||
buf->height = height;
|
||||
buf->byteWidth = width * buf->elementSize;
|
||||
buf->outerWidth = width;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
Lock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
Unlock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
** Do a swap buffer with
|
||||
** a memory surface as a back buffer
|
||||
** a FB surface as a front buffer
|
||||
*/
|
||||
GLboolean
|
||||
__glXFBMemSwapBuffers(__GLXdrawablePrivate *glxPriv)
|
||||
{
|
||||
__GLdrawablePrivate *glPriv = &glxPriv->glPriv;
|
||||
__GLdrawableBuffer *front = &glPriv->frontBuffer;
|
||||
__GLdrawableBuffer *back = &glPriv->backBuffer;
|
||||
__GLFBbufferInfo *bufferInfo;
|
||||
GCPtr pGC;
|
||||
GLint width, height, depth, pad;
|
||||
GLubyte *buf;
|
||||
|
||||
bufferInfo = (__GLFBbufferInfo *) front->other;
|
||||
pGC = bufferInfo->pGC;
|
||||
|
||||
width = back->width;
|
||||
height = back->height;
|
||||
depth = back->depth;
|
||||
buf = back->base;
|
||||
pad = back->outerWidth - back->width; /* back buffer padding */
|
||||
/* adjust buffer padding. X wants left, GL has right */
|
||||
buf -= pad;
|
||||
|
||||
ValidateGC(glxPriv->pDraw, pGC);
|
||||
(*pGC->ops->PutImage)(glxPriv->pDraw, pGC,
|
||||
depth,
|
||||
0, 0, width, height,
|
||||
pad, ZPixmap,
|
||||
(char *)buf);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
|
||||
{
|
||||
__GLFBbufferInfo *bufferInfo;
|
||||
|
||||
bufferInfo = (__GLFBbufferInfo *) buf->other;
|
||||
|
||||
if (bufferInfo->pGC) {
|
||||
FreeScratchGC(bufferInfo->pGC);
|
||||
}
|
||||
|
||||
__glXFree(bufferInfo);
|
||||
buf->other = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
** function to return the X GC of this buffer (to be used by DDX)
|
||||
*/
|
||||
GCPtr __glXFBGetGC(__GLdrawableBuffer *buf)
|
||||
{
|
||||
__GLFBbufferInfo *bufferInfo;
|
||||
|
||||
bufferInfo = (__GLFBbufferInfo *) buf->other;
|
||||
|
||||
if (bufferInfo) {
|
||||
return bufferInfo->pGC;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
__glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits)
|
||||
{
|
||||
__GLFBbufferInfo *bufferInfo;
|
||||
__GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *) glPriv->other;
|
||||
GCPtr pGC;
|
||||
|
||||
buf->depth = bits;
|
||||
buf->width = buf->height = 0; /* to be filled during Update */
|
||||
buf->handle = buf->base = NULL; /* to be filled during Update */
|
||||
buf->size = 0;
|
||||
buf->byteWidth = 0;
|
||||
buf->elementSize = ((bits-1) / 8) + 1;
|
||||
buf->elementSizeLog2 = __glFloorLog2(buf->elementSize);
|
||||
|
||||
buf->resize = Resize;
|
||||
buf->lock = Lock;
|
||||
buf->unlock = Unlock;
|
||||
buf->fill = NULL;
|
||||
buf->free = Free;
|
||||
|
||||
/* allocate local information */
|
||||
bufferInfo = (__GLFBbufferInfo *) __glXMalloc(sizeof(__GLFBbufferInfo));
|
||||
buf->other = (void *) bufferInfo;
|
||||
|
||||
pGC = CreateScratchGC(glxPriv->pDraw->pScreen,
|
||||
glxPriv->pDraw->depth);
|
||||
bufferInfo->pGC = pGC;
|
||||
(*pGC->funcs->ChangeClip)(pGC, CT_NONE, NULL, 0);
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/* $XFree86$ */
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef _glxfb_h_
|
||||
#define _glxfb_h_
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
*/
|
||||
|
||||
extern void __glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
|
||||
GLint bits);
|
||||
|
||||
extern GCPtr __glXFBGetGC(__GLdrawableBuffer *buf);
|
||||
|
||||
extern GLboolean __glXFBMemSwapBuffers(__GLXdrawablePrivate *glxPriv);
|
||||
|
||||
#endif /* _glxfb_h_ */
|
||||
|
|
@ -1,188 +0,0 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glximports.c,v 1.5 2001/03/21 16:29:36 dawes Exp $ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "glxserver.h"
|
||||
#include "glxcontext.h"
|
||||
#include "glximports.h"
|
||||
#include "GL/glx_ansic.h"
|
||||
|
||||
void *__glXImpMalloc(__GLcontext *gc, size_t size)
|
||||
{
|
||||
void *addr;
|
||||
|
||||
if (size == 0) {
|
||||
return NULL;
|
||||
}
|
||||
addr = xalloc(size);
|
||||
if (addr == NULL) {
|
||||
/* XXX: handle out of memory error */
|
||||
return NULL;
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
void *__glXImpCalloc(__GLcontext *gc, size_t numElements, size_t elementSize)
|
||||
{
|
||||
void *addr;
|
||||
size_t size;
|
||||
|
||||
if ((numElements == 0) || (elementSize == 0)) {
|
||||
return NULL;
|
||||
}
|
||||
size = numElements * elementSize;
|
||||
addr = xalloc(size);
|
||||
if (addr == NULL) {
|
||||
/* XXX: handle out of memory error */
|
||||
return NULL;
|
||||
}
|
||||
/* zero out memory */
|
||||
__glXMemset(addr, 0, size);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
void __glXImpFree(__GLcontext *gc, void *addr)
|
||||
{
|
||||
if (addr) {
|
||||
xfree(addr);
|
||||
}
|
||||
}
|
||||
|
||||
void *__glXImpRealloc(__GLcontext *gc, void *addr, size_t newSize)
|
||||
{
|
||||
void *newAddr;
|
||||
|
||||
if (addr) {
|
||||
if (newSize == 0) {
|
||||
xfree(addr);
|
||||
return NULL;
|
||||
}
|
||||
newAddr = xrealloc(addr, newSize);
|
||||
} else {
|
||||
if (newSize == 0) {
|
||||
return NULL;
|
||||
}
|
||||
newAddr = xalloc(newSize);
|
||||
}
|
||||
if (newAddr == NULL) {
|
||||
return NULL; /* XXX: out of memory error */
|
||||
}
|
||||
|
||||
return newAddr;
|
||||
}
|
||||
|
||||
void __glXImpWarning(__GLcontext *gc, char *msg)
|
||||
{
|
||||
ErrorF((char *)msg);
|
||||
}
|
||||
|
||||
void __glXImpFatal(__GLcontext *gc, char *msg)
|
||||
{
|
||||
ErrorF((char *)msg);
|
||||
__glXAbort();
|
||||
}
|
||||
|
||||
char *__glXImpGetenv(__GLcontext *gc, const char *var)
|
||||
{
|
||||
return __glXGetenv(var);
|
||||
}
|
||||
|
||||
int __glXImpAtoi(__GLcontext *gc, const char *str)
|
||||
{
|
||||
return __glXAtoi(str);
|
||||
}
|
||||
|
||||
int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
||||
/* have to deal with var args */
|
||||
va_start(ap, fmt);
|
||||
ret = __glXVsprintf(str, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *__glXImpFopen(__GLcontext *gc, const char *path, const char *mode)
|
||||
{
|
||||
return (void *) __glXFopen(path, mode);
|
||||
}
|
||||
|
||||
int __glXImpFclose(__GLcontext *gc, void *stream)
|
||||
{
|
||||
return __glXFclose((FILE *)stream);
|
||||
}
|
||||
|
||||
int __glXImpFprintf(__GLcontext *gc, void *stream, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
||||
/* have to deal with var args */
|
||||
va_start(ap, fmt);
|
||||
ret = __glXVfprintf((FILE *)stream, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
__GLdrawablePrivate *__glXImpGetDrawablePrivate(__GLcontext *gc)
|
||||
{
|
||||
__GLinterface *glci = (__GLinterface *) gc;
|
||||
__GLXcontext *glrc = (__GLXcontext *) glci->imports.other;
|
||||
|
||||
return &glrc->drawPriv->glPriv;
|
||||
}
|
||||
|
||||
|
||||
__GLdrawablePrivate *__glXImpGetReadablePrivate(__GLcontext *gc)
|
||||
{
|
||||
__GLinterface *glci = (__GLinterface *) gc;
|
||||
__GLXcontext *glrc = (__GLXcontext *) glci->imports.other;
|
||||
|
||||
return &glrc->readPriv->glPriv;
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glximports.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef _glximports_h_
|
||||
#define _glximports_h_
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
*/
|
||||
|
||||
extern void *__glXImpMalloc(__GLcontext *gc, size_t size);
|
||||
extern void *__glXImpCalloc(__GLcontext *gc, size_t nElem, size_t eSize);
|
||||
extern void *__glXImpRealloc(__GLcontext *gc, void *addr, size_t newSize);
|
||||
extern void __glXImpFree(__GLcontext *gc, void *addr);
|
||||
|
||||
extern void __glXImpWarning(__GLcontext *gc, char *msg);
|
||||
extern void __glXImpFatal(__GLcontext *gc, char *msg);
|
||||
|
||||
extern char *__glXImpGetenv(__GLcontext *gc, const char *var);
|
||||
extern int __glXImpAtoi(__GLcontext *gc, const char *str);
|
||||
extern int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...);
|
||||
extern void *__glXImpFopen(__GLcontext *gc, const char *path,
|
||||
const char *mode);
|
||||
extern int __glXImpFclose(__GLcontext *gc, void *stream);
|
||||
extern int __glXImpFprintf(__GLcontext *gc, void *stream,
|
||||
const char *fmt, ...);
|
||||
|
||||
extern __GLdrawablePrivate *__glXImpGetDrawablePrivate(__GLcontext *gc);
|
||||
extern __GLdrawablePrivate *__glXImpGetReadablePrivate(__GLcontext *gc);
|
||||
|
||||
|
||||
#endif /* _glximports_h_ */
|
||||
|
151
GL/glx/glxmem.c
151
GL/glx/glxmem.c
|
@ -1,151 +0,0 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.c,v 1.6 2001/10/31 22:50:27 tsi Exp $ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
*/
|
||||
|
||||
/*
|
||||
** Implementation of a buffer in main memory
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "glxserver.h"
|
||||
#include "glxmem.h"
|
||||
#include "glxext.h"
|
||||
#include "GL/internal/glcore.h"
|
||||
|
||||
/* don't want to include glmath.h */
|
||||
extern GLuint __glFloorLog2(GLuint);
|
||||
|
||||
/* ---------------------------------------------------------- */
|
||||
|
||||
#define BUF_ALIGN 32 /* x86 cache alignment (used for assembly paths) */
|
||||
#define BUF_ALIGN_MASK (BUF_ALIGN-1)
|
||||
|
||||
static GLboolean
|
||||
Resize(__GLdrawableBuffer *buf,
|
||||
GLint x, GLint y, GLuint width, GLuint height,
|
||||
__GLdrawablePrivate *glPriv, GLuint bufferMask)
|
||||
{
|
||||
GLuint newSize;
|
||||
void *ubase;
|
||||
GLint pixelWidth;
|
||||
GLint alignedWidth;
|
||||
|
||||
/*
|
||||
** Note:
|
||||
** buf->handle : unaligned base
|
||||
** buf->base : aligned base
|
||||
*/
|
||||
|
||||
pixelWidth = BUF_ALIGN / buf->elementSize;
|
||||
alignedWidth = (width & ~(pixelWidth-1)) + pixelWidth;
|
||||
|
||||
newSize = alignedWidth * height * buf->elementSize;
|
||||
|
||||
/*
|
||||
** Only allocate buffer space for the SGI core.
|
||||
** Mesa and Aqua handle their own buffer allocations.
|
||||
*/
|
||||
#if defined(__GL_BUFFER_SIZE_TRACKS_WINDOW)
|
||||
if (__glXCoreType() == GL_CORE_SGI) {
|
||||
#else
|
||||
if (newSize > buf->size && __glXCoreType() == GL_CORE_SGI) {
|
||||
#endif
|
||||
if (buf->handle) {
|
||||
ubase = (*glPriv->realloc)(buf->handle, newSize + BUF_ALIGN_MASK);
|
||||
if (ubase == NULL) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
} else {
|
||||
ubase = (*glPriv->malloc)(newSize + BUF_ALIGN_MASK);
|
||||
if (ubase == NULL) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
buf->size = newSize;
|
||||
|
||||
buf->handle = ubase;
|
||||
buf->base = (void *)(((size_t)ubase + BUF_ALIGN_MASK) &
|
||||
(unsigned int) ~BUF_ALIGN_MASK);
|
||||
assert(((size_t)buf->base % BUF_ALIGN) == 0);
|
||||
}
|
||||
|
||||
buf->width = width;
|
||||
buf->height = height;
|
||||
buf->byteWidth = alignedWidth * buf->elementSize;
|
||||
buf->outerWidth = alignedWidth;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
Lock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
Unlock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
|
||||
{
|
||||
if (buf->handle) {
|
||||
(*glPriv->free)(buf->handle);
|
||||
buf->handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
__glXInitMem(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits)
|
||||
{
|
||||
buf->width = buf->height = 0; /* to be filled during Update */
|
||||
buf->depth = bits;
|
||||
buf->size = 0;
|
||||
buf->handle = buf->base = NULL; /* to be filled during Update */
|
||||
buf->byteWidth = 0;
|
||||
buf->elementSize = ((bits - 1) / 8) + 1;
|
||||
buf->elementSizeLog2 = __glFloorLog2(buf->elementSize);
|
||||
|
||||
buf->resize = Resize;
|
||||
buf->lock = Lock;
|
||||
buf->unlock = Unlock;
|
||||
buf->fill = NULL;
|
||||
buf->free = Free;
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/* $XFree86$ */
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef _glxmem_h_
|
||||
#define _glxmem_h_
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
*/
|
||||
|
||||
extern void __glXInitMem(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
|
||||
GLint bits);
|
||||
|
||||
#endif /* _glxmem_h_ */
|
||||
|
132
GL/glx/glxpix.c
132
GL/glx/glxpix.c
|
@ -1,132 +0,0 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.3 2000/09/26 15:57:02 tsi Exp $ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
*/
|
||||
|
||||
/*
|
||||
** An implementation of a glx pixmap buffer
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
#include "glxpix.h"
|
||||
|
||||
#include <gcstruct.h>
|
||||
|
||||
/* don't want to include glmath.h */
|
||||
extern GLuint __glFloorLog2(GLuint);
|
||||
|
||||
typedef struct __GLPixBufferInfoRec {
|
||||
GCPtr pGC;
|
||||
} __GLPixBufferInfo;
|
||||
|
||||
/* ---------------------------------------------------------- */
|
||||
|
||||
static GLboolean
|
||||
Resize(__GLdrawableBuffer *buf,
|
||||
GLint x, GLint y, GLuint width, GLuint height,
|
||||
__GLdrawablePrivate *glPriv, GLuint bufferMask)
|
||||
{
|
||||
buf->width = width;
|
||||
buf->height = width;
|
||||
buf->byteWidth = width * buf->elementSize;
|
||||
buf->outerWidth = width;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
Lock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
Unlock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
|
||||
{
|
||||
__GLPixBufferInfo *bufferInfo;
|
||||
|
||||
if (LookupIDByType((XID)(long)buf->handle, __glXPixmapRes)) {
|
||||
FreeResource((XID)(long)buf->handle, FALSE);
|
||||
buf->handle = NULL;
|
||||
}
|
||||
|
||||
bufferInfo = (__GLPixBufferInfo *) buf->other;
|
||||
|
||||
if (bufferInfo->pGC) {
|
||||
FreeScratchGC(bufferInfo->pGC);
|
||||
}
|
||||
|
||||
__glXFree(bufferInfo);
|
||||
buf->other = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
__glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
|
||||
GLint bits, XID glxpixmapId, __GLXpixmap *pGlxPixmap)
|
||||
{
|
||||
__GLPixBufferInfo *bufferInfo;
|
||||
|
||||
buf->width = buf->height = 0; /* to be filled during Update */
|
||||
buf->depth = bits;
|
||||
buf->size = 0;
|
||||
buf->base = NULL;
|
||||
buf->byteWidth = 0;
|
||||
buf->elementSize = ((bits-1) / 8) + 1;
|
||||
buf->elementSizeLog2 = __glFloorLog2(buf->elementSize);
|
||||
|
||||
buf->handle = (void *)(long) glxpixmapId;
|
||||
pGlxPixmap->refcnt++;
|
||||
|
||||
buf->resize = Resize;
|
||||
buf->lock = Lock;
|
||||
buf->unlock = Unlock;
|
||||
buf->fill = NULL;
|
||||
buf->free = Free;
|
||||
|
||||
/* allocate local information */
|
||||
bufferInfo = (__GLPixBufferInfo *) __glXMalloc(sizeof(__GLPixBufferInfo));
|
||||
buf->other = (void *) bufferInfo;
|
||||
|
||||
bufferInfo->pGC = CreateScratchGC(pGlxPixmap->pDraw->pScreen,
|
||||
pGlxPixmap->pDraw->depth);
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/* $XFree86$ */
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef _glxpix_h_
|
||||
#define _glxpix_h_
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
*/
|
||||
|
||||
extern void __glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
|
||||
GLint bits, XID glxpixmapId, __GLXpixmap *pGlxPixmap);
|
||||
|
||||
#endif /* _glxpix_h_ */
|
||||
|
|
@ -38,12 +38,9 @@
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef IN_MODULE
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include <windowstr.h>
|
||||
#include <os.h>
|
||||
|
||||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
|
@ -130,6 +127,7 @@ static char GLXServerExtensions[] =
|
|||
"GLX_EXT_visual_info "
|
||||
"GLX_EXT_visual_rating "
|
||||
"GLX_EXT_import_context "
|
||||
"GLX_EXT_texture_from_pixmap "
|
||||
"GLX_OML_swap_method "
|
||||
"GLX_SGI_make_current_read "
|
||||
#ifndef __DARWIN__
|
||||
|
@ -140,75 +138,17 @@ static char GLXServerExtensions[] =
|
|||
"GLX_SGIX_fbconfig "
|
||||
;
|
||||
|
||||
/*
|
||||
* __glDDXScreenInfo comes from GLcore, so we can't resolve this symbol at
|
||||
* module open time. Leave a placeholder, and fill this in when we first
|
||||
* need it (in __glXScreenInit). XXX Why make this an array?
|
||||
*/
|
||||
static __GLXscreenInfo *__glXScreens[] = {
|
||||
NULL /* &__glDDXScreenInfo */ ,
|
||||
};
|
||||
|
||||
static GLint __glXNumStaticScreens =
|
||||
(sizeof __glXScreens / sizeof __glXScreens[0]);
|
||||
|
||||
__GLXscreenInfo *__glXActiveScreens;
|
||||
GLint __glXNumActiveScreens;
|
||||
__GLXscreen **__glXActiveScreens;
|
||||
|
||||
__GLXSwapBarrierExtensionFuncs *__glXSwapBarrierFuncs = NULL;
|
||||
static int __glXNumSwapBarrierFuncs = 0;
|
||||
__GLXHyperpipeExtensionFuncs *__glXHyperpipeFuncs = NULL;
|
||||
static int __glXNumHyperpipeFuncs = 0;
|
||||
|
||||
|
||||
RESTYPE __glXDrawableRes;
|
||||
|
||||
__GLXscreenInfo *__glXgetActiveScreen(int num) {
|
||||
return &__glXActiveScreens[num];
|
||||
__GLXscreen *__glXgetActiveScreen(int num) {
|
||||
return __glXActiveScreens[num];
|
||||
}
|
||||
|
||||
/*
|
||||
** Destroy routine that gets called when a drawable is freed. A drawable
|
||||
** contains the ancillary buffers needed for rendering.
|
||||
*/
|
||||
static Bool DrawableGone(__GLXdrawablePrivate *glxPriv, XID xid)
|
||||
{
|
||||
__GLXcontext *cx, *cx1;
|
||||
|
||||
/*
|
||||
** Use glxPriv->type to figure out what kind of drawable this is. Don't
|
||||
** use glxPriv->pDraw->type because by the time this routine is called,
|
||||
** the pDraw might already have been freed.
|
||||
*/
|
||||
if (glxPriv->type == DRAWABLE_WINDOW) {
|
||||
/*
|
||||
** When a window is destroyed, notify all context bound to
|
||||
** it, that there are no longer bound to anything.
|
||||
*/
|
||||
for (cx = glxPriv->drawGlxc; cx; cx = cx1) {
|
||||
cx1 = cx->nextDrawPriv;
|
||||
cx->pendingState |= __GLX_PENDING_DESTROY;
|
||||
}
|
||||
|
||||
for (cx = glxPriv->readGlxc; cx; cx = cx1) {
|
||||
cx1 = cx->nextReadPriv;
|
||||
cx->pendingState |= __GLX_PENDING_DESTROY;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** set the size to 0, so that context that may still be using this
|
||||
** drawable not do anything harmful
|
||||
*/
|
||||
glxPriv->xorigin = 0;
|
||||
glxPriv->yorigin = 0;
|
||||
glxPriv->width = 0;
|
||||
glxPriv->height = 0;
|
||||
|
||||
__glXUnrefDrawablePrivate(glxPriv);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*
|
||||
** This hook gets called when a window moves or changes size.
|
||||
|
@ -217,7 +157,7 @@ static Bool PositionWindow(WindowPtr pWin, int x, int y)
|
|||
{
|
||||
ScreenPtr pScreen;
|
||||
__GLXcontext *glxc;
|
||||
__GLXdrawablePrivate *glxPriv;
|
||||
__GLXdrawable *glxPriv;
|
||||
Bool ret;
|
||||
|
||||
/*
|
||||
|
@ -225,7 +165,7 @@ static Bool PositionWindow(WindowPtr pWin, int x, int y)
|
|||
*/
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
pScreen->PositionWindow =
|
||||
__glXActiveScreens[pScreen->myNum].WrappedPositionWindow;
|
||||
__glXActiveScreens[pScreen->myNum]->WrappedPositionWindow;
|
||||
ret = (*pScreen->PositionWindow)(pWin, x, y);
|
||||
pScreen->PositionWindow = PositionWindow;
|
||||
|
||||
|
@ -233,8 +173,8 @@ static Bool PositionWindow(WindowPtr pWin, int x, int y)
|
|||
** Tell all contexts rendering into this window that the window size
|
||||
** has changed.
|
||||
*/
|
||||
glxPriv = (__GLXdrawablePrivate *) LookupIDByType(pWin->drawable.id,
|
||||
__glXDrawableRes);
|
||||
glxPriv = (__GLXdrawable *) LookupIDByType(pWin->drawable.id,
|
||||
__glXDrawableRes);
|
||||
if (glxPriv == NULL) {
|
||||
/*
|
||||
** This window is not being used by the OpenGL.
|
||||
|
@ -246,7 +186,7 @@ static Bool PositionWindow(WindowPtr pWin, int x, int y)
|
|||
** resize the drawable
|
||||
*/
|
||||
/* first change the drawable size */
|
||||
if (__glXResizeDrawableBuffers(glxPriv) == GL_FALSE) {
|
||||
if (glxPriv->resize(glxPriv) == GL_FALSE) {
|
||||
/* resize failed! */
|
||||
/* XXX: what can we possibly do here? */
|
||||
ret = False;
|
||||
|
@ -265,18 +205,6 @@ static Bool PositionWindow(WindowPtr pWin, int x, int y)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
** Wrap our own PositionWindow routine around the server's, so we can
|
||||
** be notified when a window changes size
|
||||
*/
|
||||
static void wrapPositionWindow(int screen)
|
||||
{
|
||||
ScreenPtr pScreen = screenInfo.screens[screen];
|
||||
|
||||
__glXActiveScreens[screen].WrappedPositionWindow = pScreen->PositionWindow;
|
||||
pScreen->PositionWindow = PositionWindow;
|
||||
}
|
||||
|
||||
/*
|
||||
* If your DDX driver wants to register support for swap barriers or hyperpipe
|
||||
* topology, it should call __glXHyperpipeInit() or __glXSwapBarrierInit()
|
||||
|
@ -320,57 +248,80 @@ void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs)
|
|||
funcs->queryMaxSwapBarriersFunc;
|
||||
}
|
||||
|
||||
void __glXScreenInit(GLint numscreens)
|
||||
{
|
||||
GLint i,j;
|
||||
static __GLXprovider *__glXProviderStack;
|
||||
|
||||
__glXScreens[0] = __glXglDDXScreenInfo(); /* from GLcore */
|
||||
void GlxPushProvider(__GLXprovider *provider)
|
||||
{
|
||||
provider->next = __glXProviderStack;
|
||||
__glXProviderStack = provider;
|
||||
}
|
||||
|
||||
void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen)
|
||||
{
|
||||
screen->pScreen = pScreen;
|
||||
screen->GLextensions = __glXStrdup(GLServerExtensions);
|
||||
screen->GLXvendor = __glXStrdup(GLXServerVendorName);
|
||||
screen->GLXversion = __glXStrdup(GLXServerVersion);
|
||||
screen->GLXextensions = __glXStrdup(GLXServerExtensions);
|
||||
|
||||
screen->WrappedPositionWindow = pScreen->PositionWindow;
|
||||
pScreen->PositionWindow = PositionWindow;
|
||||
|
||||
__glXScreenInitVisuals(screen);
|
||||
}
|
||||
|
||||
void
|
||||
__glXScreenDestroy(__GLXscreen *screen)
|
||||
{
|
||||
__glXFree(screen->GLXvendor);
|
||||
__glXFree(screen->GLXversion);
|
||||
__glXFree(screen->GLXextensions);
|
||||
__glXFree(screen->GLextensions);
|
||||
}
|
||||
|
||||
void __glXInitScreens(void)
|
||||
{
|
||||
GLint i;
|
||||
ScreenPtr pScreen;
|
||||
__GLXprovider *p;
|
||||
size_t size;
|
||||
|
||||
/*
|
||||
** This alloc has to work or else the server might as well core dump.
|
||||
*/
|
||||
__glXActiveScreens =
|
||||
(__GLXscreenInfo *) __glXMalloc(sizeof(__GLXscreenInfo) * numscreens);
|
||||
size = screenInfo.numScreens * sizeof(__GLXscreen *);
|
||||
__glXActiveScreens =__glXMalloc(size);
|
||||
__glXMemset(__glXActiveScreens, 0, size);
|
||||
|
||||
for (i=0; i < numscreens; i++) {
|
||||
/*
|
||||
** Probe each static screen to see which exists.
|
||||
*/
|
||||
for (j=0; j < __glXNumStaticScreens; j++) {
|
||||
if ((*__glXScreens[j]->screenProbe)(i)) {
|
||||
__glXActiveScreens[i] = *__glXScreens[j];
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
pScreen = screenInfo.screens[i];
|
||||
|
||||
__glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals;
|
||||
__glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions);
|
||||
__glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName);
|
||||
__glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion);
|
||||
__glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions);
|
||||
|
||||
__glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
|
||||
wrapPositionWindow(i);
|
||||
for (p = __glXProviderStack; p != NULL; p = p->next) {
|
||||
__glXActiveScreens[i] = p->screenProbe(pScreen);
|
||||
if (__glXActiveScreens[i] != NULL) {
|
||||
LogMessage(X_INFO,
|
||||
"GLX: Initialized %s GL provider for screen %d\n",
|
||||
p->name, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
__glXNumActiveScreens = numscreens;
|
||||
}
|
||||
|
||||
void __glXScreenReset(void)
|
||||
void __glXResetScreens(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < __glXNumActiveScreens; i++) {
|
||||
__glXFree(__glXActiveScreens[i].GLXvendor);
|
||||
__glXFree(__glXActiveScreens[i].GLXversion);
|
||||
__glXFree(__glXActiveScreens[i].GLXextensions);
|
||||
__glXFree(__glXActiveScreens[i].GLextensions);
|
||||
}
|
||||
xfree(__glXActiveScreens);
|
||||
xfree(__glXHyperpipeFuncs);
|
||||
xfree(__glXSwapBarrierFuncs);
|
||||
__glXNumHyperpipeFuncs = 0;
|
||||
__glXNumSwapBarrierFuncs = 0;
|
||||
__glXHyperpipeFuncs = NULL;
|
||||
__glXSwapBarrierFuncs = NULL;
|
||||
__glXActiveScreens = NULL;
|
||||
__glXNumActiveScreens = 0;
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
if (__glXActiveScreens[i])
|
||||
__glXActiveScreens[i]->destroy(__glXActiveScreens[i]);
|
||||
|
||||
__glXFree(__glXActiveScreens);
|
||||
__glXFree(__glXHyperpipeFuncs);
|
||||
__glXFree(__glXSwapBarrierFuncs);
|
||||
__glXNumHyperpipeFuncs = 0;
|
||||
__glXNumSwapBarrierFuncs = 0;
|
||||
__glXHyperpipeFuncs = NULL;
|
||||
__glXSwapBarrierFuncs = NULL;
|
||||
__glXActiveScreens = NULL;
|
||||
}
|
||||
|
|
|
@ -51,28 +51,15 @@
|
|||
** and DDX layers of the GLX server extension. The methods provide an
|
||||
** interface for context management on a screen.
|
||||
*/
|
||||
typedef struct {
|
||||
/*
|
||||
** Probe the screen and see if it supports GL rendering. It will
|
||||
** return GL_FALSE if it doesn't, GL_TRUE otherwise.
|
||||
*/
|
||||
Bool (*screenProbe)(int screen);
|
||||
typedef struct __GLXscreen __GLXscreen;
|
||||
struct __GLXscreen {
|
||||
void (*destroy)(__GLXscreen *screen);
|
||||
|
||||
/*
|
||||
** Create a context using configuration information from modes.
|
||||
** Use imports as callbacks back to the OS. Return an opaque handle
|
||||
** on the context (NULL if failure).
|
||||
*/
|
||||
__GLinterface *(*createContext)(__GLimports *imports,
|
||||
__GLcontextModes *modes,
|
||||
__GLinterface *shareGC);
|
||||
__GLXcontext *(*createContext)(__GLXscreen *screen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXcontext *shareContext);
|
||||
|
||||
/*
|
||||
** Create a buffer using information from glxPriv. This routine
|
||||
** sets up any wrappers necessary to resize, swap or destroy the
|
||||
** buffer.
|
||||
*/
|
||||
void (*createBuffer)(__GLXdrawablePrivate *glxPriv);
|
||||
ScreenPtr pScreen;
|
||||
|
||||
/**
|
||||
* Linked list of valid context modes for this screen.
|
||||
|
@ -94,10 +81,13 @@ typedef struct {
|
|||
*/
|
||||
Bool (*WrappedPositionWindow)(WindowPtr pWin, int x, int y);
|
||||
|
||||
} __GLXscreenInfo;
|
||||
};
|
||||
|
||||
|
||||
extern void __glXScreenInit(GLint);
|
||||
extern void __glXScreenReset(void);
|
||||
void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen);
|
||||
void __glXScreenDestroy(__GLXscreen *screen);
|
||||
|
||||
void __glXInitScreens(void);
|
||||
extern void __glXResetScreens(void);
|
||||
|
||||
#endif /* !__GLX_screens_h__ */
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include <scrnintstr.h>
|
||||
#include "GL/glx_ansic.h"
|
||||
|
||||
|
||||
/*
|
||||
** The X header misc.h defines these math functions.
|
||||
*/
|
||||
|
@ -66,7 +65,8 @@
|
|||
#include <GL/glxint.h>
|
||||
|
||||
/* For glxscreens.h */
|
||||
typedef struct __GLXdrawablePrivateRec __GLXdrawablePrivate;
|
||||
typedef struct __GLXdrawable __GLXdrawable;
|
||||
typedef struct __GLXcontext __GLXcontext;
|
||||
|
||||
#include "glxscreens.h"
|
||||
#include "glxdrawable.h"
|
||||
|
@ -91,15 +91,19 @@ typedef XID GLXContextID;
|
|||
typedef XID GLXPixmap;
|
||||
typedef XID GLXDrawable;
|
||||
|
||||
typedef struct __GLXcontextRec *GLXContext;
|
||||
typedef struct __GLXclientStateRec __GLXclientState;
|
||||
|
||||
extern __GLXscreenInfo *__glXActiveScreens;
|
||||
extern __GLXscreen **__glXActiveScreens;
|
||||
extern GLint __glXNumActiveScreens;
|
||||
extern __GLXscreenInfo *__glXgetActiveScreen(int num);
|
||||
extern __GLXscreen *__glXgetActiveScreen(int num);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
void GlxSetVisualConfigs(int nconfigs,
|
||||
__GLXvisualConfig *configs, void **privates);
|
||||
|
||||
void __glXScreenInitVisuals(__GLXscreen *screen);
|
||||
|
||||
/*
|
||||
** The last context used (from the server's persective) is cached.
|
||||
*/
|
||||
|
@ -116,6 +120,20 @@ extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*);
|
|||
|
||||
/************************************************************************/
|
||||
|
||||
typedef struct __GLXprovider __GLXprovider;
|
||||
struct __GLXprovider {
|
||||
__GLXscreen *(*screenProbe)(ScreenPtr pScreen);
|
||||
const char *name;
|
||||
__GLXprovider *next;
|
||||
};
|
||||
|
||||
void GlxPushProvider(__GLXprovider *provider);
|
||||
|
||||
void __glXsetEnterLeaveServerFuncs(void (*enter)(void),
|
||||
void (*leave)(void));
|
||||
void __glXenterServer(void);
|
||||
void __glXleaveServer(void);
|
||||
|
||||
/*
|
||||
** State kept per client.
|
||||
*/
|
||||
|
@ -214,6 +232,8 @@ extern void __glXSwapQueryVersionReply(ClientPtr client,
|
|||
extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
|
||||
xGLXQueryContextInfoEXTReply *reply,
|
||||
int *buf);
|
||||
extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
|
||||
xGLXGetDrawableAttributesReply *reply, CARD32 *buf);
|
||||
extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
|
||||
xGLXQueryExtensionsStringReply *reply, char *buf);
|
||||
extern void glxSwapQueryServerStringReply(ClientPtr client,
|
||||
|
|
316
GL/glx/glxutil.c
316
GL/glx/glxutil.c
|
@ -48,7 +48,6 @@
|
|||
#include <pixmapstr.h>
|
||||
#include <windowstr.h>
|
||||
#include "glxutil.h"
|
||||
#include "glxbuf.h"
|
||||
#include "GL/glx_ansic.h"
|
||||
#include "GL/internal/glcore.h"
|
||||
#include "GL/glxint.h"
|
||||
|
@ -56,10 +55,6 @@
|
|||
|
||||
/************************************************************************/
|
||||
|
||||
void __glXNop(void) {}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/* Memory Allocation for GLX */
|
||||
|
||||
void *
|
||||
|
@ -93,7 +88,7 @@ __glXCalloc(size_t numElements, size_t elementSize)
|
|||
/* XXX: handle out of memory error */
|
||||
return NULL;
|
||||
}
|
||||
__glXMemset(addr, 0, size);
|
||||
memset(addr, 0, size);
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
@ -144,13 +139,13 @@ __glXAssociateContext(__GLXcontext *glxc)
|
|||
glxc->nextDrawPriv = glxc->drawPriv->drawGlxc;
|
||||
glxc->drawPriv->drawGlxc = glxc;
|
||||
|
||||
__glXRefDrawablePrivate(glxc->drawPriv);
|
||||
__glXRefDrawable(glxc->drawPriv);
|
||||
|
||||
|
||||
glxc->nextReadPriv = glxc->readPriv->readGlxc;
|
||||
glxc->readPriv->readGlxc = glxc;
|
||||
|
||||
__glXRefDrawablePrivate(glxc->readPriv);
|
||||
__glXRefDrawable(glxc->readPriv);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -173,7 +168,7 @@ __glXDeassociateContext(__GLXcontext *glxc)
|
|||
prev->nextDrawPriv = curr->nextDrawPriv;
|
||||
}
|
||||
curr->nextDrawPriv = NULL;
|
||||
__glXUnrefDrawablePrivate(glxc->drawPriv);
|
||||
__glXUnrefDrawable(glxc->drawPriv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -191,319 +186,72 @@ __glXDeassociateContext(__GLXcontext *glxc)
|
|||
prev->nextReadPriv = curr->nextReadPriv;
|
||||
}
|
||||
curr->nextReadPriv = NULL;
|
||||
__glXUnrefDrawablePrivate(glxc->readPriv);
|
||||
__glXUnrefDrawable(glxc->readPriv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
void
|
||||
__glXGetDrawableSize(__GLdrawablePrivate *glPriv,
|
||||
GLint *x, GLint *y, GLuint *width, GLuint *height)
|
||||
{
|
||||
__GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other;
|
||||
|
||||
if (glxPriv) {
|
||||
*x = glxPriv->xorigin;
|
||||
*y = glxPriv->yorigin;
|
||||
*width = glxPriv->width;
|
||||
*height = glxPriv->height;
|
||||
} else {
|
||||
*x = *y = *width = *height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
GLboolean
|
||||
__glXResizeDrawable(__GLdrawablePrivate *glPriv)
|
||||
{
|
||||
/* nothing to be done here */
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* accessing the drawable private */
|
||||
|
||||
static void
|
||||
LockDP(__GLdrawablePrivate *glPriv, __GLcontext *gc)
|
||||
{
|
||||
__GLinterface *glci = (__GLinterface *) gc;
|
||||
__GLXcontext *glxc = (__GLXcontext *) glci->imports.other;
|
||||
|
||||
/* quick exit test */
|
||||
if ((glxc->pendingState &
|
||||
(__GLX_PENDING_RESIZE |
|
||||
__GLX_PENDING_DESTROY |
|
||||
__GLX_PENDING_SWAP)) == 0x0)
|
||||
return;
|
||||
|
||||
/* some pending state. Deal with it */
|
||||
if (glxc->pendingState & __GLX_PENDING_RESIZE) {
|
||||
glxc->pendingState &= ~__GLX_PENDING_RESIZE;
|
||||
|
||||
(*glci->exports.notifyResize)(gc);
|
||||
assert((glxc->pendingState & __GLX_PENDING_RESIZE) == 0x0);
|
||||
}
|
||||
if (glxc->pendingState & __GLX_PENDING_DESTROY) {
|
||||
glxc->pendingState &= ~__GLX_PENDING_DESTROY;
|
||||
|
||||
assert(glxc->drawPriv->xorigin == 0);
|
||||
assert(glxc->drawPriv->yorigin == 0);
|
||||
assert(glxc->drawPriv->width == 0);
|
||||
assert(glxc->drawPriv->height == 0);
|
||||
assert(glxc->readPriv->xorigin == 0);
|
||||
assert(glxc->readPriv->yorigin == 0);
|
||||
assert(glxc->readPriv->width == 0);
|
||||
assert(glxc->readPriv->height == 0);
|
||||
(*glci->exports.notifyDestroy)(gc);
|
||||
__glXDeassociateContext(glxc);
|
||||
assert((glxc->pendingState & __GLX_PENDING_DESTROY) == 0x0);
|
||||
}
|
||||
if (glxc->pendingState & __GLX_PENDING_SWAP) {
|
||||
|
||||
glxc->pendingState &= ~__GLX_PENDING_SWAP;
|
||||
|
||||
(*glci->exports.notifySwapBuffers)(gc);
|
||||
assert((glxc->pendingState & __GLX_PENDING_SWAP) == 0x0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
UnlockDP(__GLdrawablePrivate *glPriv)
|
||||
{
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Drawable private stuff */
|
||||
|
||||
void
|
||||
__glXRefDrawablePrivate(__GLXdrawablePrivate *glxPriv)
|
||||
__glXRefDrawable(__GLXdrawable *glxPriv)
|
||||
{
|
||||
glxPriv->refCount++;
|
||||
}
|
||||
|
||||
void
|
||||
__glXUnrefDrawablePrivate(__GLXdrawablePrivate *glxPriv)
|
||||
__glXUnrefDrawable(__GLXdrawable *glxPriv)
|
||||
{
|
||||
glxPriv->refCount--;
|
||||
if (glxPriv->refCount == 0) {
|
||||
__glXDestroyDrawablePrivate(glxPriv);
|
||||
/* remove the drawable from the drawable list */
|
||||
FreeResourceByType(glxPriv->drawId, __glXDrawableRes, FALSE);
|
||||
glxPriv->destroy(glxPriv);
|
||||
}
|
||||
}
|
||||
|
||||
__GLXdrawablePrivate *
|
||||
__glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId,
|
||||
__GLcontextModes *modes)
|
||||
{
|
||||
__GLXdrawablePrivate *glxPriv;
|
||||
__GLdrawablePrivate *glPriv;
|
||||
__GLXscreenInfo *pGlxScreen;
|
||||
|
||||
glxPriv = (__GLXdrawablePrivate *) __glXMalloc(sizeof(*glxPriv));
|
||||
__glXMemset(glxPriv, 0, sizeof(__GLXdrawablePrivate));
|
||||
|
||||
glxPriv->type = pDraw->type;
|
||||
glxPriv->pDraw = pDraw;
|
||||
glxPriv->drawId = drawId;
|
||||
|
||||
/* if not a pixmap, lookup will fail, so pGlxPixmap will be NULL */
|
||||
glxPriv->pGlxPixmap = (__GLXpixmap *)
|
||||
LookupIDByType(drawId, __glXPixmapRes);
|
||||
/* since we are creating the drawablePrivate, drawId should be new */
|
||||
if (!AddResource(drawId, __glXDrawableRes, glxPriv)) {
|
||||
/* oops! */
|
||||
__glXFree(glxPriv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* fill up glPriv */
|
||||
glPriv = &glxPriv->glPriv;
|
||||
glPriv->modes = (__GLcontextModes *) __glXMalloc(sizeof(__GLcontextModes));
|
||||
*glPriv->modes = *modes;
|
||||
glPriv->malloc = __glXMalloc;
|
||||
glPriv->calloc = __glXCalloc;
|
||||
glPriv->realloc = __glXRealloc;
|
||||
glPriv->free = __glXFree;
|
||||
glPriv->addSwapRect = NULL;
|
||||
glPriv->setClipRect = (void (*)(__GLdrawablePrivate *, GLint, GLint, GLsizei, GLsizei)) __glXNop;
|
||||
glPriv->lockDP = LockDP;
|
||||
glPriv->unlockDP = UnlockDP;
|
||||
glPriv->getDrawableSize = __glXGetDrawableSize;
|
||||
glPriv->resize = __glXResizeDrawable;
|
||||
glPriv->other = glxPriv;
|
||||
|
||||
/* allocate a one-rect ownership region */
|
||||
glPriv->ownershipRegion.rects =
|
||||
(__GLregionRect *)__glXCalloc(1, sizeof(__GLregionRect));
|
||||
glPriv->ownershipRegion.numRects = 1;
|
||||
|
||||
glxPriv->freeBuffers = __glXFreeBuffers;
|
||||
glxPriv->updatePalette = (void (*)(__GLXdrawablePrivate *)) __glXNop;
|
||||
|
||||
pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum];
|
||||
|
||||
if (glxPriv->type == DRAWABLE_WINDOW) {
|
||||
VisualID vid = wVisual((WindowPtr)pDraw);
|
||||
|
||||
glxPriv->modes = _gl_context_modes_find_visual( pGlxScreen->modes, vid );
|
||||
__glXFBInitDrawable(glxPriv, modes);
|
||||
} else {
|
||||
glxPriv->modes = glxPriv->pGlxPixmap->modes;
|
||||
__glXPixInitDrawable(glxPriv, modes);
|
||||
}
|
||||
|
||||
/* initialize the core's private buffer information */
|
||||
(*pGlxScreen->createBuffer)(glxPriv);
|
||||
|
||||
return glxPriv;
|
||||
}
|
||||
|
||||
GLboolean
|
||||
__glXDestroyDrawablePrivate(__GLXdrawablePrivate *glxPriv)
|
||||
__glXDrawableInit(__GLXdrawable *drawable,
|
||||
__GLXcontext *ctx, DrawablePtr pDraw, XID drawId)
|
||||
{
|
||||
__GLdrawablePrivate *glPriv = &glxPriv->glPriv;
|
||||
drawable->type = pDraw->type;
|
||||
drawable->pDraw = pDraw;
|
||||
drawable->drawId = drawId;
|
||||
drawable->refCount = 1;
|
||||
|
||||
/* remove the drawable from the drawable list */
|
||||
FreeResourceByType(glxPriv->drawId, __glXDrawableRes, FALSE);
|
||||
/* if not a pixmap, lookup will fail, so pGlxPixmap will be NULL */
|
||||
drawable->pGlxPixmap = (__GLXpixmap *)
|
||||
LookupIDByType(drawId, __glXPixmapRes);
|
||||
|
||||
/* Have the core free any memory it may have attached to the drawable */
|
||||
if (glPriv->freePrivate) {
|
||||
(*glPriv->freePrivate)(glPriv);
|
||||
/* since we are creating the drawablePrivate, drawId should be new */
|
||||
if (!AddResource(drawId, __glXDrawableRes, drawable)) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Free any framebuffer memory attached to the drawable */
|
||||
if (glxPriv->freeBuffers) {
|
||||
(*glxPriv->freeBuffers)(glxPriv);
|
||||
}
|
||||
|
||||
/* Free the drawable Private */
|
||||
__glXFree(glxPriv->glPriv.modes);
|
||||
__glXFree(glxPriv->glPriv.ownershipRegion.rects);
|
||||
__glXFree(glxPriv);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
__GLXdrawablePrivate *
|
||||
__glXFindDrawablePrivate(XID drawId)
|
||||
__GLXdrawable *
|
||||
__glXFindDrawable(XID drawId)
|
||||
{
|
||||
__GLXdrawablePrivate *glxPriv;
|
||||
__GLXdrawable *glxPriv;
|
||||
|
||||
glxPriv = (__GLXdrawablePrivate *)LookupIDByType(drawId, __glXDrawableRes);
|
||||
glxPriv = (__GLXdrawable *)LookupIDByType(drawId, __glXDrawableRes);
|
||||
|
||||
return glxPriv;
|
||||
}
|
||||
|
||||
__GLXdrawablePrivate *
|
||||
__glXGetDrawablePrivate(DrawablePtr pDraw, XID drawId,
|
||||
__GLcontextModes *modes)
|
||||
__GLXdrawable *
|
||||
__glXGetDrawable(__GLXcontext *ctx, DrawablePtr pDraw, XID drawId)
|
||||
{
|
||||
__GLXdrawablePrivate *glxPriv;
|
||||
__GLXdrawable *glxPriv;
|
||||
|
||||
glxPriv = __glXFindDrawablePrivate(drawId);
|
||||
glxPriv = __glXFindDrawable(drawId);
|
||||
|
||||
if (glxPriv == NULL) {
|
||||
glxPriv = __glXCreateDrawablePrivate(pDraw, drawId, modes);
|
||||
if (glxPriv) {
|
||||
__glXRefDrawablePrivate(glxPriv);
|
||||
}
|
||||
}
|
||||
if (glxPriv == NULL)
|
||||
glxPriv = ctx->createDrawable(ctx, pDraw, drawId);
|
||||
|
||||
return glxPriv;
|
||||
}
|
||||
|
||||
void
|
||||
__glXCacheDrawableSize(__GLXdrawablePrivate *glxPriv)
|
||||
{
|
||||
if (glxPriv) {
|
||||
if (glxPriv->pDraw) {
|
||||
glxPriv->xorigin = glxPriv->pDraw->x;
|
||||
glxPriv->yorigin = glxPriv->pDraw->y;
|
||||
glxPriv->width = glxPriv->pDraw->width;
|
||||
glxPriv->height = glxPriv->pDraw->height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** resize/move the drawable. Called during the actual resize callback
|
||||
** to update the drawable side of the buffers
|
||||
*/
|
||||
GLboolean
|
||||
__glXResizeDrawableBuffers(__GLXdrawablePrivate *glxPriv)
|
||||
{
|
||||
__GLdrawablePrivate *glPriv = &glxPriv->glPriv;
|
||||
GLint x, y;
|
||||
GLuint w, h;
|
||||
#if defined(__GL_ALIGNED_BUFFERS)
|
||||
GLint xAlignment, yAlignment;
|
||||
GLint xOffset, yOffset;
|
||||
GLint xStart, xEnd;
|
||||
GLint yStart, yEnd;
|
||||
GLuint xAlignedMask, yAlignedMask;
|
||||
#endif
|
||||
GLboolean status = GL_TRUE;
|
||||
|
||||
__glXCacheDrawableSize(glxPriv);
|
||||
|
||||
w = glxPriv->width;
|
||||
h = glxPriv->height;
|
||||
x = glxPriv->xorigin;
|
||||
y = glxPriv->yorigin;
|
||||
|
||||
#if defined(__GL_ALIGNED_BUFFERS)
|
||||
xAlignment = glPriv->xAlignment;
|
||||
yAlignment = glPriv->yAlignment;
|
||||
|
||||
xOffset = x & (xAlignment-1);
|
||||
yOffset = y & (yAlignment-1);
|
||||
|
||||
xAlignedMask = ~(xAlignment-1);
|
||||
yAlignedMask = ~(yAlignment-1);
|
||||
|
||||
xStart = x; xEnd = x+w;
|
||||
yStart = y; yEnd = y+h;
|
||||
|
||||
xStart &= xAlignedMask;
|
||||
if (xEnd & ~xAlignedMask) {
|
||||
xEnd = (xEnd&xAlignedMask) + xAlignment;
|
||||
}
|
||||
yStart &= yAlignedMask;
|
||||
if (yEnd & ~yAlignedMask) {
|
||||
yEnd = (yEnd&yAlignedMask) + yAlignment;
|
||||
}
|
||||
|
||||
x = xStart; y = yStart;
|
||||
w = xEnd-xStart; h = yEnd-yStart;
|
||||
#endif
|
||||
|
||||
if ((x != glPriv->xOrigin) ||
|
||||
(y != glPriv->yOrigin) ||
|
||||
#if defined(__GL_ALIGNED_BUFFERS)
|
||||
(xOffset != glPriv->xOffset) ||
|
||||
(yOffset != glPriv->yOffset) ||
|
||||
#endif
|
||||
(w != glPriv->width) ||
|
||||
(h != glPriv->height) ||
|
||||
(!w && !h)) {
|
||||
/* set up the glPriv info */
|
||||
glPriv->width = w;
|
||||
glPriv->height = h;
|
||||
glPriv->xOrigin = x;
|
||||
glPriv->yOrigin = y;
|
||||
#if defined(__GL_ALIGNED_BUFFERS)
|
||||
glPriv->xOffset = xOffset;
|
||||
glPriv->yOffset = yOffset;
|
||||
#endif
|
||||
|
||||
/* notify the buffers */
|
||||
status = __glXResizeBuffers(glPriv, x, y, w, h);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
|
|
@ -58,20 +58,23 @@ extern void __glXGetDrawableSize(__GLdrawablePrivate *glPriv,
|
|||
GLint *x, GLint *y,
|
||||
GLuint *width, GLuint *height);
|
||||
extern GLboolean __glXResizeDrawable(__GLdrawablePrivate *glPriv);
|
||||
extern GLboolean __glXResizeDrawableBuffers(__GLXdrawablePrivate *glxPriv);
|
||||
extern GLboolean __glXResizeDrawableBuffers(__GLXdrawable *glxPriv);
|
||||
|
||||
/* drawable management */
|
||||
extern void __glXRefDrawablePrivate(__GLXdrawablePrivate *glxPriv);
|
||||
extern void __glXUnrefDrawablePrivate(__GLXdrawablePrivate *glxPriv);
|
||||
extern __GLXdrawablePrivate *__glXCreateDrawablePrivate(DrawablePtr pDraw,
|
||||
XID glxpixmapId,
|
||||
__GLcontextModes *modes);
|
||||
extern GLboolean __glXDestroyDrawablePrivate(__GLXdrawablePrivate *glxPriv);
|
||||
extern __GLXdrawablePrivate *__glXFindDrawablePrivate(XID glxpixmapId);
|
||||
extern __GLXdrawablePrivate *__glXGetDrawablePrivate(DrawablePtr pDraw,
|
||||
XID glxpixmapId,
|
||||
__GLcontextModes *modes);
|
||||
extern void __glXCacheDrawableSize(__GLXdrawablePrivate *glxPriv);
|
||||
extern void __glXRefDrawable(__GLXdrawable *glxPriv);
|
||||
extern void __glXUnrefDrawable(__GLXdrawable *glxPriv);
|
||||
|
||||
extern __GLXdrawable *__glXCreateDrawable(__GLXcontext *ctx,
|
||||
DrawablePtr pDraw,
|
||||
XID glxpixmapId);
|
||||
extern GLboolean __glXDrawableInit(__GLXdrawable *drawable, __GLXcontext *ctx,
|
||||
DrawablePtr pDraw, XID drawID);
|
||||
extern GLboolean __glXDestroyDrawable(__GLXdrawable *glxPriv);
|
||||
extern __GLXdrawable *__glXFindDrawable(XID glxpixmapId);
|
||||
extern __GLXdrawable *__glXGetDrawable(__GLXcontext *ctx,
|
||||
DrawablePtr pDraw,
|
||||
XID glxpixmapId);
|
||||
extern void __glXCacheDrawableSize(__GLXdrawable *glxPriv);
|
||||
|
||||
/* context helper routines */
|
||||
extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag);
|
||||
|
|
517
GL/glx/glxvisuals.c
Normal file
517
GL/glx/glxvisuals.c
Normal file
|
@ -0,0 +1,517 @@
|
|||
/*
|
||||
* Copyright © 2006 Red Hat, Inc.
|
||||
* (C) Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* RED HAT, INC, OR PRECISION INSIGHT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Kevin E. Martin <kevin@precisioninsight.com>
|
||||
* Brian Paul <brian@precisioninsight.com>
|
||||
* Kristian Høgsberg <krh@redhat.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <regionstr.h>
|
||||
#include <resource.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glxint.h>
|
||||
#include <GL/glxtokens.h>
|
||||
#include <GL/internal/glcore.h>
|
||||
#include <scrnintstr.h>
|
||||
#include <config.h>
|
||||
#include <glxserver.h>
|
||||
#include <glxscreens.h>
|
||||
#include <glxdrawable.h>
|
||||
#include <glxcontext.h>
|
||||
#include <glxext.h>
|
||||
#include <glxutil.h>
|
||||
#include <micmap.h>
|
||||
|
||||
void GlxWrapInitVisuals(miInitVisualsProcPtr *);
|
||||
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
struct ScreenVisualsRec {
|
||||
int num_vis;
|
||||
void *private;
|
||||
__GLcontextModes *modes;
|
||||
};
|
||||
typedef struct ScreenVisualsRec ScreenVisuals;
|
||||
|
||||
static ScreenVisuals screenVisuals[MAXSCREENS];
|
||||
|
||||
static int numConfigs = 0;
|
||||
static __GLXvisualConfig *visualConfigs = NULL;
|
||||
static void **visualPrivates = NULL;
|
||||
|
||||
static int count_bits(unsigned int n)
|
||||
{
|
||||
int bits = 0;
|
||||
|
||||
while (n > 0) {
|
||||
if (n & 1) bits++;
|
||||
n >>= 1;
|
||||
}
|
||||
return bits;
|
||||
}
|
||||
|
||||
/*
|
||||
* In the case the driver defines no GLX visuals we'll use these.
|
||||
* Note that for TrueColor and DirectColor visuals, bufferSize is the
|
||||
* sum of redSize, greenSize, blueSize and alphaSize, which may be larger
|
||||
* than the nplanes/rootDepth of the server's X11 visuals
|
||||
*/
|
||||
#define NUM_FALLBACK_CONFIGS 5
|
||||
static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = {
|
||||
/* [0] = RGB, double buffered, Z */
|
||||
{
|
||||
-1, /* vid */
|
||||
-1, /* class */
|
||||
True, /* rgba */
|
||||
-1, -1, -1, 0, /* rgba sizes */
|
||||
-1, -1, -1, 0, /* rgba masks */
|
||||
0, 0, 0, 0, /* rgba accum sizes */
|
||||
True, /* doubleBuffer */
|
||||
False, /* stereo */
|
||||
-1, /* bufferSize */
|
||||
16, /* depthSize */
|
||||
0, /* stencilSize */
|
||||
0, /* auxBuffers */
|
||||
0, /* level */
|
||||
GLX_NONE, /* visualRating */
|
||||
GLX_NONE, /* transparentPixel */
|
||||
0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
|
||||
0 /* transparentIndex */
|
||||
},
|
||||
/* [1] = RGB, double buffered, Z, stencil, accum */
|
||||
{
|
||||
-1, /* vid */
|
||||
-1, /* class */
|
||||
True, /* rgba */
|
||||
-1, -1, -1, 0, /* rgba sizes */
|
||||
-1, -1, -1, 0, /* rgba masks */
|
||||
16, 16, 16, 0, /* rgba accum sizes */
|
||||
True, /* doubleBuffer */
|
||||
False, /* stereo */
|
||||
-1, /* bufferSize */
|
||||
16, /* depthSize */
|
||||
8, /* stencilSize */
|
||||
0, /* auxBuffers */
|
||||
0, /* level */
|
||||
GLX_NONE, /* visualRating */
|
||||
GLX_NONE, /* transparentPixel */
|
||||
0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
|
||||
0 /* transparentIndex */
|
||||
},
|
||||
/* [2] = RGB+Alpha, double buffered, Z, stencil, accum */
|
||||
{
|
||||
-1, /* vid */
|
||||
-1, /* class */
|
||||
True, /* rgba */
|
||||
-1, -1, -1, 8, /* rgba sizes */
|
||||
-1, -1, -1, -1, /* rgba masks */
|
||||
16, 16, 16, 16, /* rgba accum sizes */
|
||||
True, /* doubleBuffer */
|
||||
False, /* stereo */
|
||||
-1, /* bufferSize */
|
||||
16, /* depthSize */
|
||||
8, /* stencilSize */
|
||||
0, /* auxBuffers */
|
||||
0, /* level */
|
||||
GLX_NONE, /* visualRating */
|
||||
GLX_NONE, /* transparentPixel */
|
||||
0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
|
||||
0 /* transparentIndex */
|
||||
},
|
||||
/* [3] = RGB+Alpha, single buffered, Z, stencil, accum */
|
||||
{
|
||||
-1, /* vid */
|
||||
-1, /* class */
|
||||
True, /* rgba */
|
||||
-1, -1, -1, 8, /* rgba sizes */
|
||||
-1, -1, -1, -1, /* rgba masks */
|
||||
16, 16, 16, 16, /* rgba accum sizes */
|
||||
False, /* doubleBuffer */
|
||||
False, /* stereo */
|
||||
-1, /* bufferSize */
|
||||
16, /* depthSize */
|
||||
8, /* stencilSize */
|
||||
0, /* auxBuffers */
|
||||
0, /* level */
|
||||
GLX_NONE, /* visualRating */
|
||||
GLX_NONE, /* transparentPixel */
|
||||
0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
|
||||
0 /* transparentIndex */
|
||||
},
|
||||
/* [4] = CI, double buffered, Z */
|
||||
{
|
||||
-1, /* vid */
|
||||
-1, /* class */
|
||||
False, /* rgba? (false = color index) */
|
||||
-1, -1, -1, 0, /* rgba sizes */
|
||||
-1, -1, -1, 0, /* rgba masks */
|
||||
0, 0, 0, 0, /* rgba accum sizes */
|
||||
True, /* doubleBuffer */
|
||||
False, /* stereo */
|
||||
-1, /* bufferSize */
|
||||
16, /* depthSize */
|
||||
0, /* stencilSize */
|
||||
0, /* auxBuffers */
|
||||
0, /* level */
|
||||
GLX_NONE, /* visualRating */
|
||||
GLX_NONE, /* transparentPixel */
|
||||
0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
|
||||
0 /* transparentIndex */
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
|
||||
VisualID *defaultVisp,
|
||||
int ndepth, DepthPtr pdepth,
|
||||
int rootDepth)
|
||||
{
|
||||
int numRGBconfigs;
|
||||
int numCIconfigs;
|
||||
int numVisuals = *nvisualp;
|
||||
int numNewVisuals;
|
||||
int numNewConfigs;
|
||||
VisualPtr pVisual = *visualp;
|
||||
VisualPtr pVisualNew = NULL;
|
||||
VisualID *orig_vid = NULL;
|
||||
__GLcontextModes *modes;
|
||||
__GLXvisualConfig *pNewVisualConfigs = NULL;
|
||||
void **glXVisualPriv;
|
||||
void **pNewVisualPriv;
|
||||
int found_default;
|
||||
int i, j, k;
|
||||
|
||||
if (numConfigs > 0)
|
||||
numNewConfigs = numConfigs;
|
||||
else
|
||||
numNewConfigs = NUM_FALLBACK_CONFIGS;
|
||||
|
||||
/* Alloc space for the list of new GLX visuals */
|
||||
pNewVisualConfigs = (__GLXvisualConfig *)
|
||||
__glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig));
|
||||
if (!pNewVisualConfigs) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Alloc space for the list of new GLX visual privates */
|
||||
pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *));
|
||||
if (!pNewVisualPriv) {
|
||||
__glXFree(pNewVisualConfigs);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
** If SetVisualConfigs was not called, then use default GLX
|
||||
** visual configs.
|
||||
*/
|
||||
if (numConfigs == 0) {
|
||||
memcpy(pNewVisualConfigs, FallbackConfigs,
|
||||
NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig));
|
||||
memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *));
|
||||
}
|
||||
else {
|
||||
/* copy driver's visual config info */
|
||||
for (i = 0; i < numConfigs; i++) {
|
||||
pNewVisualConfigs[i] = visualConfigs[i];
|
||||
pNewVisualPriv[i] = visualPrivates[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* Count the number of RGB and CI visual configs */
|
||||
numRGBconfigs = 0;
|
||||
numCIconfigs = 0;
|
||||
for (i = 0; i < numNewConfigs; i++) {
|
||||
if (pNewVisualConfigs[i].rgba)
|
||||
numRGBconfigs++;
|
||||
else
|
||||
numCIconfigs++;
|
||||
}
|
||||
|
||||
/* Count the total number of visuals to compute */
|
||||
numNewVisuals = 0;
|
||||
for (i = 0; i < numVisuals; i++) {
|
||||
numNewVisuals +=
|
||||
(pVisual[i].class == TrueColor || pVisual[i].class == DirectColor)
|
||||
? numRGBconfigs : numCIconfigs;
|
||||
}
|
||||
|
||||
/* Reset variables for use with the next screen/driver's visual configs */
|
||||
visualConfigs = NULL;
|
||||
numConfigs = 0;
|
||||
|
||||
/* Alloc temp space for the list of orig VisualIDs for each new visual */
|
||||
orig_vid = (VisualID *) __glXMalloc(numNewVisuals * sizeof(VisualID));
|
||||
if (!orig_vid) {
|
||||
__glXFree(pNewVisualPriv);
|
||||
__glXFree(pNewVisualConfigs);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Alloc space for the list of glXVisuals */
|
||||
modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes));
|
||||
if (modes == NULL) {
|
||||
__glXFree(orig_vid);
|
||||
__glXFree(pNewVisualPriv);
|
||||
__glXFree(pNewVisualConfigs);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Alloc space for the list of glXVisualPrivates */
|
||||
glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *));
|
||||
if (!glXVisualPriv) {
|
||||
_gl_context_modes_destroy( modes );
|
||||
__glXFree(orig_vid);
|
||||
__glXFree(pNewVisualPriv);
|
||||
__glXFree(pNewVisualConfigs);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Alloc space for the new list of the X server's visuals */
|
||||
pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec));
|
||||
if (!pVisualNew) {
|
||||
__glXFree(glXVisualPriv);
|
||||
_gl_context_modes_destroy( modes );
|
||||
__glXFree(orig_vid);
|
||||
__glXFree(pNewVisualPriv);
|
||||
__glXFree(pNewVisualConfigs);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Initialize the new visuals */
|
||||
found_default = FALSE;
|
||||
screenVisuals[screenInfo.numScreens-1].modes = modes;
|
||||
for (i = j = 0; i < numVisuals; i++) {
|
||||
int is_rgb = (pVisual[i].class == TrueColor ||
|
||||
pVisual[i].class == DirectColor);
|
||||
|
||||
for (k = 0; k < numNewConfigs; k++) {
|
||||
if (pNewVisualConfigs[k].rgba != is_rgb)
|
||||
continue;
|
||||
|
||||
assert( modes != NULL );
|
||||
|
||||
/* Initialize the new visual */
|
||||
pVisualNew[j] = pVisual[i];
|
||||
pVisualNew[j].vid = FakeClientID(0);
|
||||
|
||||
/* Check for the default visual */
|
||||
if (!found_default && pVisual[i].vid == *defaultVisp) {
|
||||
*defaultVisp = pVisualNew[j].vid;
|
||||
found_default = TRUE;
|
||||
}
|
||||
|
||||
/* Save the old VisualID */
|
||||
orig_vid[j] = pVisual[i].vid;
|
||||
|
||||
/* Initialize the glXVisual */
|
||||
_gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] );
|
||||
modes->visualID = pVisualNew[j].vid;
|
||||
if (modes->fbconfigID == GLX_DONT_CARE)
|
||||
modes->fbconfigID = modes->visualID;
|
||||
|
||||
/*
|
||||
* If the class is -1, then assume the X visual information
|
||||
* is identical to what GLX needs, and take them from the X
|
||||
* visual. NOTE: if class != -1, then all other fields MUST
|
||||
* be initialized.
|
||||
*/
|
||||
if (modes->visualType == GLX_NONE) {
|
||||
modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class );
|
||||
modes->redBits = count_bits(pVisual[i].redMask);
|
||||
modes->greenBits = count_bits(pVisual[i].greenMask);
|
||||
modes->blueBits = count_bits(pVisual[i].blueMask);
|
||||
modes->alphaBits = modes->alphaBits;
|
||||
modes->redMask = pVisual[i].redMask;
|
||||
modes->greenMask = pVisual[i].greenMask;
|
||||
modes->blueMask = pVisual[i].blueMask;
|
||||
modes->alphaMask = modes->alphaMask;
|
||||
modes->rgbBits = (is_rgb)
|
||||
? (modes->redBits + modes->greenBits +
|
||||
modes->blueBits + modes->alphaBits)
|
||||
: rootDepth;
|
||||
}
|
||||
|
||||
/* Save the device-dependent private for this visual */
|
||||
glXVisualPriv[j] = pNewVisualPriv[k];
|
||||
|
||||
j++;
|
||||
modes = modes->next;
|
||||
}
|
||||
}
|
||||
|
||||
assert(j <= numNewVisuals);
|
||||
|
||||
/* Save the GLX visuals in the screen structure */
|
||||
screenVisuals[screenInfo.numScreens-1].num_vis = numNewVisuals;
|
||||
screenVisuals[screenInfo.numScreens-1].private = glXVisualPriv;
|
||||
|
||||
/* Set up depth's VisualIDs */
|
||||
for (i = 0; i < ndepth; i++) {
|
||||
int numVids = 0;
|
||||
VisualID *pVids = NULL;
|
||||
int k, n = 0;
|
||||
|
||||
/* Count the new number of VisualIDs at this depth */
|
||||
for (j = 0; j < pdepth[i].numVids; j++)
|
||||
for (k = 0; k < numNewVisuals; k++)
|
||||
if (pdepth[i].vids[j] == orig_vid[k])
|
||||
numVids++;
|
||||
|
||||
/* Allocate a new list of VisualIDs for this depth */
|
||||
pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID));
|
||||
|
||||
/* Initialize the new list of VisualIDs for this depth */
|
||||
for (j = 0; j < pdepth[i].numVids; j++)
|
||||
for (k = 0; k < numNewVisuals; k++)
|
||||
if (pdepth[i].vids[j] == orig_vid[k])
|
||||
pVids[n++] = pVisualNew[k].vid;
|
||||
|
||||
/* Update this depth's list of VisualIDs */
|
||||
__glXFree(pdepth[i].vids);
|
||||
pdepth[i].vids = pVids;
|
||||
pdepth[i].numVids = numVids;
|
||||
}
|
||||
|
||||
/* Update the X server's visuals */
|
||||
*nvisualp = numNewVisuals;
|
||||
*visualp = pVisualNew;
|
||||
|
||||
/* Free the old list of the X server's visuals */
|
||||
__glXFree(pVisual);
|
||||
|
||||
/* Clean up temporary allocations */
|
||||
__glXFree(orig_vid);
|
||||
__glXFree(pNewVisualPriv);
|
||||
__glXFree(pNewVisualConfigs);
|
||||
|
||||
/* Free the private list created by DDX HW driver */
|
||||
if (visualPrivates)
|
||||
__glXFree(visualPrivates);
|
||||
visualPrivates = NULL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void GlxSetVisualConfigs(int nconfigs,
|
||||
__GLXvisualConfig *configs, void **privates)
|
||||
{
|
||||
numConfigs = nconfigs;
|
||||
visualConfigs = configs;
|
||||
visualPrivates = privates;
|
||||
}
|
||||
|
||||
static miInitVisualsProcPtr saveInitVisualsProc;
|
||||
|
||||
static Bool __glXInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
|
||||
int *nvisualp, int *ndepthp,
|
||||
int *rootDepthp, VisualID *defaultVisp,
|
||||
unsigned long sizes, int bitsPerRGB,
|
||||
int preferredVis)
|
||||
{
|
||||
Bool ret;
|
||||
|
||||
if (saveInitVisualsProc) {
|
||||
ret = saveInitVisualsProc(visualp, depthp, nvisualp, ndepthp,
|
||||
rootDepthp, defaultVisp, sizes, bitsPerRGB,
|
||||
preferredVis);
|
||||
if (!ret)
|
||||
return False;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the visuals supported by this particular screen.
|
||||
*/
|
||||
init_visuals(nvisualp, visualp, defaultVisp,
|
||||
*ndepthp, *depthp, *rootDepthp);
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
void
|
||||
GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc)
|
||||
{
|
||||
saveInitVisualsProc = *initVisProc;
|
||||
*initVisProc = __glXInitVisuals;
|
||||
}
|
||||
|
||||
static void fixup_visuals(int screen)
|
||||
{
|
||||
ScreenPtr pScreen = screenInfo.screens[screen];
|
||||
ScreenVisuals *psv = &screenVisuals[screen];
|
||||
int j;
|
||||
__GLcontextModes *modes;
|
||||
|
||||
for ( modes = psv->modes ; modes != NULL ; modes = modes->next ) {
|
||||
const int vis_class = _gl_convert_to_x_visual_type( modes->visualType );
|
||||
const int nplanes = (modes->rgbBits - modes->alphaBits);
|
||||
const VisualPtr pVis = pScreen->visuals;
|
||||
|
||||
/* Find a visual that matches the GLX visual's class and size */
|
||||
for (j = 0; j < pScreen->numVisuals; j++) {
|
||||
if (pVis[j].class == vis_class &&
|
||||
pVis[j].nplanes == nplanes) {
|
||||
|
||||
/* Fixup the masks */
|
||||
modes->redMask = pVis[j].redMask;
|
||||
modes->greenMask = pVis[j].greenMask;
|
||||
modes->blueMask = pVis[j].blueMask;
|
||||
|
||||
/* Recalc the sizes */
|
||||
modes->redBits = count_bits(modes->redMask);
|
||||
modes->greenBits = count_bits(modes->greenMask);
|
||||
modes->blueBits = count_bits(modes->blueMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void __glXScreenInitVisuals(__GLXscreen *screen)
|
||||
{
|
||||
int index = screen->pScreen->myNum;
|
||||
|
||||
screen->modes = screenVisuals[index].modes;
|
||||
screen->pVisualPriv = screenVisuals[index].private;
|
||||
screen->numVisuals = screenVisuals[index].num_vis;
|
||||
screen->numUsableVisuals = screenVisuals[index].num_vis;
|
||||
|
||||
/*
|
||||
* The ordering of the rgb compenents might have been changed by the
|
||||
* driver after mi initialized them.
|
||||
*/
|
||||
fixup_visuals(index);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -43,60 +43,4 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <GL/gl.h>
|
||||
#include <GL/xmesa.h>
|
||||
|
||||
typedef struct __MESA_screenRec __MESA_screen;
|
||||
struct __MESA_screenRec {
|
||||
int num_vis;
|
||||
__GLcontextModes *modes;
|
||||
XMesaVisual *xm_vis;
|
||||
void **private;
|
||||
};
|
||||
|
||||
typedef struct __MESA_bufferRec *__MESA_buffer;
|
||||
struct __MESA_bufferRec {
|
||||
XMesaBuffer xm_buf;
|
||||
GLboolean (*fbresize)(__GLdrawableBuffer *buf,
|
||||
GLint x, GLint y, GLuint width, GLuint height,
|
||||
__GLdrawablePrivate *glPriv, GLuint bufferMask);
|
||||
GLboolean (*fbswap)(__GLXdrawablePrivate *glxPriv);
|
||||
};
|
||||
|
||||
extern void __MESA_setVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
|
||||
void **privates);
|
||||
extern Bool __MESA_initVisuals(VisualPtr *visualp, DepthPtr *depthp,
|
||||
int *nvisualp, int *ndepthp, int *rootDepthp,
|
||||
VisualID *defaultVisp, unsigned long sizes,
|
||||
int bitsPerRGB);
|
||||
extern Bool __MESA_screenProbe(int screen);
|
||||
|
||||
extern void __MESA_resetExtension(void);
|
||||
|
||||
extern void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv);
|
||||
extern GLboolean __MESA_resizeBuffers(__GLdrawableBuffer *buf,
|
||||
GLint x, GLint y,
|
||||
GLuint width, GLuint height,
|
||||
__GLdrawablePrivate *glPriv,
|
||||
GLuint bufferMask);
|
||||
extern GLboolean __MESA_swapBuffers(__GLXdrawablePrivate *glxPriv);
|
||||
extern void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv);
|
||||
|
||||
extern __GLinterface *__MESA_createContext(__GLimports *imports,
|
||||
__GLcontextModes *modes,
|
||||
__GLinterface *shareGC);
|
||||
extern GLboolean __MESA_destroyContext(__GLcontext *gc);
|
||||
extern GLboolean __MESA_loseCurrent(__GLcontext *gc);
|
||||
extern GLboolean __MESA_makeCurrent(__GLcontext *gc);
|
||||
extern GLboolean __MESA_shareContext(__GLcontext *gc, __GLcontext *gcShare);
|
||||
extern GLboolean __MESA_copyContext(__GLcontext *dst, const __GLcontext *src,
|
||||
GLuint mask);
|
||||
extern GLboolean __MESA_forceCurrent(__GLcontext *gc);
|
||||
|
||||
extern GLboolean __MESA_notifyResize(__GLcontext *gc);
|
||||
extern void __MESA_notifyDestroy(__GLcontext *gc);
|
||||
extern void __MESA_notifySwapBuffers(__GLcontext *gc);
|
||||
extern struct __GLdispatchStateRec *__MESA_dispatchExec(__GLcontext *gc);
|
||||
extern void __MESA_beginDispatchOverride(__GLcontext *gc);
|
||||
extern void __MESA_endDispatchOverride(__GLcontext *gc);
|
||||
|
||||
extern GLuint __glFloorLog2(GLuint val);
|
||||
|
||||
#endif /* _XF86GLXINT_H_ */
|
||||
|
|
|
@ -10,6 +10,7 @@ INCLUDES = -I@MESA_SOURCE@/include \
|
|||
-I../math \
|
||||
-I../shader \
|
||||
-I../shader/slang \
|
||||
-I../shader/slang \
|
||||
-I../swrast \
|
||||
-I../swrast_setup \
|
||||
-I../tnl \
|
||||
|
|
|
@ -63,6 +63,7 @@ symlink_mesa_glapi() {
|
|||
dst_dir mesa/glapi
|
||||
|
||||
action dispatch.h
|
||||
action glapi.c
|
||||
action glapi.h
|
||||
action glapioffsets.h
|
||||
action glapitable.h
|
||||
|
|
12
configure.ac
12
configure.ac
|
@ -362,6 +362,9 @@ AC_ARG_WITH(xkb-output, AS_HELP_STRING([--with-xkb-output=PATH], [Path to
|
|||
AC_ARG_WITH(rgb-path, AS_HELP_STRING([--with-rgb-path=PATH], [Path to RGB database (default: ${datadir}/X11/rgb)]),
|
||||
[ RGBPATH="$withval" ],
|
||||
[ RGBPATH="${datadir}/X11/rgb" ])
|
||||
AC_ARG_WITH(dri-driver-path, AS_HELP_STRING([--with-dri-driver-path=PATH], [Path to DRI drivers (default: ${libdir}/dri)]),
|
||||
[ DRI_DRIVER_PATH="$withval" ],
|
||||
[ DRI_DRIVER_PATH="${libdir}/dri" ])
|
||||
AC_ARG_ENABLE(builddocs, AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]),
|
||||
[BUILDDOCS=$enableval],
|
||||
[BUILDDOCS=no])
|
||||
|
@ -384,6 +387,7 @@ AC_ARG_ENABLE(screensaver, AS_HELP_STRING([--disable-screensaver], [Build Scr
|
|||
AC_ARG_ENABLE(xdmcp, AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto])
|
||||
AC_ARG_ENABLE(xdm-auth-1, AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
|
||||
AC_ARG_ENABLE(glx, AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes])
|
||||
AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]), [AIGLX=$enableval], [AIGLX=yes])
|
||||
AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
|
||||
AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
|
||||
AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: enabled)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=yes])
|
||||
|
@ -559,6 +563,13 @@ fi
|
|||
AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
|
||||
AC_SUBST([MESA_SOURCE])
|
||||
|
||||
if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a "x$DRI" = xyes; then
|
||||
AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
|
||||
else
|
||||
AIGLX=no
|
||||
fi
|
||||
AM_CONDITIONAL(AIGLX, test "x$AIGLX" = xyes)
|
||||
|
||||
PKG_CHECK_MODULES([LBXUTIL_TEST], [lbxutil], [have_lbxutil=yes], [have_lbxutil=no])
|
||||
|
||||
if test "x$LBX" = xauto; then
|
||||
|
@ -768,6 +779,7 @@ VENDOR_MAN_VERSION="Version ${VENDOR_VERSION_STRING}"
|
|||
|
||||
AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
|
||||
AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path])
|
||||
AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
|
||||
AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_STRING"], [Vendor name])
|
||||
AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_STRING_SHORT"], [Short vendor name])
|
||||
AC_DEFINE_UNQUOTED(XORG_RELEASE, ["$VENDOR_RELEASE_STRING"], [Vendor release])
|
||||
|
|
|
@ -36,6 +36,13 @@
|
|||
#include "micmap.h"
|
||||
#include "glxswap.h"
|
||||
|
||||
/*
|
||||
** Stubs to satisfy miinitext.c references.
|
||||
*/
|
||||
typedef int __GLXprovider;
|
||||
__GLXprovider __glXMesaProvider;
|
||||
void GlxPushProvider(__GLXprovider *provider) { }
|
||||
|
||||
/*
|
||||
** Forward declarations.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $XdotOrg: xserver/xorg/hw/xfree86/common/xf86Config.c,v 1.21 2005/12/20 21:34:21 ajax Exp $ */
|
||||
/* $XdotOrg: xserver/xorg/hw/xfree86/common/xf86Config.c,v 1.22.8.2 2006/02/28 23:55:03 krh Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.276 2003/10/08 14:58:26 dawes Exp $ */
|
||||
|
||||
|
||||
|
@ -756,7 +756,8 @@ typedef enum {
|
|||
FLAG_LOG,
|
||||
FLAG_RENDER_COLORMAP_MODE,
|
||||
FLAG_HANDLE_SPECIAL_KEYS,
|
||||
FLAG_RANDR
|
||||
FLAG_RANDR,
|
||||
FLAG_AIGLX
|
||||
} FlagValues;
|
||||
|
||||
static OptionInfoRec FlagOptions[] = {
|
||||
|
@ -826,6 +827,8 @@ static OptionInfoRec FlagOptions[] = {
|
|||
{0}, FALSE },
|
||||
{ FLAG_RANDR, "RandR", OPTV_BOOLEAN,
|
||||
{0}, FALSE },
|
||||
{ FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
|
||||
{0}, FALSE },
|
||||
{ -1, NULL, OPTV_NONE,
|
||||
{0}, FALSE },
|
||||
};
|
||||
|
@ -1010,6 +1013,13 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
|
|||
else
|
||||
xf86Info.estimateSizesAggressively = 0;
|
||||
|
||||
xf86Info.aiglx = TRUE;
|
||||
xf86Info.aiglxFrom = X_DEFAULT;
|
||||
if (xf86GetOptValBool(FlagOptions, FLAG_AIGLX, &value)) {
|
||||
xf86Info.aiglx = value;
|
||||
xf86Info.aiglxFrom = X_CONFIG;
|
||||
}
|
||||
|
||||
/* Make sure that timers don't overflow CARD32's after multiplying */
|
||||
#define MAX_TIME_IN_MIN (0x7fffffff / MILLI_PER_MIN)
|
||||
|
||||
|
|
|
@ -196,11 +196,15 @@ extern ExtensionModule *ExtensionModuleList;
|
|||
pointer LoadSubModule(pointer, const char *, const char **,
|
||||
const char **, pointer, const XF86ModReqInfo *,
|
||||
int *, int *);
|
||||
pointer LoadSubModuleLocal(pointer, const char *, const char **,
|
||||
const char **, pointer, const XF86ModReqInfo *,
|
||||
int *, int *);
|
||||
void UnloadSubModule(pointer);
|
||||
void LoadFont(pointer);
|
||||
void UnloadModule (pointer);
|
||||
#endif
|
||||
pointer LoaderSymbol(const char *);
|
||||
pointer LoaderSymbolLocal(pointer module, const char *);
|
||||
char **LoaderListDirs(const char **, const char **);
|
||||
void LoaderFreeDirList(char **);
|
||||
void LoaderErrorMsg(const char *, const char *, int, int);
|
||||
|
|
|
@ -165,6 +165,8 @@ typedef struct {
|
|||
Bool kbdCustomKeycodes;
|
||||
Bool disableRandR;
|
||||
MessageType randRFrom;
|
||||
Bool aiglx;
|
||||
MessageType aiglxFrom;
|
||||
struct {
|
||||
Bool disabled; /* enable/disable deactivating
|
||||
* grabs or closing the
|
||||
|
|
|
@ -36,7 +36,8 @@ INCLUDES = @XORG_INCS@ \
|
|||
-I$(top_srcdir)/mfb \
|
||||
-I$(top_srcdir)/dbe \
|
||||
-I$(top_srcdir)/hw/xfree86/loader \
|
||||
-I$(top_srcdir)/miext/shadow
|
||||
-I$(top_srcdir)/miext/shadow \
|
||||
-I$(top_srcdir)/GL/glx
|
||||
|
||||
libGLcore_la_LDFLAGS = -avoid-version
|
||||
libGLcore_la_LIBADD = $(top_builddir)/GL/mesa/libGLcore.la
|
||||
|
@ -72,7 +73,9 @@ libfb_la_LIBADD = $(top_builddir)/fb/libfb.la
|
|||
libfb_la_SOURCES = $(top_builddir)/fb/fbcmap.c fbmodule.c
|
||||
|
||||
libglx_la_LDFLAGS = -avoid-version
|
||||
libglx_la_LIBADD = $(top_builddir)/GL/glx/libglx.la
|
||||
libglx_la_LIBADD = \
|
||||
$(top_builddir)/GL/glx/libglx.la \
|
||||
$(top_builddir)/GL/glx/libglxdri.la
|
||||
libglx_la_SOURCES = glxmodule.c
|
||||
|
||||
libmfb_la_LDFLAGS = -avoid-version
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -779,7 +779,7 @@ static Bool
|
|||
DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv)
|
||||
{
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
__GLXscreenInfo *pGLXScreen = __glXgetActiveScreen(pScreen->myNum);
|
||||
__GLXscreen *pGLXScreen = __glXgetActiveScreen(pScreen->myNum);
|
||||
__GLcontextModes *modes = pGLXScreen->modes;
|
||||
void **pVisualConfigPriv = pGLXScreen->pVisualPriv;
|
||||
DRIContextPrivPtr pDRIContextPriv;
|
||||
|
@ -843,7 +843,7 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual,
|
|||
XID context, drm_context_t * pHWContext)
|
||||
{
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
__GLXscreenInfo *pGLXScreen = __glXgetActiveScreen(pScreen->myNum);
|
||||
__GLXscreen *pGLXScreen = __glXgetActiveScreen(pScreen->myNum);
|
||||
__GLcontextModes *modes = pGLXScreen->modes;
|
||||
void **pVisualConfigPriv = pGLXScreen->pVisualPriv;
|
||||
DRIContextPrivPtr pDRIContextPriv;
|
||||
|
|
|
@ -630,7 +630,7 @@ AOUT_GetSymbols(AOUTModulePtr aoutfile)
|
|||
* Public API for the a.out implementation of the loader
|
||||
*/
|
||||
void *
|
||||
AOUTLoadModule(loaderPtr modrec, int aoutfd, LOOKUP ** ppLookup)
|
||||
AOUTLoadModule(loaderPtr modrec, int aoutfd, LOOKUP ** ppLookup, int flags)
|
||||
{
|
||||
AOUTModulePtr aoutfile = NULL;
|
||||
AOUTHDR *header;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#ifndef _AOUTLOADER_H
|
||||
#define _AOUTLOADER_H
|
||||
extern void *AOUTLoadModule(loaderPtr, int, LOOKUP **);
|
||||
extern void *AOUTLoadModule(loaderPtr, int, LOOKUP **, int flags);
|
||||
extern void AOUTResolveSymbols(void *);
|
||||
extern int AOUTCheckForUnresolved(void *);
|
||||
extern char *AOUTAddressToSection(void *, unsigned long);
|
||||
|
|
|
@ -1149,7 +1149,7 @@ COFFCollectSections(COFFModulePtr cofffile)
|
|||
* Public API for the COFF implementation of the loader.
|
||||
*/
|
||||
void *
|
||||
COFFLoadModule(loaderPtr modrec, int cofffd, LOOKUP **ppLookup)
|
||||
COFFLoadModule(loaderPtr modrec, int cofffd, LOOKUP **ppLookup, int flags)
|
||||
{
|
||||
COFFModulePtr cofffile;
|
||||
FILHDR *header;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#ifndef _COFFLOADER_H
|
||||
#define _COFFLOADER_H
|
||||
/* coffloader.c */
|
||||
extern void *COFFLoadModule(loaderPtr, int, LOOKUP **);
|
||||
extern void *COFFLoadModule(loaderPtr, int, LOOKUP **, int flags);
|
||||
extern void COFFResolveSymbols(void *);
|
||||
extern int COFFCheckForUnresolved(void *);
|
||||
extern char *COFFAddressToSection(void *, unsigned long);
|
||||
|
|
|
@ -63,8 +63,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#define DLOPEN_FLAGS ( DLOPEN_LAZY | DLOPEN_GLOBAL )
|
||||
|
||||
#if defined(CSRG_BASED) && !defined(__ELF__)
|
||||
#define NEED_UNDERSCORE_FOR_DLLSYM
|
||||
#endif
|
||||
|
@ -76,6 +74,7 @@
|
|||
typedef struct {
|
||||
int handle;
|
||||
void *dlhandle;
|
||||
int flags;
|
||||
} DLModuleRec, *DLModulePtr;
|
||||
|
||||
/*
|
||||
|
@ -88,6 +87,28 @@ typedef struct DLModuleList {
|
|||
|
||||
DLModuleList *dlModuleList = NULL;
|
||||
|
||||
void *
|
||||
DLFindSymbolLocal(pointer module, const char *name)
|
||||
{
|
||||
DLModulePtr dlfile = module;
|
||||
void *p;
|
||||
char *n;
|
||||
|
||||
#ifdef NEED_UNDERSCORE_FOR_DLLSYM
|
||||
static const char symPrefix[] = "_";
|
||||
#else
|
||||
static const char symPrefix[] = "";
|
||||
#endif
|
||||
|
||||
n = xf86loadermalloc(strlen(symPrefix) + strlen(name) + 1);
|
||||
sprintf(n, "%s%s", symPrefix, name);
|
||||
p = dlsym(dlfile->dlhandle, n);
|
||||
xf86loaderfree(n);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Search a symbol in the module list
|
||||
*/
|
||||
|
@ -97,30 +118,11 @@ DLFindSymbol(const char *name)
|
|||
DLModuleList *l;
|
||||
void *p;
|
||||
|
||||
#ifdef NEED_UNDERSCORE_FOR_DLLSYM
|
||||
char *n;
|
||||
|
||||
n = xf86loadermalloc(strlen(name) + 2);
|
||||
sprintf(n, "_%s", name);
|
||||
#endif
|
||||
|
||||
(void)dlerror(); /* Clear out any previous error */
|
||||
for (l = dlModuleList; l != NULL; l = l->next) {
|
||||
#ifdef NEED_UNDERSCORE_FOR_DLLSYM
|
||||
p = dlsym(l->module->dlhandle, n);
|
||||
#else
|
||||
p = dlsym(l->module->dlhandle, name);
|
||||
#endif
|
||||
if (dlerror() == NULL) {
|
||||
#ifdef NEED_UNDERSCORE_FOR_DLLSYM
|
||||
xf86loaderfree(n);
|
||||
#endif
|
||||
p = DLFindSymbolLocal(l->module, name);
|
||||
if (p)
|
||||
return p;
|
||||
}
|
||||
}
|
||||
#ifdef NEED_UNDERSCORE_FOR_DLLSYM
|
||||
xf86loaderfree(n);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -129,23 +131,28 @@ DLFindSymbol(const char *name)
|
|||
* public interface
|
||||
*/
|
||||
void *
|
||||
DLLoadModule(loaderPtr modrec, int fd, LOOKUP ** ppLookup)
|
||||
DLLoadModule(loaderPtr modrec, int fd, LOOKUP ** ppLookup, int flags)
|
||||
{
|
||||
DLModulePtr dlfile;
|
||||
DLModuleList *l;
|
||||
int dlopen_flags;
|
||||
|
||||
if ((dlfile = xf86loadercalloc(1, sizeof(DLModuleRec))) == NULL) {
|
||||
ErrorF("Unable to allocate DLModuleRec\n");
|
||||
return NULL;
|
||||
}
|
||||
dlfile->handle = modrec->handle;
|
||||
dlfile->dlhandle = dlopen(modrec->name, DLOPEN_FLAGS);
|
||||
if (flags & LD_FLAG_GLOBAL)
|
||||
dlopen_flags = DLOPEN_LAZY | DLOPEN_GLOBAL;
|
||||
else
|
||||
dlopen_flags = DLOPEN_LAZY;
|
||||
dlfile->dlhandle = dlopen(modrec->name, dlopen_flags);
|
||||
if (dlfile->dlhandle == NULL) {
|
||||
ErrorF("dlopen: %s\n", dlerror());
|
||||
xf86loaderfree(dlfile);
|
||||
return NULL;
|
||||
}
|
||||
/* Add it to the module list */
|
||||
|
||||
l = xf86loadermalloc(sizeof(DLModuleList));
|
||||
l->module = dlfile;
|
||||
l->next = dlModuleList;
|
||||
|
|
|
@ -27,10 +27,11 @@
|
|||
|
||||
#ifndef _DLLOADER_H
|
||||
#define _DLLOADER_H
|
||||
extern void *DLLoadModule(loaderPtr, int, LOOKUP **);
|
||||
extern void *DLLoadModule(loaderPtr, int, LOOKUP **, int flags);
|
||||
extern void DLResolveSymbols(void *);
|
||||
extern int DLCheckForUnresolved(void *);
|
||||
extern void DLUnloadModule(void *);
|
||||
extern void *DLFindSymbol(const char *name);
|
||||
extern void *DLFindSymbolLocal(pointer module, const char *name);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.7 2005/04/23 19:01:13 ajax Exp $ */
|
||||
/* $XdotOrg: xserver/xorg/hw/xfree86/loader/elfloader.c,v 1.10.12.1 2006/02/24 05:49:34 krh Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.61tsi Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -2884,7 +2884,7 @@ ELFCollectSections(ELFModulePtr elffile, int pass, int *totalsize,
|
|||
* Public API for the ELF implementation of the loader.
|
||||
*/
|
||||
void *
|
||||
ELFLoadModule(loaderPtr modrec, int elffd, LOOKUP **ppLookup)
|
||||
ELFLoadModule(loaderPtr modrec, int elffd, LOOKUP **ppLookup, int flags)
|
||||
{
|
||||
ELFModulePtr elffile;
|
||||
Elf_Ehdr *header;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#ifndef _ELFLOADER_H
|
||||
#define _ELFLOADER_H
|
||||
/* elfloader.c */
|
||||
extern void *ELFLoadModule(loaderPtr, int, LOOKUP **);
|
||||
extern void *ELFLoadModule(loaderPtr, int, LOOKUP **, int flags);
|
||||
extern void ELFResolveSymbols(void *);
|
||||
extern int ELFCheckForUnresolved(void *);
|
||||
extern char *ELFAddressToSection(void *, unsigned long);
|
||||
|
|
|
@ -973,7 +973,7 @@ _LoaderHandleUnresolved(char *symbol, char *module)
|
|||
* Handle an archive.
|
||||
*/
|
||||
void *
|
||||
ARCHIVELoadModule(loaderPtr modrec, int arfd, LOOKUP ** ppLookup)
|
||||
ARCHIVELoadModule(loaderPtr modrec, int arfd, LOOKUP ** ppLookup, int flags)
|
||||
{
|
||||
loaderPtr tmp = NULL;
|
||||
void *ret = NULL;
|
||||
|
@ -1171,7 +1171,7 @@ ARCHIVELoadModule(loaderPtr modrec, int arfd, LOOKUP ** ppLookup)
|
|||
}
|
||||
offsetbias = offset;
|
||||
|
||||
if ((tmp->private = funcs[modtype].LoadModule(tmp, arfd, &lookup_ret))
|
||||
if ((tmp->private = funcs[modtype].LoadModule(tmp, arfd, &lookup_ret, LD_FLAG_GLOBAL))
|
||||
== NULL) {
|
||||
ErrorF("Failed to load %s\n", hdr.ar_name);
|
||||
offsetbias = 0;
|
||||
|
@ -1233,13 +1233,14 @@ _LoaderGetRelocations(void *mod)
|
|||
return &(formatrec->pRelocs);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Public Interface to the loader.
|
||||
*/
|
||||
|
||||
int
|
||||
LoaderOpen(const char *module, const char *cname, int handle,
|
||||
int *errmaj, int *errmin, int *wasLoaded)
|
||||
int *errmaj, int *errmin, int *wasLoaded, int flags)
|
||||
{
|
||||
loaderPtr tmp;
|
||||
int new_handle, modtype;
|
||||
|
@ -1329,7 +1330,7 @@ LoaderOpen(const char *module, const char *cname, int handle,
|
|||
tmp->module = moduleseq++;
|
||||
tmp->funcs = &funcs[modtype];
|
||||
|
||||
if ((tmp->private = funcs[modtype].LoadModule(tmp, fd, &pLookup)) == NULL) {
|
||||
if ((tmp->private = funcs[modtype].LoadModule(tmp, fd, &pLookup, flags)) == NULL) {
|
||||
xf86Msg(X_ERROR, "Failed to load %s\n", module);
|
||||
_LoaderListPop(new_handle);
|
||||
freeHandles[new_handle] = HANDLE_FREE;
|
||||
|
|
|
@ -80,6 +80,11 @@
|
|||
#define LD_PROCESSED_ARCHIVE -1
|
||||
/* #define UNINIT_SECTION */
|
||||
#define HANDLE_IN_HASH_ENTRY
|
||||
|
||||
/* LoadModule proc flags; LD_FLAG_GLOBAL adds symbols to global
|
||||
* namespace, default is to keep symbols local to module. */
|
||||
#define LD_FLAG_GLOBAL 1
|
||||
|
||||
/*
|
||||
* COFF Section nmumbers
|
||||
*/
|
||||
|
@ -193,7 +198,7 @@ typedef struct _loader *loaderPtr;
|
|||
* _loader_funcs hold the entry points for a module format.
|
||||
*/
|
||||
|
||||
typedef void *(*LoadModuleProcPtr) (loaderPtr modrec, int fd, LOOKUP **);
|
||||
typedef void *(*LoadModuleProcPtr) (loaderPtr modrec, int fd, LOOKUP **, int flags);
|
||||
typedef void (*ResolveSymbolsProcPtr) (void *);
|
||||
typedef int (*CheckForUnresolvedProcPtr) (void *);
|
||||
typedef char *(*AddressToSectionProcPtr) (void *, unsigned long);
|
||||
|
@ -256,7 +261,7 @@ void LoaderDumpSymbols(void);
|
|||
char *_LoaderModuleToName(int);
|
||||
int _LoaderAddressToSection(const unsigned long, const char **,
|
||||
const char **);
|
||||
int LoaderOpen(const char *, const char *, int, int *, int *, int *);
|
||||
int LoaderOpen(const char *, const char *, int, int *, int *, int *, int);
|
||||
int LoaderHandleOpen(int);
|
||||
|
||||
/*
|
||||
|
@ -285,7 +290,7 @@ char *_LoaderHandleToCanonicalName(int handle);
|
|||
#include "elfloader.h"
|
||||
#include "dlloader.h"
|
||||
/* LD_ARCHIVE */
|
||||
void *ARCHIVELoadModule(loaderPtr, int, LOOKUP **);
|
||||
void *ARCHIVELoadModule(loaderPtr, int, LOOKUP **, int flags);
|
||||
|
||||
extern void _loader_debug_state(void);
|
||||
|
||||
|
|
|
@ -92,6 +92,10 @@ ModuleDescPtr LoadModule(const char *, const char *, const char **,
|
|||
ModuleDescPtr LoadSubModule(ModuleDescPtr, const char *,
|
||||
const char **, const char **, pointer,
|
||||
const XF86ModReqInfo *, int *, int *);
|
||||
ModuleDescPtr LoadSubModuleLocal(ModuleDescPtr, const char *,
|
||||
const char **, const char **,
|
||||
pointer, const XF86ModReqInfo *,
|
||||
int *, int *);
|
||||
ModuleDescPtr DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent);
|
||||
void LoadFont(FontModule *);
|
||||
void UnloadModule(ModuleDescPtr);
|
||||
|
|
|
@ -88,6 +88,10 @@ static Bool CheckVersion(const char *, XF86ModuleVersionInfo *,
|
|||
static void UnloadModuleOrDriver(ModuleDescPtr mod);
|
||||
static char *LoaderGetCanonicalName(const char *, PatternPtr);
|
||||
static void RemoveChild(ModuleDescPtr);
|
||||
static ModuleDescPtr doLoadModule(const char *, const char *, const char **,
|
||||
const char **, pointer,
|
||||
const XF86ModReqInfo *, int *, int *,
|
||||
int flags);
|
||||
|
||||
ModuleVersions LoaderVersionInfo = {
|
||||
XORG_VERSION_CURRENT,
|
||||
|
@ -782,8 +786,44 @@ LoadSubModule(ModuleDescPtr parent, const char *module,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
submod = LoadModule(module, NULL, subdirlist, patternlist, options,
|
||||
modreq, errmaj, errmin);
|
||||
submod = doLoadModule(module, NULL, subdirlist, patternlist, options,
|
||||
modreq, errmaj, errmin, LD_FLAG_GLOBAL);
|
||||
if (submod) {
|
||||
parent->child = AddSibling(parent->child, submod);
|
||||
submod->parent = parent;
|
||||
}
|
||||
return submod;
|
||||
}
|
||||
|
||||
ModuleDescPtr
|
||||
LoadSubModuleLocal(ModuleDescPtr parent, const char *module,
|
||||
const char **subdirlist, const char **patternlist,
|
||||
pointer options, const XF86ModReqInfo * modreq,
|
||||
int *errmaj, int *errmin)
|
||||
{
|
||||
ModuleDescPtr submod;
|
||||
|
||||
xf86MsgVerb(X_INFO, 3, "Loading local sub module \"%s\"\n", module);
|
||||
|
||||
/* Absolute module paths are not allowed here */
|
||||
#ifndef __UNIXOS2__
|
||||
if (module[0] == '/')
|
||||
#else
|
||||
if (isalpha(module[0]) && module[1] == ':' && module[2] == '/')
|
||||
#endif
|
||||
{
|
||||
xf86Msg(X_ERROR,
|
||||
"LoadSubModule: Absolute module path not permitted: \"%s\"\n",
|
||||
module);
|
||||
if (errmaj)
|
||||
*errmaj = LDR_BADUSAGE;
|
||||
if (errmin)
|
||||
*errmin = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
submod = doLoadModule(module, NULL, subdirlist, patternlist, options,
|
||||
modreq, errmaj, errmin, 0);
|
||||
if (submod) {
|
||||
parent->child = AddSibling(parent->child, submod);
|
||||
submod->parent = parent;
|
||||
|
@ -823,48 +863,12 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* LoadModule: load a module
|
||||
*
|
||||
* module The module name. Normally this is not a filename but the
|
||||
* module's "canonical name. A full pathname is, however,
|
||||
* also accepted.
|
||||
* path A comma separated list of module directories.
|
||||
* subdirlist A NULL terminated list of subdirectories to search. When
|
||||
* NULL, the default "stdSubdirs" list is used. The default
|
||||
* list is also substituted for entries with value DEFAULT_LIST.
|
||||
* patternlist A NULL terminated list of regular expressions used to find
|
||||
* module filenames. Each regex should contain exactly one
|
||||
* subexpression that corresponds to the canonical module name.
|
||||
* When NULL, the default "stdPatterns" list is used. The
|
||||
* default list is also substituted for entries with value
|
||||
* DEFAULT_LIST.
|
||||
* options A NULL terminated list of Options that are passed to the
|
||||
* module's SetupProc function.
|
||||
* modreq An optional XF86ModReqInfo* containing
|
||||
* version/ABI/vendor-ABI requirements to check for when
|
||||
* loading the module. The following fields of the
|
||||
* XF86ModReqInfo struct are checked:
|
||||
* majorversion - must match the module's majorversion exactly
|
||||
* minorversion - the module's minorversion must be >= this
|
||||
* patchlevel - the module's minorversion.patchlevel must be
|
||||
* >= this. Patchlevel is ignored when
|
||||
* minorversion is not set.
|
||||
* abiclass - (string) must match the module's abiclass
|
||||
* abiversion - must be consistent with the module's
|
||||
* abiversion (major equal, minor no older)
|
||||
* moduleclass - string must match the module's moduleclass
|
||||
* string
|
||||
* "don't care" values are ~0 for numbers, and NULL for strings
|
||||
* errmaj Major error return.
|
||||
* errmin Minor error return.
|
||||
*
|
||||
*/
|
||||
|
||||
ModuleDescPtr
|
||||
LoadModule(const char *module, const char *path, const char **subdirlist,
|
||||
const char **patternlist, pointer options,
|
||||
const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
|
||||
static ModuleDescPtr
|
||||
doLoadModule(const char *module, const char *path, const char **subdirlist,
|
||||
const char **patternlist, pointer options,
|
||||
const XF86ModReqInfo * modreq,
|
||||
int *errmaj, int *errmin, int flags)
|
||||
{
|
||||
XF86ModuleData *initdata = NULL;
|
||||
char **pathlist = NULL;
|
||||
|
@ -957,7 +961,8 @@ LoadModule(const char *module, const char *path, const char **subdirlist,
|
|||
*errmin = 0;
|
||||
goto LoadModule_fail;
|
||||
}
|
||||
ret->handle = LoaderOpen(found, name, 0, errmaj, errmin, &wasLoaded);
|
||||
ret->handle = LoaderOpen(found, name, 0,
|
||||
errmaj, errmin, &wasLoaded, flags);
|
||||
if (ret->handle < 0)
|
||||
goto LoadModule_fail;
|
||||
|
||||
|
@ -1066,6 +1071,52 @@ LoadModule(const char *module, const char *path, const char **subdirlist,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* LoadModule: load a module
|
||||
*
|
||||
* module The module name. Normally this is not a filename but the
|
||||
* module's "canonical name. A full pathname is, however,
|
||||
* also accepted.
|
||||
* path A comma separated list of module directories.
|
||||
* subdirlist A NULL terminated list of subdirectories to search. When
|
||||
* NULL, the default "stdSubdirs" list is used. The default
|
||||
* list is also substituted for entries with value DEFAULT_LIST.
|
||||
* patternlist A NULL terminated list of regular expressions used to find
|
||||
* module filenames. Each regex should contain exactly one
|
||||
* subexpression that corresponds to the canonical module name.
|
||||
* When NULL, the default "stdPatterns" list is used. The
|
||||
* default list is also substituted for entries with value
|
||||
* DEFAULT_LIST.
|
||||
* options A NULL terminated list of Options that are passed to the
|
||||
* module's SetupProc function.
|
||||
* modreq An optional XF86ModReqInfo* containing
|
||||
* version/ABI/vendor-ABI requirements to check for when
|
||||
* loading the module. The following fields of the
|
||||
* XF86ModReqInfo struct are checked:
|
||||
* majorversion - must match the module's majorversion exactly
|
||||
* minorversion - the module's minorversion must be >= this
|
||||
* patchlevel - the module's minorversion.patchlevel must be
|
||||
* >= this. Patchlevel is ignored when
|
||||
* minorversion is not set.
|
||||
* abiclass - (string) must match the module's abiclass
|
||||
* abiversion - must be consistent with the module's
|
||||
* abiversion (major equal, minor no older)
|
||||
* moduleclass - string must match the module's moduleclass
|
||||
* string
|
||||
* "don't care" values are ~0 for numbers, and NULL for strings
|
||||
* errmaj Major error return.
|
||||
* errmin Minor error return.
|
||||
*
|
||||
*/
|
||||
ModuleDescPtr
|
||||
LoadModule(const char *module, const char *path, const char **subdirlist,
|
||||
const char **patternlist, pointer options,
|
||||
const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
|
||||
{
|
||||
return doLoadModule(module, path, subdirlist, patternlist, options,
|
||||
modreq, errmaj, errmin, LD_FLAG_GLOBAL);
|
||||
}
|
||||
|
||||
ModuleDescPtr
|
||||
LoadDriver(const char *module, const char *path, int handle, pointer options,
|
||||
int *errmaj, int *errmin)
|
||||
|
|
|
@ -53,6 +53,12 @@
|
|||
/* Build GLX extension */
|
||||
#undef GLXEXT
|
||||
|
||||
/* Build GLX DRI loader */
|
||||
#undef GLX_DRI
|
||||
|
||||
/* Path to DRI drivers */
|
||||
#undef DRI_DRIVER_PATH
|
||||
|
||||
/* Include handhelds.org h3600 touchscreen driver */
|
||||
#undef H3600_TS
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $XdotOrg: xserver/xorg/mi/miinitext.c,v 1.30 2006/01/08 23:43:54 ajax Exp $ */
|
||||
/* $XdotOrg: xserver/xorg/mi/miinitext.c,v 1.31 2006/02/15 19:05:54 ajax Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.67 2003/01/12 02:44:27 dawes Exp $ */
|
||||
/***********************************************************
|
||||
|
||||
|
@ -350,6 +350,9 @@ extern void XFree86MiscExtensionInit(INITARGS);
|
|||
extern void XFree86DGAExtensionInit(INITARGS);
|
||||
#endif
|
||||
#ifdef GLXEXT
|
||||
typedef struct __GLXprovider __GLXprovider;
|
||||
extern __GLXprovider __glXMesaProvider;
|
||||
extern void GlxPushProvider(__GLXprovider *impl);
|
||||
#ifndef __DARWIN__
|
||||
extern void GlxExtensionInit(INITARGS);
|
||||
extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
|
||||
|
@ -643,6 +646,8 @@ InitExtensions(argc, argv)
|
|||
#endif
|
||||
#endif
|
||||
#ifdef GLXEXT
|
||||
|
||||
GlxPushProvider(&__glXMesaProvider);
|
||||
#ifndef __DARWIN__
|
||||
if (!noGlxExtension) GlxExtensionInit();
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue
Block a user