diff options
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/dri2.c | 31 | ||||
-rw-r--r-- | src/glx/dri2_glx.c | 42 | ||||
-rw-r--r-- | src/glx/dri_glx.c | 1 | ||||
-rw-r--r-- | src/glx/glx_pbuffer.c | 4 | ||||
-rw-r--r-- | src/glx/glxclient.h | 6 | ||||
-rw-r--r-- | src/glx/glxcmds.c | 4 |
6 files changed, 63 insertions, 25 deletions
diff --git a/src/glx/dri2.c b/src/glx/dri2.c index 91053d3fb6..5de55cdbf2 100644 --- a/src/glx/dri2.c +++ b/src/glx/dri2.c @@ -81,15 +81,13 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, dri2Info, dri2ExtensionName, &dri2ExtensionHooks, - 1, NULL) + 0, NULL) static Bool DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) { XExtDisplayInfo *info = DRI2FindDisplay(dpy); XExtDisplayInfo *glx_info = __glXFindDisplay(dpy); - static int glx_event_base; - static Bool found_glx_info = False; XextCheckExtension(dpy, info, dri2ExtensionName, False); @@ -126,7 +124,15 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) return True; } #endif +#ifdef DRI2_InvalidateBuffers + case DRI2_InvalidateBuffers: + { + xDRI2InvalidateBuffers *awire = (xDRI2InvalidateBuffers *)wire; + dri2InvalidateBuffers(dpy, awire->drawable); + return False; + } +#endif default: /* client doesn't support server event */ break; @@ -174,6 +180,7 @@ DRI2QueryVersion(Display * dpy, int *major, int *minor) XExtDisplayInfo *info = DRI2FindDisplay(dpy); xDRI2QueryVersionReply rep; xDRI2QueryVersionReq *req; + int i, nevents; XextCheckExtension(dpy, info, dri2ExtensionName, False); @@ -193,6 +200,24 @@ DRI2QueryVersion(Display * dpy, int *major, int *minor) UnlockDisplay(dpy); SyncHandle(); + switch (rep.minorVersion) { + case 1: + nevents = 0; + break; + case 2: + nevents = 1; + break; + case 3: + default: + nevents = 2; + break; + } + + for (i = 0; i < nevents; i++) { + XESetWireToEvent (dpy, info->codes->first_event + i, DRI2WireToEvent); + XESetEventToWire (dpy, info->codes->first_event + i, DRI2EventToWire); + } + return True; } diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 15a3ea5907..29d589cdb9 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -67,6 +67,7 @@ struct __GLXDRIdisplayPrivateRec int driMinor; int driPatch; int swapAvailable; + int invalidateAvailable; }; struct __GLXDRIcontextPrivateRec @@ -310,12 +311,18 @@ dri2WaitGL(__GLXDRIdrawable * pdraw) XFixesDestroyRegion(pdraw->psc->dpy, region); } - static void -dri2FlushFrontBuffer(__DRIdrawable * driDrawable, void *loaderPrivate) +dri2FlushFrontBuffer(__DRIdrawable *driDrawable, void *loaderPrivate) { - (void) driDrawable; - dri2WaitGL((__GLXDRIdrawable *) loaderPrivate); + __GLXDRIdrawablePrivate *pdraw = loaderPrivate; + __GLXdisplayPrivate *priv = __glXInitialize(pdraw->base.psc->dpy); + __GLXDRIdisplayPrivate *pdp = (__GLXDRIdisplayPrivate *)priv->dri2Display; + + /* Old servers don't send invalidate events */ + if (!pdp->invalidateAvailable) + dri2InvalidateBuffers(priv->dpy, pdraw->base.xDrawable); + + dri2WaitGL(loaderPrivate); } @@ -375,6 +382,10 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, (*pdraw->psc->f->flush)(pdraw->driDrawable); #endif + /* Old servers don't send invalidate events */ + if (!pdp->invalidateAvailable) + dri2InvalidateBuffers(dpyPriv->dpy, pdraw->xDrawable); + /* Old servers can't handle swapbuffers */ if (!pdp->swapAvailable) { dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height); @@ -386,11 +397,6 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, remainder, &ret); #endif -#if __DRI2_FLUSH_VERSION >= 2 - if (pdraw->psc->f) - (*pdraw->psc->f->flushInvalidate)(pdraw->driDrawable); -#endif - return ret; } @@ -485,6 +491,17 @@ static const __DRIextension *loader_extensions_old[] = { NULL }; +_X_HIDDEN void +dri2InvalidateBuffers(Display *dpy, XID drawable) +{ + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL); + +#if __DRI2_FLUSH_VERSION >= 3 + if (pdraw && pdraw->psc->f) + pdraw->psc->f->invalidate(pdraw->driDrawable); +#endif +} + static __GLXDRIscreen * dri2CreateScreen(__GLXscreenConfigs * psc, int screen, __GLXdisplayPrivate * priv) @@ -651,11 +668,8 @@ dri2CreateDisplay(Display * dpy) } pdp->driPatch = 0; - pdp->swapAvailable = 0; -#ifdef X_DRI2SwapBuffers - if (pdp->driMinor >= 2) - pdp->swapAvailable = 1; -#endif + pdp->swapAvailable = (pdp->driMinor >= 2); + pdp->invalidateAvailable = (pdp->driMinor >= 3); pdp->base.destroyDisplay = dri2DestroyDisplay; pdp->base.createScreen = dri2CreateScreen; diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c index 0ff53c324f..f9fe9a25db 100644 --- a/src/glx/dri_glx.c +++ b/src/glx/dri_glx.c @@ -323,6 +323,7 @@ CallCreateNewScreen(Display * dpy, int scrn, __GLXscreenConfigs * psc, framebuffer.base = MAP_FAILED; framebuffer.dev_priv = NULL; + framebuffer.size = 0; if (!XF86DRIOpenConnection(dpy, scrn, &hSAREA, &BusID)) { ErrorMessageF("XF86DRIOpenConnection failed\n"); diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c index a0a02238b0..4c122ba6dd 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -186,10 +186,6 @@ DestroyPbuffer(Display * dpy, GLXDrawable drawable) #ifdef GLX_DIRECT_RENDERING -extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy, - GLXDrawable drawable, - int *const scrn_num); - static GLenum determineTextureTarget(const int *attribs, int numAttribs) { diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index e0b286b688..04ce781c43 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -182,6 +182,8 @@ struct __GLXDRIdrawableRec extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy); extern __GLXDRIdisplay *driCreateDisplay(Display * dpy); extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy); +extern void dri2InvalidateBuffers(Display *dpy, XID drawable); + extern void DRI_glXUseXFont(Font font, int first, int count, int listbase); @@ -798,6 +800,10 @@ __driGetMscRateOML(__DRIdrawable * draw, /* So that dri2.c:DRI2WireToEvent() can access * glx_info->codes->first_event */ XExtDisplayInfo *__glXFindDisplay (Display *dpy); + +extern __GLXDRIdrawable * +GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable, int *const scrn_num); + #endif #endif /* !__GLX_client_h__ */ diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 706d63b36b..704e9a0b9d 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -110,10 +110,6 @@ GarbageCollectDRIDrawables(Display * dpy, __GLXscreenConfigs * sc) XSetErrorHandler(oldXErrorHandler); } -extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy, - GLXDrawable drawable, - int *const scrn_num); - /** * Get the __DRIdrawable for the drawable associated with a GLXContext * |