diff options
author | marha <marha@users.sourceforge.net> | 2009-07-25 20:12:58 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-07-25 20:12:58 +0000 |
commit | 2553bdd7c359cd87525d367761c86932cec5adff (patch) | |
tree | ae71245933c98474a699d3e392de5820879b2018 /xorg-server/glx/glxdri.c | |
parent | e2c51f2ee7b0a3ea1a052fc49324057b4a4bbc78 (diff) | |
parent | 4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (diff) | |
download | vcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.tar.gz vcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.tar.bz2 vcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.zip |
svn merge file:///D:/svnrepos/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/glx/glxdri.c')
-rw-r--r-- | xorg-server/glx/glxdri.c | 74 |
1 files changed, 51 insertions, 23 deletions
diff --git a/xorg-server/glx/glxdri.c b/xorg-server/glx/glxdri.c index f76a0ce44..ca868d2fc 100644 --- a/xorg-server/glx/glxdri.c +++ b/xorg-server/glx/glxdri.c @@ -106,7 +106,7 @@ struct __GLXDRIdrawable { #ifdef __DRI_TEX_OFFSET GLint texname; __GLXDRIcontext *ctx; - unsigned long offset; + unsigned long long offset; DamagePtr pDamage; #endif }; @@ -241,16 +241,9 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable) __glXleaveServer(GL_FALSE); } - xfree(private); -} + __glXDrawableRelease(drawable); -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; + xfree(private); } static GLboolean @@ -375,6 +368,21 @@ glxFillAlphaChannel (CARD32 *pixels, CARD32 rowstride, int width, int height) } } +static Bool +testTexOffset(__GLXDRIscreen * const screen, PixmapPtr pPixmap) +{ + Bool ret; + + if (!screen->texOffsetStart || !screen->texOffset) + return FALSE; + + __glXenterServer(GL_FALSE); + ret = screen->texOffsetStart(pPixmap) != ~0ULL; + __glXleaveServer(GL_FALSE); + + return ret; +} + /* * (sticking this here for lack of a better place) * Known issues with the GLX_EXT_texture_from_pixmap implementation: @@ -410,7 +418,7 @@ __glXDRIbindTexImage(__GLXcontext *baseContext, pixmap = (PixmapPtr) glxPixmap->pDraw; - if (screen->texOffsetStart && screen->texOffset) { + if (testTexOffset(screen, pixmap)) { __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride; int i, firstEmpty = 16; @@ -627,11 +635,10 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, if (baseShareContext && baseShareContext->isDirect) return NULL; - context = xalloc(sizeof *context); + context = xcalloc(1, sizeof *context); if (context == NULL) return NULL; - memset(context, 0, sizeof *context); context->base.destroy = __glXDRIcontextDestroy; context->base.makeCurrent = __glXDRIcontextMakeCurrent; context->base.loseCurrent = __glXDRIcontextLoseCurrent; @@ -645,7 +652,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, if (visual->vid == glxConfig->visualID) break; if (i == pScreen->numVisuals) - return GL_FALSE; + return NULL; context->hwContextID = FakeClientID(0); @@ -654,6 +661,9 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, context->hwContextID, &hwContext); __glXleaveServer(GL_FALSE); + if (!retval) + return NULL; + context->driContext = screen->legacy->createNewContext(screen->driScreen, config->driConfig, @@ -686,12 +696,10 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, GLboolean retval; drm_drawable_t hwDrawable; - private = xalloc(sizeof *private); + private = xcalloc(1, sizeof *private); if (private == NULL) return NULL; - memset(private, 0, sizeof *private); - if (!__glXDrawableInit(&private->base, screen, pDraw, type, drawId, glxConfig)) { xfree(private); @@ -699,15 +707,21 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, } private->base.destroy = __glXDRIdrawableDestroy; - private->base.resize = __glXDRIdrawableResize; private->base.swapBuffers = __glXDRIdrawableSwapBuffers; private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer; + private->base.waitX = NULL; + private->base.waitGL = NULL; __glXenterServer(GL_FALSE); retval = DRICreateDrawable(screen->pScreen, serverClient, pDraw, &hwDrawable); __glXleaveServer(GL_FALSE); + if (!retval) { + xfree(private); + return NULL; + } + /* The last argument is 'attrs', which is used with pbuffers which * we currently don't support. */ @@ -755,7 +769,7 @@ getDrawableInfo(__DRIdrawable *driDrawable, numBackClipRects, &pBackClipRects); __glXleaveServer(GL_FALSE); - if (*numClipRects > 0) { + if (retval && *numClipRects > 0) { size = sizeof (drm_clip_rect_t) * *numClipRects; *ppClipRects = xalloc (size); @@ -786,16 +800,20 @@ getDrawableInfo(__DRIdrawable *driDrawable, } else { *ppClipRects = NULL; + *numClipRects = 0; } - if (*numBackClipRects > 0) { + if (retval && *numBackClipRects > 0) { size = sizeof (drm_clip_rect_t) * *numBackClipRects; *ppBackClipRects = xalloc (size); if (*ppBackClipRects != NULL) memcpy (*ppBackClipRects, pBackClipRects, size); + else + *numBackClipRects = 0; } else { *ppBackClipRects = NULL; + *numBackClipRects = 0; } return retval; @@ -815,7 +833,9 @@ static void __glXReportDamage(__DRIdrawable *driDraw, REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, num_rects); REGION_TRANSLATE(pScreen, ®ion, pDraw->x, pDraw->y); - DamageDamageRegion(pDraw, ®ion); + DamageRegionAppend(pDraw, ®ion); + /* This is wrong, this needs a seperate function. */ + DamageRegionProcessPending(pDraw); REGION_UNINIT(pDraw->pScreen, ®ion); __glXleaveServer(GL_FALSE); @@ -880,6 +900,15 @@ initializeExtensions(__GLXDRIscreen *screen) extensions = screen->core->getExtensions(screen->driScreen); 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"); + } +#endif + #ifdef __DRI_COPY_SUB_BUFFER if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) { screen->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i]; @@ -950,10 +979,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen) return NULL; } - screen = xalloc(sizeof *screen); + screen = xcalloc(1, sizeof *screen); if (screen == NULL) return NULL; - memset(screen, 0, sizeof *screen); screen->base.destroy = __glXDRIscreenDestroy; screen->base.createContext = __glXDRIscreenCreateContext; |