aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glx/glxdri.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
committermarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
commit76bcc36ed305418a3ddc5752d287ede894243e1b (patch)
treebacb320c825768471ce56f058f17ce863d592376 /xorg-server/glx/glxdri.c
parent7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff)
parent0f834b91a4768673833ab4917e87d86c237bb1a6 (diff)
downloadvcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip
Merge remote-tracking branch 'origin/released'
Conflicts: pixman/pixman/pixman-mmx.c xorg-server/Xext/shm.c xorg-server/Xext/syncsrv.h xorg-server/Xext/xvmain.c xorg-server/Xi/exevents.c xorg-server/Xi/opendev.c xorg-server/composite/compalloc.c xorg-server/composite/compoverlay.c xorg-server/dix/colormap.c xorg-server/dix/devices.c xorg-server/dix/dispatch.c xorg-server/dix/dixfonts.c xorg-server/dix/eventconvert.c xorg-server/dix/events.c xorg-server/dix/gc.c xorg-server/dix/getevents.c xorg-server/dix/main.c xorg-server/dix/privates.c xorg-server/dix/registry.c xorg-server/dix/resource.c xorg-server/exa/exa_accel.c xorg-server/exa/exa_migration_classic.c xorg-server/exa/exa_unaccel.c xorg-server/fb/fb.h xorg-server/fb/fbcopy.c xorg-server/fb/fbpixmap.c xorg-server/glx/dispatch.h xorg-server/glx/glapi.h xorg-server/glx/glapi_gentable.c xorg-server/glx/glapitable.h xorg-server/glx/glprocs.h xorg-server/glx/glxcmds.c xorg-server/glx/glxcmdsswap.c xorg-server/glx/glxdricommon.c xorg-server/glx/glxdriswrast.c xorg-server/glx/glxext.c xorg-server/glx/indirect_dispatch.c xorg-server/glx/indirect_dispatch.h xorg-server/glx/indirect_dispatch_swap.c xorg-server/glx/indirect_size.h xorg-server/glx/indirect_size_get.h xorg-server/glx/indirect_table.c xorg-server/glx/indirect_util.c xorg-server/glx/rensize.c xorg-server/glx/single2swap.c xorg-server/glx/singlepix.c xorg-server/glx/singlepixswap.c xorg-server/glx/singlesize.c xorg-server/hw/dmx/dmxinit.c xorg-server/hw/kdrive/ephyr/ephyr.c xorg-server/hw/kdrive/ephyr/hostx.c xorg-server/hw/kdrive/ephyr/hostx.h xorg-server/hw/kdrive/src/kinput.c xorg-server/hw/xfree86/common/compiler.h xorg-server/hw/xwin/InitInput.c xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/ddraw.h xorg-server/hw/xwin/glx/glwrap.c xorg-server/hw/xwin/glx/indirect.c xorg-server/hw/xwin/glx/wgl_ext_api.h xorg-server/hw/xwin/glx/winpriv.c xorg-server/hw/xwin/win.h xorg-server/hw/xwin/winallpriv.c xorg-server/hw/xwin/winauth.c xorg-server/hw/xwin/winclipboard.h xorg-server/hw/xwin/winclipboardinit.c xorg-server/hw/xwin/winclipboardthread.c xorg-server/hw/xwin/winclipboardunicode.c xorg-server/hw/xwin/winclipboardwndproc.c xorg-server/hw/xwin/winclipboardwrappers.c xorg-server/hw/xwin/winclipboardxevents.c xorg-server/hw/xwin/wincmap.c xorg-server/hw/xwin/winconfig.c xorg-server/hw/xwin/wincreatewnd.c xorg-server/hw/xwin/wincursor.c xorg-server/hw/xwin/windialogs.c xorg-server/hw/xwin/winengine.c xorg-server/hw/xwin/winerror.c xorg-server/hw/xwin/wingc.c xorg-server/hw/xwin/wingetsp.c xorg-server/hw/xwin/winkeybd.c xorg-server/hw/xwin/winkeybd.h xorg-server/hw/xwin/winlayouts.h xorg-server/hw/xwin/winmisc.c xorg-server/hw/xwin/winmonitors.c xorg-server/hw/xwin/winmouse.c xorg-server/hw/xwin/winmsg.c xorg-server/hw/xwin/winmsg.h xorg-server/hw/xwin/winmultiwindowclass.c xorg-server/hw/xwin/winmultiwindowicons.c xorg-server/hw/xwin/winmultiwindowshape.c xorg-server/hw/xwin/winmultiwindowwindow.c xorg-server/hw/xwin/winmultiwindowwm.c xorg-server/hw/xwin/winmultiwindowwndproc.c xorg-server/hw/xwin/winnativegdi.c xorg-server/hw/xwin/winpfbdd.c xorg-server/hw/xwin/winpixmap.c xorg-server/hw/xwin/winpolyline.c xorg-server/hw/xwin/winprefs.c xorg-server/hw/xwin/winprocarg.c xorg-server/hw/xwin/winregistry.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winshaddd.c xorg-server/hw/xwin/winshadddnl.c xorg-server/hw/xwin/winshadgdi.c xorg-server/hw/xwin/wintrayicon.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/hw/xwin/winwin32rootlesswindow.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/hw/xwin/winwindow.c xorg-server/hw/xwin/winwindow.h xorg-server/hw/xwin/winwindowswm.c xorg-server/hw/xwin/winwndproc.c xorg-server/include/callback.h xorg-server/include/dixstruct.h xorg-server/include/misc.h xorg-server/include/os.h xorg-server/include/scrnintstr.h xorg-server/mi/micmap.c xorg-server/mi/miinitext.c xorg-server/mi/mioverlay.c xorg-server/mi/misprite.c xorg-server/mi/mivaltree.c xorg-server/mi/miwindow.c xorg-server/miext/damage/damage.c xorg-server/miext/rootless/rootlessGC.c xorg-server/miext/rootless/rootlessWindow.c xorg-server/os/WaitFor.c xorg-server/os/access.c xorg-server/os/connection.c xorg-server/os/io.c xorg-server/os/log.c xorg-server/os/osinit.c xorg-server/os/utils.c xorg-server/os/xdmcp.c xorg-server/os/xprintf.c xorg-server/os/xstrans.c xorg-server/render/mipict.c xorg-server/xkb/xkbActions.c xorg-server/xkb/xkbInit.c xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/glx/glxdri.c')
-rw-r--r--xorg-server/glx/glxdri.c995
1 files changed, 488 insertions, 507 deletions
diff --git a/xorg-server/glx/glxdri.c b/xorg-server/glx/glxdri.c
index dc1adb9de..f256949c3 100644
--- a/xorg-server/glx/glxdri.c
+++ b/xorg-server/glx/glxdri.c
@@ -65,17 +65,17 @@
#include "dispatch.h"
#include "extension_string.h"
-typedef struct __GLXDRIscreen __GLXDRIscreen;
-typedef struct __GLXDRIcontext __GLXDRIcontext;
+typedef struct __GLXDRIscreen __GLXDRIscreen;
+typedef struct __GLXDRIcontext __GLXDRIcontext;
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
struct __GLXDRIscreen {
- __GLXscreen base;
- __DRIscreen *driScreen;
- void *driver;
+ __GLXscreen base;
+ __DRIscreen *driScreen;
+ void *driver;
- xf86EnterVTProc *enterVT;
- xf86LeaveVTProc *leaveVT;
+ xf86EnterVTProc *enterVT;
+ xf86LeaveVTProc *leaveVT;
const __DRIcoreExtension *core;
const __DRIlegacyExtension *legacy;
@@ -119,128 +119,127 @@ __glXDRIleaveServer(GLboolean rendering)
int i;
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
- __GLXDRIscreen * const screen =
- (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
- GLuint lastOverride = screen->lastTexOffsetOverride;
-
- if (lastOverride) {
- __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
- int j;
-
- for (j = 0; j < lastOverride; j++) {
- __GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
-
- if (pGlxPix && pGlxPix->texname) {
- pGlxPix->offset =
- screen->texOffsetStart((PixmapPtr)pGlxPix->base.pDraw);
- }
- }
- }
+ __GLXDRIscreen *const screen =
+ (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
+ GLuint lastOverride = screen->lastTexOffsetOverride;
+
+ if (lastOverride) {
+ __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
+ int j;
+
+ for (j = 0; j < lastOverride; j++) {
+ __GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
+
+ if (pGlxPix && pGlxPix->texname) {
+ pGlxPix->offset =
+ screen->texOffsetStart((PixmapPtr) pGlxPix->base.pDraw);
+ }
+ }
+ }
}
DRIBlockHandler(NULL, NULL, NULL);
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
- __GLXDRIscreen * const screen =
- (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
- GLuint lastOverride = screen->lastTexOffsetOverride;
-
- if (lastOverride) {
- __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
- int j;
-
- for (j = 0; j < lastOverride; j++) {
- __GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
-
- if (pGlxPix && pGlxPix->texname) {
- screen->texOffset->setTexOffset(pGlxPix->ctx->driContext,
- pGlxPix->texname,
- pGlxPix->offset,
- pGlxPix->base.pDraw->depth,
- ((PixmapPtr)pGlxPix->base.pDraw)->devKind);
- }
- }
- }
+ __GLXDRIscreen *const screen =
+ (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
+ GLuint lastOverride = screen->lastTexOffsetOverride;
+
+ if (lastOverride) {
+ __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
+ int j;
+
+ for (j = 0; j < lastOverride; j++) {
+ __GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
+
+ if (pGlxPix && pGlxPix->texname) {
+ screen->texOffset->setTexOffset(pGlxPix->ctx->driContext,
+ pGlxPix->texname,
+ pGlxPix->offset,
+ pGlxPix->base.pDraw->depth,
+ ((PixmapPtr) pGlxPix->base.
+ pDraw)->devKind);
+ }
+ }
+ }
}
}
-
+
static void
__glXDRIenterServer(GLboolean rendering)
{
int i;
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
- __GLXDRIscreen * const screen = (__GLXDRIscreen *)
- glxGetScreen(screenInfo.screens[i]);
+ __GLXDRIscreen *const screen = (__GLXDRIscreen *)
+ glxGetScreen(screenInfo.screens[i]);
- if (screen->lastTexOffsetOverride) {
- CALL_Flush(GET_DISPATCH(), ());
- break;
- }
+ if (screen->lastTexOffsetOverride) {
+ CALL_Flush(GET_DISPATCH(), ());
+ break;
+ }
}
DRIWakeupHandler(NULL, 0, NULL);
}
-
static void
-__glXDRIdoReleaseTexImage(__GLXDRIscreen *screen, __GLXDRIdrawable *drawable)
+__glXDRIdoReleaseTexImage(__GLXDRIscreen * screen, __GLXDRIdrawable * drawable)
{
GLuint lastOverride = screen->lastTexOffsetOverride;
if (lastOverride) {
- __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
- int i;
+ __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
+ int i;
- for (i = 0; i < lastOverride; i++) {
- if (texOffsetOverride[i] == drawable) {
- if (screen->texOffsetFinish)
- screen->texOffsetFinish((PixmapPtr)drawable->base.pDraw);
+ for (i = 0; i < lastOverride; i++) {
+ if (texOffsetOverride[i] == drawable) {
+ if (screen->texOffsetFinish)
+ screen->texOffsetFinish((PixmapPtr) drawable->base.pDraw);
- texOffsetOverride[i] = NULL;
+ texOffsetOverride[i] = NULL;
- if (i + 1 == lastOverride) {
- lastOverride = 0;
+ if (i + 1 == lastOverride) {
+ lastOverride = 0;
- while (i--) {
- if (texOffsetOverride[i]) {
- lastOverride = i + 1;
- break;
- }
- }
+ while (i--) {
+ if (texOffsetOverride[i]) {
+ lastOverride = i + 1;
+ break;
+ }
+ }
- screen->lastTexOffsetOverride = lastOverride;
+ screen->lastTexOffsetOverride = lastOverride;
- break;
- }
- }
- }
+ break;
+ }
+ }
+ }
}
}
-
static void
-__glXDRIdrawableDestroy(__GLXdrawable *drawable)
+__glXDRIdrawableDestroy(__GLXdrawable * drawable)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
__GLXDRIscreen *screen;
int i;
for (i = 0; i < screenInfo.numScreens; i++) {
- screen = (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
- __glXDRIdoReleaseTexImage(screen, private);
+ screen = (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
+ __glXDRIdoReleaseTexImage(screen, private);
}
/* If the X window was destroyed, the dri DestroyWindow hook will
* aready have taken care of this, so only call if pDraw isn't NULL. */
if (drawable->pDraw != NULL) {
- screen = (__GLXDRIscreen *) glxGetScreen(drawable->pDraw->pScreen);
- (*screen->core->destroyDrawable)(private->driDrawable);
+ screen = (__GLXDRIscreen *) glxGetScreen(drawable->pDraw->pScreen);
+ (*screen->core->destroyDrawable) (private->driDrawable);
- __glXenterServer(GL_FALSE);
- DRIDestroyDrawable(drawable->pDraw->pScreen,
- serverClient, drawable->pDraw);
- __glXleaveServer(GL_FALSE);
+ __glXenterServer(GL_FALSE);
+ DRIDestroyDrawable(drawable->pDraw->pScreen,
+ serverClient, drawable->pDraw);
+ __glXleaveServer(GL_FALSE);
}
__glXDrawableRelease(drawable);
@@ -249,46 +248,44 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
}
static GLboolean
-__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *basePrivate)
+__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable * basePrivate)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
__GLXDRIscreen *screen =
- (__GLXDRIscreen *) glxGetScreen(basePrivate->pDraw->pScreen);
+ (__GLXDRIscreen *) glxGetScreen(basePrivate->pDraw->pScreen);
- (*screen->core->swapBuffers)(private->driDrawable);
+ (*screen->core->swapBuffers) (private->driDrawable);
return TRUE;
}
-
static int
-__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval)
+__glXDRIdrawableSwapInterval(__GLXdrawable * baseDrawable, int interval)
{
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable;
__GLXDRIscreen *screen =
- (__GLXDRIscreen *) glxGetScreen(baseDrawable->pDraw->pScreen);
+ (__GLXDRIscreen *) glxGetScreen(baseDrawable->pDraw->pScreen);
if (screen->swapControl)
- screen->swapControl->setSwapInterval(draw->driDrawable, interval);
+ screen->swapControl->setSwapInterval(draw->driDrawable, interval);
return 0;
}
-
static void
-__glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
- int x, int y, int w, int h)
+__glXDRIdrawableCopySubBuffer(__GLXdrawable * basePrivate,
+ int x, int y, int w, int h)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
__GLXDRIscreen *screen = (__GLXDRIscreen *)
- glxGetScreen(basePrivate->pDraw->pScreen);
+ glxGetScreen(basePrivate->pDraw->pScreen);
if (screen->copySubBuffer)
- screen->copySubBuffer->copySubBuffer(private->driDrawable, x, y, w, h);
+ screen->copySubBuffer->copySubBuffer(private->driDrawable, x, y, w, h);
}
static void
-__glXDRIcontextDestroy(__GLXcontext *baseContext)
+__glXDRIcontextDestroy(__GLXcontext * baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
@@ -298,7 +295,7 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext)
__glXenterServer(GL_FALSE);
retval = DRIDestroyContext(baseContext->pGlxScreen->pScreen,
- context->hwContextID);
+ context->hwContextID);
__glXleaveServer(GL_FALSE);
__glXContextDestroy(&context->base);
@@ -306,54 +303,52 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext)
}
static int
-__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
+__glXDRIcontextMakeCurrent(__GLXcontext * baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
- return (*screen->core->bindContext)(context->driContext,
- draw->driDrawable,
- read->driDrawable);
-}
+ return (*screen->core->bindContext) (context->driContext,
+ draw->driDrawable, read->driDrawable);
+}
static int
-__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
+__glXDRIcontextLoseCurrent(__GLXcontext * baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
- return (*screen->core->unbindContext)(context->driContext);
+ return (*screen->core->unbindContext) (context->driContext);
}
static int
-__glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
- unsigned long mask)
+__glXDRIcontextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc,
+ unsigned long mask)
{
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
__GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
__GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
- return (*screen->core->copyContext)(dst->driContext,
- src->driContext, mask);
+ return (*screen->core->copyContext) (dst->driContext,
+ src->driContext, mask);
}
static void
-glxFillAlphaChannel (CARD32 *pixels, CARD32 rowstride, int width, int height)
+glxFillAlphaChannel(CARD32 *pixels, CARD32 rowstride, int width, int height)
{
int i;
CARD32 *p, *end;
rowstride /= 4;
-
- for (i = 0; i < height; i++)
- {
- p = pixels;
- end = p + width;
- while (p < end)
- *p++ |= 0xFF000000;
- pixels += rowstride;
+
+ for (i = 0; i < height; i++) {
+ p = pixels;
+ end = p + width;
+ while (p < end)
+ *p++ |= 0xFF000000;
+ pixels += rowstride;
}
}
@@ -363,7 +358,7 @@ testTexOffset(__GLXDRIscreen * const screen, PixmapPtr pPixmap)
Bool ret;
if (!screen->texOffsetStart || !screen->texOffset)
- return FALSE;
+ return FALSE;
__glXenterServer(GL_FALSE);
ret = screen->texOffsetStart(pPixmap) != ~0ULL;
@@ -385,195 +380,191 @@ testTexOffset(__GLXDRIscreen * const screen, PixmapPtr pPixmap)
*/
static int
-__glXDRIbindTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *glxPixmap)
+__glXDRIbindTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * glxPixmap)
{
- RegionPtr pRegion = NULL;
- PixmapPtr pixmap;
- int bpp, override = 0, texname;
- GLenum format, type;
+ RegionPtr pRegion = NULL;
+ PixmapPtr pixmap;
+ int bpp, override = 0, texname;
+ GLenum format, type;
ScreenPtr pScreen = glxPixmap->pDraw->pScreen;
__GLXDRIdrawable *driDraw = (__GLXDRIdrawable *) glxPixmap;
- __GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen);
+ __GLXDRIscreen *const screen = (__GLXDRIscreen *) glxGetScreen(pScreen);
CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
- GL_TEXTURE_BINDING_2D :
- GL_TEXTURE_BINDING_RECTANGLE_NV,
- &texname));
+ GL_TEXTURE_BINDING_2D :
+ GL_TEXTURE_BINDING_RECTANGLE_NV,
+ &texname));
if (!texname)
- return __glXError(GLXBadContextState);
+ return __glXError(GLXBadContextState);
pixmap = (PixmapPtr) glxPixmap->pDraw;
if (testTexOffset(screen, pixmap)) {
- __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
- int i, firstEmpty = 16;
+ __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
+ int i, firstEmpty = 16;
- for (i = 0; i < 16; i++) {
- if (texOffsetOverride[i] == driDraw)
- goto alreadyin;
+ for (i = 0; i < 16; i++) {
+ if (texOffsetOverride[i] == driDraw)
+ goto alreadyin;
- if (firstEmpty == 16 && !texOffsetOverride[i])
- firstEmpty = i;
- }
+ if (firstEmpty == 16 && !texOffsetOverride[i])
+ firstEmpty = i;
+ }
- if (firstEmpty == 16) {
- ErrorF("%s: Failed to register texture offset override\n", __func__);
- goto nooverride;
- }
+ if (firstEmpty == 16) {
+ ErrorF("%s: Failed to register texture offset override\n",
+ __func__);
+ goto nooverride;
+ }
- if (firstEmpty >= screen->lastTexOffsetOverride)
- screen->lastTexOffsetOverride = firstEmpty + 1;
+ if (firstEmpty >= screen->lastTexOffsetOverride)
+ screen->lastTexOffsetOverride = firstEmpty + 1;
- texOffsetOverride[firstEmpty] = driDraw;
+ texOffsetOverride[firstEmpty] = driDraw;
-alreadyin:
- override = 1;
+ alreadyin:
+ override = 1;
- driDraw->ctx = (__GLXDRIcontext*)baseContext;
+ driDraw->ctx = (__GLXDRIcontext *) baseContext;
- if (texname == driDraw->texname)
- return Success;
+ if (texname == driDraw->texname)
+ return Success;
- driDraw->texname = texname;
+ driDraw->texname = texname;
- screen->texOffset->setTexOffset(driDraw->ctx->driContext, texname, 0,
- pixmap->drawable.depth,
- pixmap->devKind);
+ screen->texOffset->setTexOffset(driDraw->ctx->driContext, texname, 0,
+ pixmap->drawable.depth,
+ pixmap->devKind);
}
-nooverride:
+ nooverride:
if (!driDraw->pDamage) {
- if (!override) {
- driDraw->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
- TRUE, pScreen, NULL);
- if (!driDraw->pDamage)
- return BadAlloc;
-
- DamageRegister ((DrawablePtr) pixmap, driDraw->pDamage);
- }
-
- pRegion = NULL;
- } else {
- pRegion = DamageRegion(driDraw->pDamage);
- if (RegionNil(pRegion))
- return Success;
+ if (!override) {
+ driDraw->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
+ TRUE, pScreen, NULL);
+ if (!driDraw->pDamage)
+ return BadAlloc;
+
+ DamageRegister((DrawablePtr) pixmap, driDraw->pDamage);
+ }
+
+ pRegion = NULL;
+ }
+ else {
+ pRegion = DamageRegion(driDraw->pDamage);
+ if (RegionNil(pRegion))
+ return Success;
}
/* XXX 24bpp packed, 8, etc */
if (pixmap->drawable.depth >= 24) {
- bpp = 4;
- format = GL_BGRA;
- type =
+ bpp = 4;
+ format = GL_BGRA;
+ type =
#if X_BYTE_ORDER == X_BIG_ENDIAN
- !override ? GL_UNSIGNED_INT_8_8_8_8_REV :
+ !override ? GL_UNSIGNED_INT_8_8_8_8_REV :
#endif
- GL_UNSIGNED_BYTE;
- } else {
- bpp = 2;
- format = GL_RGB;
- type = GL_UNSIGNED_SHORT_5_6_5;
+ GL_UNSIGNED_BYTE;
+ }
+ else {
+ bpp = 2;
+ format = GL_RGB;
+ type = GL_UNSIGNED_SHORT_5_6_5;
}
- if (pRegion == NULL)
- {
- void *data = NULL;
-
- if (!override) {
- unsigned pitch = PixmapBytePad(pixmap->drawable.width,
- pixmap->drawable.depth);
-
- data = malloc(pitch * pixmap->drawable.height);
-
- __glXenterServer(GL_FALSE);
- pScreen->GetImage(&pixmap->drawable, 0 /*pixmap->drawable.x*/,
- 0 /*pixmap->drawable.y*/, pixmap->drawable.width,
- pixmap->drawable.height, ZPixmap, ~0, data);
- __glXleaveServer(GL_FALSE);
-
- if (pixmap->drawable.depth == 24)
- glxFillAlphaChannel(data,
- pitch,
- pixmap->drawable.width,
- pixmap->drawable.height);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
- pitch / bpp) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0) );
- }
-
- CALL_TexImage2D( GET_DISPATCH(),
- (glxPixmap->target,
- 0,
- bpp == 4 ? 4 : 3,
- pixmap->drawable.width,
- pixmap->drawable.height,
- 0,
- format,
- type,
- data) );
-
- free(data);
- } else if (!override) {
+ if (pRegion == NULL) {
+ void *data = NULL;
+
+ if (!override) {
+ unsigned pitch = PixmapBytePad(pixmap->drawable.width,
+ pixmap->drawable.depth);
+
+ data = malloc(pitch * pixmap->drawable.height);
+
+ __glXenterServer(GL_FALSE);
+ pScreen->GetImage(&pixmap->drawable, 0 /*pixmap->drawable.x */ ,
+ 0 /*pixmap->drawable.y */ ,
+ pixmap->drawable.width,
+ pixmap->drawable.height, ZPixmap, ~0, data);
+ __glXleaveServer(GL_FALSE);
+
+ if (pixmap->drawable.depth == 24)
+ glxFillAlphaChannel(data,
+ pitch,
+ pixmap->drawable.width,
+ pixmap->drawable.height);
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
+ pitch / bpp));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0));
+ }
+
+ CALL_TexImage2D(GET_DISPATCH(),
+ (glxPixmap->target,
+ 0,
+ bpp == 4 ? 4 : 3,
+ pixmap->drawable.width,
+ pixmap->drawable.height, 0, format, type, data));
+
+ free(data);
+ }
+ else if (!override) {
int i, numRects;
- BoxPtr p;
-
- numRects = RegionNumRects (pRegion);
- p = RegionRects (pRegion);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0) );
-
- for (i = 0; i < numRects; i++)
- {
- unsigned pitch = PixmapBytePad(p[i].x2 - p[i].x1,
- pixmap->drawable.depth);
- void *data = malloc(pitch * (p[i].y2 - p[i].y1));
-
- __glXenterServer(GL_FALSE);
- pScreen->GetImage(&pixmap->drawable, /*pixmap->drawable.x +*/ p[i].x1,
- /*pixmap->drawable.y*/ + p[i].y1, p[i].x2 - p[i].x1,
- p[i].y2 - p[i].y1, ZPixmap, ~0, data);
- __glXleaveServer(GL_FALSE);
-
- if (pixmap->drawable.depth == 24)
- glxFillAlphaChannel(data,
- pitch,
- p[i].x2 - p[i].x1,
- p[i].y2 - p[i].y1);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
- pitch / bpp) );
-
- CALL_TexSubImage2D( GET_DISPATCH(),
- (glxPixmap->target,
- 0,
- p[i].x1, p[i].y1,
- p[i].x2 - p[i].x1, p[i].y2 - p[i].y1,
- format,
- type,
- data) );
-
- free(data);
- }
+ BoxPtr p;
+
+ numRects = RegionNumRects(pRegion);
+ p = RegionRects(pRegion);
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0));
+
+ for (i = 0; i < numRects; i++) {
+ unsigned pitch = PixmapBytePad(p[i].x2 - p[i].x1,
+ pixmap->drawable.depth);
+ void *data = malloc(pitch * (p[i].y2 - p[i].y1));
+
+ __glXenterServer(GL_FALSE);
+ pScreen->GetImage(&pixmap->drawable, /*pixmap->drawable.x + */
+ p[i].x1,
+ /*pixmap->drawable.y */ +p[i].y1,
+ p[i].x2 - p[i].x1,
+ p[i].y2 - p[i].y1, ZPixmap, ~0, data);
+ __glXleaveServer(GL_FALSE);
+
+ if (pixmap->drawable.depth == 24)
+ glxFillAlphaChannel(data,
+ pitch,
+ p[i].x2 - p[i].x1, p[i].y2 - p[i].y1);
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
+ pitch / bpp));
+
+ CALL_TexSubImage2D(GET_DISPATCH(),
+ (glxPixmap->target,
+ 0,
+ p[i].x1, p[i].y1,
+ p[i].x2 - p[i].x1, p[i].y2 - p[i].y1,
+ format, type, data));
+
+ free(data);
+ }
}
if (!override)
- DamageEmpty(driDraw->pDamage);
+ DamageEmpty(driDraw->pDamage);
return Success;
}
static int
-__glXDRIreleaseTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *pixmap)
+__glXDRIreleaseTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * pixmap)
{
__GLXDRIscreen *screen =
- (__GLXDRIscreen *) glxGetScreen(pixmap->pDraw->pScreen);
+ (__GLXDRIscreen *) glxGetScreen(pixmap->pDraw->pScreen);
__GLXDRIdrawable *drawable = (__GLXDRIdrawable *) pixmap;
__glXDRIdoReleaseTexImage(screen, drawable);
@@ -587,7 +578,7 @@ static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
};
static void
-__glXDRIscreenDestroy(__GLXscreen *baseScreen)
+__glXDRIscreenDestroy(__GLXscreen * baseScreen)
{
int i;
@@ -600,18 +591,18 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
__glXScreenDestroy(baseScreen);
if (screen->driConfigs) {
- for (i = 0; screen->driConfigs[i] != NULL; i++)
- free((__DRIconfig **)screen->driConfigs[i]);
- free(screen->driConfigs);
+ for (i = 0; screen->driConfigs[i] != NULL; i++)
+ free((__DRIconfig **) screen->driConfigs[i]);
+ free(screen->driConfigs);
}
free(screen);
}
static __GLXcontext *
-__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
- __GLXconfig *glxConfig,
- __GLXcontext *baseShareContext)
+__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
+ __GLXconfig * glxConfig,
+ __GLXcontext * baseShareContext)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -625,55 +616,51 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
- driShare = shareContext->driContext;
+ driShare = shareContext->driContext;
else
- driShare = NULL;
+ driShare = NULL;
if (baseShareContext && baseShareContext->isDirect)
return NULL;
context = calloc(1, sizeof *context);
if (context == NULL)
- return NULL;
+ return NULL;
- context->base.destroy = __glXDRIcontextDestroy;
- context->base.makeCurrent = __glXDRIcontextMakeCurrent;
- context->base.loseCurrent = __glXDRIcontextLoseCurrent;
- context->base.copy = __glXDRIcontextCopy;
+ context->base.destroy = __glXDRIcontextDestroy;
+ context->base.makeCurrent = __glXDRIcontextMakeCurrent;
+ context->base.loseCurrent = __glXDRIcontextLoseCurrent;
+ context->base.copy = __glXDRIcontextCopy;
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
/* Find the requested X visual */
visual = pScreen->visuals;
for (i = 0; i < pScreen->numVisuals; i++, visual++)
- if (visual->vid == glxConfig->visualID)
- break;
+ if (visual->vid == glxConfig->visualID)
+ break;
if (i == pScreen->numVisuals)
- return NULL;
+ return NULL;
context->hwContextID = FakeClientID(0);
__glXenterServer(GL_FALSE);
retval = DRICreateContext(baseScreen->pScreen, visual,
- context->hwContextID, &hwContext);
+ context->hwContextID, &hwContext);
__glXleaveServer(GL_FALSE);
if (!retval)
- return NULL;
+ return NULL;
- context->driContext =
- screen->legacy->createNewContext(screen->driScreen,
- config->driConfig,
- 0, /* render type */
- driShare,
- hwContext,
- context);
+ context->driContext = screen->legacy->createNewContext(screen->driScreen, config->driConfig, 0, /* render type */
+ driShare,
+ hwContext, context);
if (context->driContext == NULL) {
- __glXenterServer(GL_FALSE);
- retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID);
- __glXleaveServer(GL_FALSE);
- free(context);
- return NULL;
+ __glXenterServer(GL_FALSE);
+ retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID);
+ __glXleaveServer(GL_FALSE);
+ free(context);
+ return NULL;
}
return &context->base;
@@ -681,12 +668,10 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
static __GLXdrawable *
__glXDRIscreenCreateDrawable(ClientPtr client,
- __GLXscreen *screen,
- DrawablePtr pDraw,
- XID drawId,
- int type,
- XID glxDrawId,
- __GLXconfig *glxConfig)
+ __GLXscreen * screen,
+ DrawablePtr pDraw,
+ XID drawId,
+ int type, XID glxDrawId, __GLXconfig * glxConfig)
{
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
@@ -696,57 +681,57 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
private = calloc(1, sizeof *private);
if (private == NULL)
- return NULL;
+ return NULL;
if (!__glXDrawableInit(&private->base, screen,
- pDraw, type, glxDrawId, glxConfig)) {
+ pDraw, type, glxDrawId, glxConfig)) {
free(private);
- return NULL;
+ return NULL;
}
- private->base.destroy = __glXDRIdrawableDestroy;
- private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
+ private->base.destroy = __glXDRIdrawableDestroy;
+ private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
- private->base.waitX = NULL;
- private->base.waitGL = NULL;
+ private->base.waitX = NULL;
+ private->base.waitGL = NULL;
__glXenterServer(GL_FALSE);
retval = DRICreateDrawable(screen->pScreen, serverClient,
- pDraw, &hwDrawable);
+ pDraw, &hwDrawable);
__glXleaveServer(GL_FALSE);
if (!retval) {
free(private);
- return NULL;
+ return NULL;
}
/* The last argument is 'attrs', which is used with pbuffers which
* we currently don't support. */
private->driDrawable =
- (driScreen->legacy->createNewDrawable)(driScreen->driScreen,
- config->driConfig,
- hwDrawable, 0, NULL, private);
+ (driScreen->legacy->createNewDrawable) (driScreen->driScreen,
+ config->driConfig,
+ hwDrawable, 0, NULL, private);
if (private->driDrawable == NULL) {
- __glXenterServer(GL_FALSE);
- DRIDestroyDrawable(screen->pScreen, serverClient, pDraw);
- __glXleaveServer(GL_FALSE);
- free(private);
- return NULL;
+ __glXenterServer(GL_FALSE);
+ DRIDestroyDrawable(screen->pScreen, serverClient, pDraw);
+ __glXleaveServer(GL_FALSE);
+ free(private);
+ return NULL;
}
return &private->base;
}
static GLboolean
-getDrawableInfo(__DRIdrawable *driDrawable,
- unsigned int *index, unsigned int *stamp,
- int *x, int *y, int *width, int *height,
- int *numClipRects, drm_clip_rect_t **ppClipRects,
- int *backX, int *backY,
- int *numBackClipRects, drm_clip_rect_t **ppBackClipRects,
- void *data)
+getDrawableInfo(__DRIdrawable * driDrawable,
+ unsigned int *index, unsigned int *stamp,
+ int *x, int *y, int *width, int *height,
+ int *numClipRects, drm_clip_rect_t ** ppClipRects,
+ int *backX, int *backY,
+ int *numBackClipRects, drm_clip_rect_t ** ppBackClipRects,
+ void *data)
{
__GLXDRIdrawable *drawable = data;
ScreenPtr pScreen;
@@ -756,72 +741,72 @@ getDrawableInfo(__DRIdrawable *driDrawable,
/* If the X window has been destroyed, give up here. */
if (drawable->base.pDraw == NULL)
- return GL_FALSE;
+ return GL_FALSE;
pScreen = drawable->base.pDraw->pScreen;
__glXenterServer(GL_FALSE);
retval = DRIGetDrawableInfo(pScreen, drawable->base.pDraw, index, stamp,
- x, y, width, height,
- numClipRects, &pClipRects,
- backX, backY,
- numBackClipRects, &pBackClipRects);
+ x, y, width, height,
+ numClipRects, &pClipRects,
+ backX, backY,
+ numBackClipRects, &pBackClipRects);
__glXleaveServer(GL_FALSE);
if (retval && *numClipRects > 0) {
- size = sizeof (drm_clip_rect_t) * *numClipRects;
- *ppClipRects = malloc(size);
-
- /* Clip cliprects to screen dimensions (redirected windows) */
- if (*ppClipRects != NULL) {
- int i, j;
-
- for (i = 0, j = 0; i < *numClipRects; i++) {
- (*ppClipRects)[j].x1 = max(pClipRects[i].x1, 0);
- (*ppClipRects)[j].y1 = max(pClipRects[i].y1, 0);
- (*ppClipRects)[j].x2 = min(pClipRects[i].x2, pScreen->width);
- (*ppClipRects)[j].y2 = min(pClipRects[i].y2, pScreen->height);
-
- if ((*ppClipRects)[j].x1 < (*ppClipRects)[j].x2 &&
- (*ppClipRects)[j].y1 < (*ppClipRects)[j].y2) {
- j++;
- }
- }
-
- if (*numClipRects != j) {
- *numClipRects = j;
- *ppClipRects = realloc(*ppClipRects,
- sizeof (drm_clip_rect_t) *
- *numClipRects);
- }
- } else
- *numClipRects = 0;
+ size = sizeof(drm_clip_rect_t) * *numClipRects;
+ *ppClipRects = malloc(size);
+
+ /* Clip cliprects to screen dimensions (redirected windows) */
+ if (*ppClipRects != NULL) {
+ int i, j;
+
+ for (i = 0, j = 0; i < *numClipRects; i++) {
+ (*ppClipRects)[j].x1 = max(pClipRects[i].x1, 0);
+ (*ppClipRects)[j].y1 = max(pClipRects[i].y1, 0);
+ (*ppClipRects)[j].x2 = min(pClipRects[i].x2, pScreen->width);
+ (*ppClipRects)[j].y2 = min(pClipRects[i].y2, pScreen->height);
+
+ if ((*ppClipRects)[j].x1 < (*ppClipRects)[j].x2 &&
+ (*ppClipRects)[j].y1 < (*ppClipRects)[j].y2) {
+ j++;
+ }
+ }
+
+ if (*numClipRects != j) {
+ *numClipRects = j;
+ *ppClipRects = realloc(*ppClipRects,
+ sizeof(drm_clip_rect_t) * *numClipRects);
+ }
+ }
+ else
+ *numClipRects = 0;
}
else {
- *ppClipRects = NULL;
- *numClipRects = 0;
+ *ppClipRects = NULL;
+ *numClipRects = 0;
}
-
+
if (retval && *numBackClipRects > 0) {
- size = sizeof (drm_clip_rect_t) * *numBackClipRects;
- *ppBackClipRects = malloc(size);
- if (*ppBackClipRects != NULL)
- memcpy (*ppBackClipRects, pBackClipRects, size);
- else
- *numBackClipRects = 0;
+ size = sizeof(drm_clip_rect_t) * *numBackClipRects;
+ *ppBackClipRects = malloc(size);
+ if (*ppBackClipRects != NULL)
+ memcpy(*ppBackClipRects, pBackClipRects, size);
+ else
+ *numBackClipRects = 0;
}
else {
- *ppBackClipRects = NULL;
- *numBackClipRects = 0;
+ *ppBackClipRects = NULL;
+ *numBackClipRects = 0;
}
return retval;
}
-static void __glXReportDamage(__DRIdrawable *driDraw,
- int x, int y,
- drm_clip_rect_t *rects, int num_rects,
- GLboolean front_buffer,
- void *data)
+static void
+__glXReportDamage(__DRIdrawable * driDraw,
+ int x, int y,
+ drm_clip_rect_t * rects, int num_rects,
+ GLboolean front_buffer, void *data)
{
__GLXDRIdrawable *drawable = data;
DrawablePtr pDraw = drawable->base.pDraw;
@@ -830,29 +815,29 @@ static void __glXReportDamage(__DRIdrawable *driDraw,
__glXenterServer(GL_FALSE);
if (RegionInitBoxes(&region, (BoxPtr) rects, num_rects)) {
- RegionTranslate(&region, pDraw->x, pDraw->y);
- DamageDamageRegion(pDraw, &region);
- RegionUninit(&region);
+ RegionTranslate(&region, pDraw->x, pDraw->y);
+ DamageDamageRegion(pDraw, &region);
+ RegionUninit(&region);
}
else {
- while (num_rects--) {
- RegionInit (&region, (BoxPtr) rects++, 1);
- RegionTranslate(&region, pDraw->x, pDraw->y);
- DamageDamageRegion(pDraw, &region);
- RegionUninit(&region);
- }
+ while (num_rects--) {
+ RegionInit(&region, (BoxPtr) rects++, 1);
+ RegionTranslate(&region, pDraw->x, pDraw->y);
+ DamageDamageRegion(pDraw, &region);
+ RegionUninit(&region);
+ }
}
__glXleaveServer(GL_FALSE);
}
static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = {
- { __DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION },
+ {__DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION},
getDrawableInfo
};
static const __DRIdamageExtension damageExtension = {
- { __DRI_DAMAGE, __DRI_DAMAGE_VERSION },
+ {__DRI_DAMAGE, __DRI_DAMAGE_VERSION},
__glXReportDamage,
};
@@ -863,39 +848,37 @@ static const __DRIextension *loader_extensions[] = {
NULL
};
-
-
static Bool
-glxDRIEnterVT (int index, int flags)
+glxDRIEnterVT(int index, int flags)
{
ScrnInfoPtr scrn = xf86Screens[index];
- Bool ret;
- __GLXDRIscreen *screen = (__GLXDRIscreen *)
- glxGetScreen(screenInfo.screens[index]);
+ Bool ret;
+ __GLXDRIscreen *screen = (__GLXDRIscreen *)
+ glxGetScreen(screenInfo.screens[index]);
LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
scrn->EnterVT = screen->enterVT;
- ret = scrn->EnterVT (index, flags);
+ ret = scrn->EnterVT(index, flags);
screen->enterVT = scrn->EnterVT;
scrn->EnterVT = glxDRIEnterVT;
if (!ret)
- return FALSE;
-
+ return FALSE;
+
glxResumeClients();
return TRUE;
}
static void
-glxDRILeaveVT (int index, int flags)
+glxDRILeaveVT(int index, int flags)
{
ScrnInfoPtr scrn = xf86Screens[index];
__GLXDRIscreen *screen = (__GLXDRIscreen *)
- glxGetScreen(screenInfo.screens[index]);
+ glxGetScreen(screenInfo.screens[index]);
LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
@@ -908,7 +891,7 @@ glxDRILeaveVT (int index, int flags)
}
static void
-initializeExtensions(__GLXDRIscreen *screen)
+initializeExtensions(__GLXDRIscreen * screen)
{
const __DRIextension **extensions;
int i;
@@ -917,86 +900,88 @@ initializeExtensions(__GLXDRIscreen *screen)
for (i = 0; extensions[i]; i++) {
#ifdef __DRI_READ_DRAWABLE
- if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
- __glXEnableExtension(screen->glx_enable_bits,
- "GLX_SGI_make_current_read");
-
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
- }
+ if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_make_current_read");
+
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
+ }
#endif
#ifdef __DRI_COPY_SUB_BUFFER
- if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
- screen->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
- __glXEnableExtension(screen->glx_enable_bits,
- "GLX_MESA_copy_sub_buffer");
-
- LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
- }
+ if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
+ screen->copySubBuffer =
+ (__DRIcopySubBufferExtension *) extensions[i];
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_MESA_copy_sub_buffer");
+
+ LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
+ }
#endif
#ifdef __DRI_SWAP_CONTROL
- if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
- screen->swapControl = (__DRIswapControlExtension *) extensions[i];
- __glXEnableExtension(screen->glx_enable_bits,
- "GLX_SGI_swap_control");
- __glXEnableExtension(screen->glx_enable_bits,
- "GLX_MESA_swap_control");
-
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
- }
+ if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
+ screen->swapControl = (__DRIswapControlExtension *) extensions[i];
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_swap_control");
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_MESA_swap_control");
+
+ LogMessage(X_INFO,
+ "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
+ }
#endif
#ifdef __DRI_TEX_OFFSET
- if (strcmp(extensions[i]->name, __DRI_TEX_OFFSET) == 0) {
- screen->texOffset = (__DRItexOffsetExtension *) extensions[i];
- LogMessage(X_INFO, "AIGLX: enabled GLX_texture_from_pixmap with driver support\n");
- }
+ if (strcmp(extensions[i]->name, __DRI_TEX_OFFSET) == 0) {
+ screen->texOffset = (__DRItexOffsetExtension *) extensions[i];
+ LogMessage(X_INFO,
+ "AIGLX: enabled GLX_texture_from_pixmap with driver support\n");
+ }
#endif
- /* Ignore unknown extensions */
+ /* Ignore unknown extensions */
}
}
-
+
static __GLXscreen *
__glXDRIscreenProbe(ScreenPtr pScreen)
{
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;
+ __DRIversion ddx_version;
+ __DRIversion dri_version;
+ __DRIversion drm_version;
+ __DRIframebuffer framebuffer;
+ int fd = -1;
+ int status;
drm_magic_t magic;
drmVersionPtr version;
int newlyopened;
char *driverName;
- drm_handle_t hFB;
- int junk;
+ drm_handle_t hFB;
+ int junk;
__GLXDRIscreen *screen;
Bool isCapable;
size_t buffer_size;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
- !DRIQueryDirectRenderingCapable(pScreen, &isCapable) ||
- !isCapable) {
- LogMessage(X_INFO,
- "AIGLX: Screen %d is not DRI capable\n", pScreen->myNum);
- return NULL;
+ !DRIQueryDirectRenderingCapable(pScreen, &isCapable) || !isCapable) {
+ LogMessage(X_INFO,
+ "AIGLX: Screen %d is not DRI capable\n", pScreen->myNum);
+ return NULL;
}
screen = calloc(1, sizeof *screen);
if (screen == NULL)
- return NULL;
+ return NULL;
- screen->base.destroy = __glXDRIscreenDestroy;
- screen->base.createContext = __glXDRIscreenCreateContext;
+ screen->base.destroy = __glXDRIscreenDestroy;
+ screen->base.createContext = __glXDRIscreenCreateContext;
screen->base.createDrawable = __glXDRIscreenCreateDrawable;
- screen->base.swapInterval = __glXDRIdrawableSwapInterval;
- screen->base.pScreen = pScreen;
+ screen->base.swapInterval = __glXDRIdrawableSwapInterval;
+ screen->base.pScreen = pScreen;
__glXInitExtensionEnableBits(screen->glx_enable_bits);
@@ -1006,62 +991,61 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
dri_version.patch = XF86DRI_PATCH_VERSION;
if (!DRIOpenConnection(pScreen, &hSAREA, &BusID)) {
- LogMessage(X_ERROR, "AIGLX error: DRIOpenConnection failed\n");
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: DRIOpenConnection failed\n");
+ goto handle_error;
}
fd = drmOpenOnce(NULL, BusID, &newlyopened);
if (fd < 0) {
- LogMessage(X_ERROR, "AIGLX error: drmOpenOnce failed (%s)\n",
- strerror(-fd));
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: drmOpenOnce failed (%s)\n",
+ strerror(-fd));
+ goto handle_error;
}
if (drmGetMagic(fd, &magic)) {
- LogMessage(X_ERROR, "AIGLX error: drmGetMagic failed\n");
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: drmGetMagic failed\n");
+ 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);
+ 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;
+ drm_version.major = -1;
+ drm_version.minor = -1;
+ drm_version.patch = -1;
}
if (newlyopened && !DRIAuthConnection(pScreen, magic)) {
- LogMessage(X_ERROR, "AIGLX error: DRIAuthConnection failed\n");
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: DRIAuthConnection failed\n");
+ 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)) {
- LogMessage(X_ERROR, "AIGLX error: DRIGetClientDriverName failed\n");
- goto handle_error;
+ &ddx_version.major,
+ &ddx_version.minor,
+ &ddx_version.patch, &driverName)) {
+ LogMessage(X_ERROR, "AIGLX error: DRIGetClientDriverName failed\n");
+ goto handle_error;
}
screen->driver = glxProbeDriver(driverName,
- (void **)&screen->core,
- __DRI_CORE, __DRI_CORE_VERSION,
- (void **)&screen->legacy,
- __DRI_LEGACY, __DRI_LEGACY_VERSION);
+ (void **) &screen->core,
+ __DRI_CORE, __DRI_CORE_VERSION,
+ (void **) &screen->legacy,
+ __DRI_LEGACY, __DRI_LEGACY_VERSION);
if (screen->driver == NULL) {
goto handle_error;
}
-
+
/*
* Get device-specific info. pDevPriv will point to a struct
* (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) that
@@ -1069,22 +1053,22 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
* buffers, DRM mmap handles, etc.
*/
if (!DRIGetDeviceInfo(pScreen, &hFB, &junk,
- &framebuffer.size, &framebuffer.stride,
- &framebuffer.dev_priv_size, &framebuffer.dev_priv)) {
- LogMessage(X_ERROR, "AIGLX error: XF86DRIGetDeviceInfo failed\n");
- goto handle_error;
+ &framebuffer.size, &framebuffer.stride,
+ &framebuffer.dev_priv_size, &framebuffer.dev_priv)) {
+ LogMessage(X_ERROR, "AIGLX error: XF86DRIGetDeviceInfo failed\n");
+ goto handle_error;
}
framebuffer.width = pScreen->width;
framebuffer.height = pScreen->height;
/* Map the framebuffer region. */
- status = drmMap(fd, hFB, framebuffer.size,
- (drmAddressPtr)&framebuffer.base);
+ status = drmMap(fd, hFB, framebuffer.size,
+ (drmAddressPtr) & framebuffer.base);
if (status != 0) {
- LogMessage(X_ERROR, "AIGLX error: drmMap of framebuffer failed (%s)\n",
- strerror(-status));
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: drmMap of framebuffer failed (%s)\n",
+ strerror(-status));
+ goto handle_error;
}
/* Map the SAREA region. Further mmap regions may be setup in
@@ -1092,37 +1076,35 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
*/
status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA);
if (status != 0) {
- LogMessage(X_ERROR, "AIGLX error: drmMap of SAREA failed (%s)\n",
- strerror(-status));
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: drmMap of SAREA failed (%s)\n",
+ strerror(-status));
+ goto handle_error;
}
-
+
screen->driScreen =
- (*screen->legacy->createNewScreen)(pScreen->myNum,
- &ddx_version,
- &dri_version,
- &drm_version,
- &framebuffer,
- pSAREA,
- fd,
- loader_extensions,
- &screen->driConfigs,
- screen);
+ (*screen->legacy->createNewScreen) (pScreen->myNum,
+ &ddx_version,
+ &dri_version,
+ &drm_version,
+ &framebuffer,
+ pSAREA,
+ fd,
+ loader_extensions,
+ &screen->driConfigs, screen);
if (screen->driScreen == NULL) {
- LogMessage(X_ERROR,
- "AIGLX error: Calling driver entry point failed\n");
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed\n");
+ goto handle_error;
}
screen->base.fbconfigs = glxConvertConfigs(screen->core,
- screen->driConfigs,
- GLX_WINDOW_BIT);
+ screen->driConfigs,
+ GLX_WINDOW_BIT);
initializeExtensions(screen);
DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
- &screen->texOffsetFinish);
+ &screen->texOffsetFinish);
__glXScreenInit(&screen->base, pScreen);
@@ -1132,11 +1114,11 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
*/
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0) {
- free(screen->base.GLXextensions);
+ free(screen->base.GLXextensions);
- screen->base.GLXextensions = xnfalloc(buffer_size);
- (void) __glXGetExtensionString(screen->glx_enable_bits,
- screen->base.GLXextensions);
+ screen->base.GLXextensions = xnfalloc(buffer_size);
+ (void) __glXGetExtensionString(screen->glx_enable_bits,
+ screen->base.GLXextensions);
}
__glXsetEnterLeaveServerFuncs(__glXDRIenterServer, __glXDRIleaveServer);
@@ -1146,20 +1128,19 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
screen->leaveVT = pScrn->LeaveVT;
pScrn->LeaveVT = glxDRILeaveVT;
- LogMessage(X_INFO,
- "AIGLX: Loaded and initialized %s\n", driverName);
+ LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName);
return &screen->base;
handle_error:
if (pSAREA != NULL)
- drmUnmap(pSAREA, SAREA_MAX);
+ drmUnmap(pSAREA, SAREA_MAX);
if (framebuffer.base != NULL)
- drmUnmap((drmAddress)framebuffer.base, framebuffer.size);
+ drmUnmap((drmAddress) framebuffer.base, framebuffer.size);
if (fd >= 0)
- drmCloseOnce(fd);
+ drmCloseOnce(fd);
DRICloseConnection(pScreen);