From: Francisco J. <cur...@ri...> - 2010-02-08 18:25:28
|
Executed from the ConfigureWindow request, right before sending ConfigureNotify to the clients. This commit breaks the ScreenRec ABI. Signed-off-by: Francisco Jerez <cur...@ri...> --- dix/window.c | 4 ++++ hw/xfree86/common/xf86Module.h | 6 +++--- include/scrnintstr.h | 10 ++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dix/window.c b/dix/window.c index caff1cb..d9836e1 100644 --- a/dix/window.c +++ b/dix/window.c @@ -2303,6 +2303,10 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) return(Success); ActuallyDoSomething: + if (pWin->drawable.pScreen->PreConfigureWindow) + (*pWin->drawable.pScreen->PreConfigureWindow)(pWin, x, y, + w, h, bw, pSib); + if (SubStrSend(pWin, pParent)) { memset(&event, 0, sizeof(xEvent)); diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index bbf5786..d61758f 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -82,9 +82,9 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(7, 0) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(9, 0) -#define ABI_EXTENSION_VERSION SET_ABI_VERSION(3, 0) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(8, 0) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(10, 0) +#define ABI_EXTENSION_VERSION SET_ABI_VERSION(4, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) #define MODINFOSTRING1 0xef23fdc5 diff --git a/include/scrnintstr.h b/include/scrnintstr.h index ab50e7a..467b61c 100644 --- a/include/scrnintstr.h +++ b/include/scrnintstr.h @@ -399,6 +399,15 @@ typedef void (* PostChangeSaveUnderProcPtr)( WindowPtr /*pLayerWin*/, WindowPtr /*firstChild*/); +typedef void (* PreConfigureWindowProcPtr)( + WindowPtr /*pWin*/, + int /*x*/, + int /*y*/, + int /*w*/, + int /*h*/, + int /*bw*/, + WindowPtr /*pSib*/); + typedef void (* MoveWindowProcPtr)( WindowPtr /*pWin*/, int /*x*/, @@ -581,6 +590,7 @@ typedef struct _Screen { MarkOverlappedWindowsProcPtr MarkOverlappedWindows; ChangeSaveUnderProcPtr ChangeSaveUnder; PostChangeSaveUnderProcPtr PostChangeSaveUnder; + PreConfigureWindowProcPtr PreConfigureWindow; MoveWindowProcPtr MoveWindow; ResizeWindowProcPtr ResizeWindow; GetLayerWindowProcPtr GetLayerWindow; -- 1.6.4.4 |
From: Francisco J. <cur...@ri...> - 2010-02-08 18:25:32
|
Signed-off-by: Francisco Jerez <cur...@ri...> --- glx/glxdri2.c | 28 +++++++++++++++++++++++++--- 1 files changed, 25 insertions(+), 3 deletions(-) diff --git a/glx/glxdri2.c b/glx/glxdri2.c index 0f998de..dae7b42 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -67,6 +67,7 @@ struct __GLXDRIscreen { xf86EnterVTProc *enterVT; xf86LeaveVTProc *leaveVT; + PreConfigureWindowProcPtr PreConfigureWindow; const __DRIcoreExtension *core; const __DRIdri2Extension *dri2; @@ -217,13 +218,13 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable) __GLXDRIscreen *screen = priv->screen; CARD64 unused; - if (screen->flush) - (*screen->flush->flushInvalidate)(priv->driDrawable); - if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, __glXdriSwapEvent, drawable->pDraw) != Success) return FALSE; + if (screen->flush) + (*screen->flush->invalidate)(priv->driDrawable); + return TRUE; } @@ -607,6 +608,24 @@ glxDRILeaveVT (int index, int flags) } static void +glxDRIPreConfigureWindow(WindowPtr pWin, int x, int y, int w, int h, int bw, + WindowPtr pSib) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + __GLXDRIscreen *screen = (__GLXDRIscreen *)glxGetScreen(pScreen); + __GLXDRIdrawable *draw = (__GLXDRIdrawable *)glxGetDrawableFromWindow(pWin); + + if (screen->PreConfigureWindow) + (*screen->PreConfigureWindow)(pWin, x, y, w, h, bw, pSib); + + if (!draw || (draw->height == h && draw->width == w)) + return; + + if (screen->flush) + screen->flush->invalidate(draw->driDrawable); +} + +static void initializeExtensions(__GLXDRIscreen *screen) { const __DRIextension **extensions; @@ -782,6 +801,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen) screen->leaveVT = pScrn->LeaveVT; pScrn->LeaveVT = glxDRILeaveVT; + screen->PreConfigureWindow = pScreen->PreConfigureWindow; + pScreen->PreConfigureWindow = glxDRIPreConfigureWindow; + LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", filename); -- 1.6.4.4 |
From: Francisco J. <cur...@ri...> - 2010-02-08 18:25:35
|
Bumps the supported DRI2 protocol version. Signed-off-by: Francisco Jerez <cur...@ri...> --- configure.ac | 2 +- hw/xfree86/dri2/dri2.c | 109 +++++++++++++++++++++++++++++++++++++++++++ hw/xfree86/dri2/dri2.h | 5 ++ hw/xfree86/dri2/dri2ext.c | 35 ++++++++++++-- include/protocol-versions.h | 2 +- 5 files changed, 147 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index ec9442b..efd54a5 100644 --- a/configure.ac +++ b/configure.ac @@ -752,7 +752,7 @@ RECORDPROTO="recordproto >= 1.13.99.1" SCRNSAVERPROTO="scrnsaverproto >= 1.1" RESOURCEPROTO="resourceproto" DRIPROTO="xf86driproto >= 2.1.0" -DRI2PROTO="dri2proto >= 2.2" +DRI2PROTO="dri2proto >= 2.3" XINERAMAPROTO="xineramaproto" BIGFONTPROTO="xf86bigfontproto >= 1.2.0" XCALIBRATEPROTO="xcalibrateproto" diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 48618e1..3099ad8 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -52,6 +52,13 @@ static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKeyIndex; static int dri2PixmapPrivateKeyIndex; static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKeyIndex; +typedef struct _DRI2ClientRef *DRI2ClientRefPtr; + +struct _DRI2ClientRef { + DRI2ClientRefPtr next; + XID resource; +}; + typedef struct _DRI2Drawable { unsigned int refCount; int width; @@ -65,6 +72,8 @@ typedef struct _DRI2Drawable { CARD64 target_sbc; /* -1 means no SBC wait outstanding */ CARD64 last_swap_target; /* most recently queued swap target */ int swap_limit; /* for N-buffering */ + DRI2ClientRefPtr track_clients; /* Clients to notify on drawable changes. */ + } DRI2DrawableRec, *DRI2DrawablePtr; typedef struct _DRI2Screen *DRI2ScreenPtr; @@ -84,6 +93,8 @@ typedef struct _DRI2Screen { DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC; HandleExposuresProcPtr HandleExposures; + + PreConfigureWindowProcPtr PreConfigureWindow; } DRI2ScreenRec; static DRI2ScreenPtr @@ -143,6 +154,7 @@ DRI2CreateDrawable(DrawablePtr pDraw) pPriv->swap_interval = 1; pPriv->last_swap_target = -1; pPriv->swap_limit = 1; /* default to double buffering */ + pPriv->track_clients = NULL; if (pDraw->type == DRAWABLE_WINDOW) { @@ -405,6 +417,78 @@ DRI2BlockClient(ClientPtr client, DrawablePtr pDraw) } } +extern RESTYPE dri2DrawableRes; + +int +DRI2TrackClient(DrawablePtr pDraw, int id) +{ + DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); + DRI2ClientRefPtr ref; + + if (pPriv == NULL) + return BadDrawable; + + /* Check if the client is already in. */ + for (ref = pPriv->track_clients; ref; ref = ref->next) { + if (CLIENT_ID(ref->resource) == id) + return Success; + } + + /* Allocate a client ref. */ + ref = xalloc(sizeof(*ref)); + if (ref == NULL) + return BadAlloc; + + ref->next = pPriv->track_clients; + pPriv->track_clients = ref; + + /* Allocate a resource for it. */ + ref->resource = FakeClientID(id); + if (!AddResource(ref->resource, dri2DrawableRes, pDraw)) + return BadAlloc; + + return Success; +} + +void +DRI2UntrackClient(DrawablePtr pDraw, int id) +{ + DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); + DRI2ClientRefPtr ref, *prev; + + if (pPriv == NULL) + return; + + prev = &pPriv->track_clients; + + for (ref = *prev; ref; prev = &ref->next, ref = ref->next) { + if (CLIENT_ID(ref->resource) == id) { + *prev = ref->next; + xfree(ref); + break; + } + } +} + +void +DRI2InvalidateDrawable(DrawablePtr pDraw) +{ + DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); + DRI2ClientRefPtr ref; + + if (pPriv == NULL) + return; + + while ((ref = pPriv->track_clients)) { + ClientPtr client = clients[CLIENT_ID(ref->resource)]; + + FreeResource(ref->resource, RT_NONE); + + if (client && !client->clientGone) + DRI2InvalidateBuffersEvent(pDraw, client); + } +} + int DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion, unsigned int dest, unsigned int src) @@ -758,6 +842,7 @@ DRI2DestroyDrawable(DrawablePtr pDraw) { DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); DRI2DrawablePtr pPriv; + DRI2ClientRefPtr ref; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) @@ -776,6 +861,9 @@ DRI2DestroyDrawable(DrawablePtr pDraw) xfree(pPriv->buffers); } + while ((ref = pPriv->track_clients)) + FreeResource(ref->resource, RT_NONE); + /* If the window is destroyed while we have a swap pending, don't * actually free the priv yet. We'll need it in the DRI2SwapComplete() * callback and we'll free it there once we're done. */ @@ -811,6 +899,24 @@ DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic) return TRUE; } +static void +DRI2PreConfigureWindow(WindowPtr pWin, int x, int y, int w, int h, int bw, + WindowPtr pSib) +{ + DrawablePtr pDraw = (DrawablePtr)pWin; + ScreenPtr pScreen = pDraw->pScreen; + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + DRI2DrawablePtr dd = DRI2GetDrawable(pDraw); + + if (ds->PreConfigureWindow) + (*ds->PreConfigureWindow)(pWin, x, y, w, h, bw, pSib); + + if (!dd || (dd->width == w && dd->height == h)) + return; + + DRI2InvalidateDrawable(pDraw); +} + Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) { @@ -869,6 +975,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds); + ds->PreConfigureWindow = pScreen->PreConfigureWindow; + pScreen->PreConfigureWindow = DRI2PreConfigureWindow; + xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n"); for (i = 0; i < sizeof(driverTypeNames) / sizeof(driverTypeNames[0]); i++) { if (i < ds->numDrivers && ds->driverNames[i]) { diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index 1c8626b..59bab70 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -265,4 +265,9 @@ extern _X_EXPORT void DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw, int frame, unsigned int tv_sec, unsigned int tv_usec); +extern _X_EXPORT int DRI2TrackClient(DrawablePtr pDraw, int id); +extern _X_EXPORT void DRI2UntrackClient(DrawablePtr pDraw, int id); +extern _X_EXPORT void DRI2InvalidateBuffersEvent(DrawablePtr pDraw, ClientPtr client); +extern _X_EXPORT void DRI2InvalidateDrawable(DrawablePtr pDraw); + #endif diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index 3e6b03e..713c82e 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -51,7 +51,7 @@ #include "xf86Module.h" static ExtensionEntry *dri2Extension; -static RESTYPE dri2DrawableRes; +RESTYPE dri2DrawableRes; static Bool validDrawable(ClientPtr client, XID drawable, Mask access_mode, @@ -266,6 +266,9 @@ ProcDRI2GetBuffers(ClientPtr client) buffers = DRI2GetBuffers(pDrawable, &width, &height, attachments, stuff->count, &count); + status = DRI2TrackClient(pDrawable, client->index); + if (status) + return status; send_buffers_reply(client, pDrawable, buffers, count, width, height); @@ -293,6 +296,10 @@ ProcDRI2GetBuffersWithFormat(ClientPtr client) buffers = DRI2GetBuffersWithFormat(pDrawable, &width, &height, attachments, stuff->count, &count); + status = DRI2TrackClient(pDrawable, client->index); + if (status) + return status; + send_buffers_reply(client, pDrawable, buffers, count, width, height); return client->noClientException; @@ -367,6 +374,18 @@ DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc, WriteEventsToClient(client, 1, (xEvent *)&event); } +void +DRI2InvalidateBuffersEvent(DrawablePtr pDraw, ClientPtr client) +{ + xDRI2InvalidateBuffers event; + + event.type = DRI2EventBase + DRI2_InvalidateBuffers; + event.sequenceNumber = client->sequence; + event.drawable = pDraw->id; + + WriteEventsToClient(client, 1, (xEvent *)&event); +} + static int ProcDRI2SwapBuffers(ClientPtr client) { @@ -391,6 +410,8 @@ ProcDRI2SwapBuffers(ClientPtr client) if (status != Success) return BadDrawable; + DRI2InvalidateDrawable(pDrawable); + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -618,11 +639,17 @@ SProcDRI2Dispatch (ClientPtr client) } } -static int DRI2DrawableGone(pointer p, XID id) +static int +DRI2DrawableGone(pointer p, XID id) { - DrawablePtr pDrawable = p; + DrawablePtr pDraw = p; - DRI2DestroyDrawable(pDrawable); + if (pDraw->id != id) { + /* Secondary reference. */ + DRI2UntrackClient(pDraw, CLIENT_ID(id)); + } else { + DRI2DestroyDrawable(pDraw); + } return Success; } diff --git a/include/protocol-versions.h b/include/protocol-versions.h index c74b7fa..c425eef 100644 --- a/include/protocol-versions.h +++ b/include/protocol-versions.h @@ -53,7 +53,7 @@ /* DRI2 */ #define SERVER_DRI2_MAJOR_VERSION 1 -#define SERVER_DRI2_MINOR_VERSION 2 +#define SERVER_DRI2_MINOR_VERSION 3 /* Generic event extension */ #define SERVER_GE_MAJOR_VERSION 1 -- 1.6.4.4 |
From: Francisco J. <cur...@ri...> - 2010-02-08 18:28:08
|
When a buffer invalidation event is received from the X server, the "invalidate" hook of the DRI2 flush extension is executed: A generic implementation (dri2InvalidateDrawable) is provided that just bumps the "pStamp" sequence number in __DRIdrawableRec. For old servers not supporting buffer invalidation events, the invalidate hook will be called before flushing the fake front/back buffer (that's typically once per frame -- not a lot worse than the situation we were in before). No effort has been made on preserving backwards compatibility with version 2 of the flush extension, but I think it's acceptable because AFAIK no released stack is making use of it. Note that this bumps the required dri2proto version to 2.3. --- v4: Drop flush v2 compatibility as the intel driver has stopped using it for throttling. #ifdef part of the code to make it easier to build with older protocol headers, along the lines of 01923fb72d. configure.ac | 2 +- include/GL/internal/dri_interface.h | 14 ++++----- src/glx/x11/dri2.c | 10 +++++- src/glx/x11/dri2.h | 3 ++ src/glx/x11/dri2_glx.c | 42 +++++++++++++++++-------- src/glx/x11/glx_pbuffer.c | 4 -- src/glx/x11/glxclient.h | 4 ++ src/glx/x11/glxcmds.c | 4 -- src/mesa/drivers/dri/common/dri_util.c | 15 ++++++++- src/mesa/drivers/dri/common/dri_util.h | 8 +++-- src/mesa/drivers/dri/intel/intel_context.c | 1 - src/mesa/drivers/dri/intel/intel_screen.c | 10 ++---- src/mesa/drivers/dri/intel/intel_tex_image.c | 4 ++- 13 files changed, 76 insertions(+), 45 deletions(-) diff --git a/configure.ac b/configure.ac index b6c6535..d92d99a 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ AC_CANONICAL_HOST dnl Versions for external dependencies LIBDRM_REQUIRED=2.4.15 LIBDRM_RADEON_REQUIRED=2.4.17 -DRI2PROTO_REQUIRED=2.2 +DRI2PROTO_REQUIRED=2.3 GLPROTO_REQUIRED=1.4.11 dnl Check for progs diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index ec6238f..6399787 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -262,22 +262,20 @@ struct __DRItexBufferExtensionRec { * Used by drivers that implement DRI2 */ #define __DRI2_FLUSH "DRI2_Flush" -#define __DRI2_FLUSH_VERSION 2 +#define __DRI2_FLUSH_VERSION 3 struct __DRI2flushExtensionRec { __DRIextension base; void (*flush)(__DRIdrawable *drawable); /** - * Flush all rendering queue in the driver to the drm and - * invalidate all buffers. The driver will call out to - * getBuffers/getBuffersWithFormat before it starts rendering - * again. + * Ask the driver to call getBuffers/getBuffersWithFormat before + * it starts rendering again. * - * \param drawable the drawable to flush and invalidate + * \param drawable the drawable to invalidate * - * \since 2 + * \since 3 */ - void (*flushInvalidate)(__DRIdrawable *drawable); + void (*invalidate)(__DRIdrawable *drawable); }; diff --git a/src/glx/x11/dri2.c b/src/glx/x11/dri2.c index 91053d3..e692c8c 100644 --- a/src/glx/x11/dri2.c +++ b/src/glx/x11/dri2.c @@ -81,7 +81,7 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, dri2Info, dri2ExtensionName, &dri2ExtensionHooks, - 1, NULL) + DRI2NumberEvents, NULL) static Bool DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) @@ -126,7 +126,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; diff --git a/src/glx/x11/dri2.h b/src/glx/x11/dri2.h index 114e9f8..943ac59 100644 --- a/src/glx/x11/dri2.h +++ b/src/glx/x11/dri2.h @@ -103,4 +103,7 @@ DRI2WaitSBC(Display *dpy, XID drawable, CARD64 target_sbc, CARD64 *ust, extern void DRI2SwapInterval(Display *dpy, XID drawable, int interval); +extern void +DRI2InvalidateBuffers(Display *dpy, XID drawable); + #endif diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c index 6200df9..736cd3a 100644 --- a/src/glx/x11/dri2_glx.c +++ b/src/glx/x11/dri2_glx.c @@ -66,6 +66,7 @@ struct __GLXDRIdisplayPrivateRec int driMinor; int driPatch; int swapAvailable; + int invalidateAvailable; }; struct __GLXDRIcontextPrivateRec @@ -309,12 +310,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); } @@ -374,6 +381,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); @@ -385,11 +396,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; } @@ -484,6 +490,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) @@ -650,11 +667,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/x11/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c index a0a0223..4c122ba 100644 --- a/src/glx/x11/glx_pbuffer.c +++ b/src/glx/x11/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/x11/glxclient.h b/src/glx/x11/glxclient.h index e0b286b..f88e9fb 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -798,6 +798,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/x11/glxcmds.c b/src/glx/x11/glxcmds.c index c3be974..da0dcf1 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -105,10 +105,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 * diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 3649c29..705681e 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -454,7 +454,6 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config, pdp->driScreenPriv = psp; pdp->driContextPriv = &psp->dummyContextPriv; - pdp->validBuffers = GL_FALSE; if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes, renderType == GLX_PIXMAP_BIT)) { @@ -488,6 +487,9 @@ dri2CreateNewDrawable(__DRIscreen *screen, pdraw->pClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects); pdraw->pBackClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects); + pdraw->pStamp = _mesa_malloc(sizeof(unsigned int)); + *pdraw->pStamp = pdraw->lastStamp + 1; + return pdraw; } @@ -515,6 +517,11 @@ static void dri_put_drawable(__DRIdrawable *pdp) _mesa_free(pdp->pBackClipRects); pdp->pBackClipRects = NULL; } + if (psp->dri2.enabled && pdp->pStamp) { + _mesa_free(pdp->pStamp); + pdp->pStamp = NULL; + + } _mesa_free(pdp); } } @@ -948,4 +955,10 @@ driCalculateSwapUsage( __DRIdrawable *dPriv, int64_t last_swap_ust, return usage; } +void +dri2InvalidateDrawable(__DRIdrawable *drawable) +{ + (*drawable->pStamp)++; +} + /*@}*/ diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 95df702..d473091 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -295,7 +295,8 @@ struct __DRIdrawableRec { unsigned int index; /** - * Pointer to the "drawable has changed ID" stamp in the SAREA. + * Pointer to the "drawable has changed ID" stamp in the SAREA (or + * in malloc'ed memory if DRI2 is being used). */ unsigned int *pStamp; @@ -376,8 +377,6 @@ struct __DRIdrawableRec { * GLX_MESA_swap_control. */ unsigned int swap_interval; - - GLboolean validBuffers; }; /** @@ -550,4 +549,7 @@ driCalculateSwapUsage( __DRIdrawable *dPriv, extern GLint driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ); +extern void +dri2InvalidateDrawable(__DRIdrawable *drawable); + #endif /* _DRI_UTIL_H_ */ diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 0adee61..a83e949 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -373,7 +373,6 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) } } - drawable->validBuffers = GL_TRUE; driUpdateFramebufferSize(&intel->ctx, drawable); } diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index c9ef164..090cef6 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -122,22 +122,18 @@ intelDRI2Flush(__DRIdrawable *drawable) } static void -intelDRI2FlushInvalidate(__DRIdrawable *drawable) +intelDRI2Invalidate(__DRIdrawable *drawable) { struct intel_context *intel = drawable->driContextPriv->driverPrivate; intel->using_dri2_swapbuffers = GL_TRUE; - - intelDRI2Flush(drawable); - drawable->validBuffers = GL_FALSE; - - intel_update_renderbuffers(intel->driContext, drawable); + dri2InvalidateDrawable(drawable); } static const struct __DRI2flushExtensionRec intelFlushExtension = { { __DRI2_FLUSH, __DRI2_FLUSH_VERSION }, intelDRI2Flush, - intelDRI2FlushInvalidate, + intelDRI2Invalidate, }; static const __DRIextension *intelScreenExtensions[] = { diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 6402141..8de4e50 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -748,8 +748,10 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, if (!intelObj) return; - if (!dPriv->validBuffers) + if (dPriv->lastStamp != *dPriv->pStamp) { + dPriv->lastStamp = *dPriv->pStamp; intel_update_renderbuffers(pDRICtx, dPriv); + } rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT); /* If the region isn't set, then intel_update_renderbuffers was unable -- 1.6.4.4 |
From: Julien C. <jcr...@de...> - 2010-02-16 12:54:19
|
On Mon, Feb 8, 2010 at 19:27:56 +0100, Francisco Jerez wrote: > diff --git a/src/glx/x11/dri2.c b/src/glx/x11/dri2.c > index 91053d3..e692c8c 100644 > --- a/src/glx/x11/dri2.c > +++ b/src/glx/x11/dri2.c > @@ -81,7 +81,7 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, > dri2Info, > dri2ExtensionName, > &dri2ExtensionHooks, > - 1, NULL) > + DRI2NumberEvents, NULL) > This is buggy. It registers 2 dri2 events in Xlib, even though the server might only know about one, and thus use the next event code for a different extension. See http://lists.freedesktop.org/pipermail/xorg/2009-November/048184.html Cheers, Julien |
From: Francisco J. <cur...@ri...> - 2010-02-08 18:28:11
|
--- src/mesa/drivers/dri/nouveau/nouveau_context.c | 33 +++++++++++++++++++++--- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 12 ++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index b87b8db..6117f68 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -140,6 +140,8 @@ nouveau_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable, __DRIbuffer *buffers = NULL; int i = 0, count, ret; + *stamp = *drawable->pStamp; + attachments[i++] = __DRI_BUFFER_FRONT_LEFT; if (fb->Visual.doubleBufferMode) attachments[i++] = __DRI_BUFFER_BACK_LEFT; @@ -218,10 +220,11 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, __DRIdrawable *dri_draw, struct nouveau_context *nctx = dri_ctx->driverPrivate; GLcontext *ctx = &nctx->base; - if (nctx->screen->context != nctx) { - nctx->screen->context = nctx; - BITSET_ONES(nctx->dirty); - } + if (nctx->screen->context == nctx) + return GL_TRUE; + + nctx->screen->context = nctx; + BITSET_ONES(nctx->dirty); /* Ask the X server for new renderbuffers. */ nouveau_update_renderbuffers(dri_ctx, dri_draw, @@ -267,6 +270,28 @@ void nouveau_validate_framebuffer(GLcontext *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); + __DRIcontext *dri_ctx = to_nouveau_context(ctx)->dri_context; + __DRIdrawable *dri_draw = dri_ctx->driDrawablePriv; + __DRIdrawable *dri_read = dri_ctx->driReadablePriv; + + if ((ctx->DrawBuffer->Name == 0 && + nctx->drawable.d_stamp != *dri_draw->pStamp) || + (dri_draw != dri_read && + ctx->ReadBuffer->Name == 0 && + nctx->drawable.r_stamp != *dri_read->pStamp)) { + if (nctx->drawable.dirty) + ctx->Driver.Flush(ctx); + + /* Ask the X server for new renderbuffers. */ + nouveau_update_renderbuffers(dri_ctx, dri_draw, + &nctx->drawable.d_stamp); + if (dri_draw != dri_read) + nouveau_update_renderbuffers(dri_ctx, dri_read, + &nctx->drawable.r_stamp); + + if (nouveau_next_dirty_state(ctx) >= 0) + FIRE_RING(context_chan(ctx)); + } /* Someone's planning to draw something really soon. */ nctx->drawable.dirty = GL_TRUE; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index de63282..b70d1f3 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -246,7 +246,19 @@ nouveau_destroy_buffer(__DRIdrawable *drawable) (struct gl_framebuffer **)&drawable->driverPrivate, NULL); } +static void +nouveau_drawable_flush(__DRIdrawable *draw) +{ +} + +static const struct __DRI2flushExtensionRec nouveau_flush_extension = { + { __DRI2_FLUSH, __DRI2_FLUSH_VERSION }, + nouveau_drawable_flush, + dri2InvalidateDrawable, +}; + static const __DRIextension *nouveau_screen_extensions[] = { + &nouveau_flush_extension.base, NULL }; -- 1.6.4.4 |
From: Francisco J. <cur...@ri...> - 2010-02-08 18:28:12
|
--- src/gallium/state_trackers/dri/dri_context.c | 6 +-- src/gallium/state_trackers/dri/dri_drawable.c | 13 ++++++ src/gallium/state_trackers/dri/dri_screen.c | 12 ++++++ src/mesa/SConscript | 1 - src/mesa/sources.mak | 1 - src/mesa/state_tracker/st_atom.c | 7 +++- src/mesa/state_tracker/st_cb_viewport.c | 50 ------------------------- src/mesa/state_tracker/st_cb_viewport.h | 29 -------------- src/mesa/state_tracker/st_context.c | 2 - 9 files changed, 33 insertions(+), 88 deletions(-) delete mode 100644 src/mesa/state_tracker/st_cb_viewport.c delete mode 100644 src/mesa/state_tracker/st_cb_viewport.h diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c index 6edbd9d..90ede35 100644 --- a/src/gallium/state_trackers/dri/dri_context.c +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -166,10 +166,8 @@ dri_make_current(__DRIcontext * cPriv, if (__dri1_api_hooks) { dri1_update_drawables(ctx, draw, read); } else { - if (driDrawPriv) - dri_get_buffers(driDrawPriv); - if (driDrawPriv != driReadPriv && driReadPriv) - dri_get_buffers(driReadPriv); + dri_update_buffer(ctx->pipe->screen, + ctx->pipe->priv); } } else { st_make_current(NULL, NULL, NULL); diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index f7ed660..7c8c3fd 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -276,7 +276,20 @@ dri_update_buffer(struct pipe_screen *screen, void *context_private) { struct dri_context *ctx = (struct dri_context *)context_private; + if (ctx->d_stamp == *ctx->dPriv->pStamp && + ctx->r_stamp == *ctx->rPriv->pStamp) + return; + + ctx->d_stamp = *ctx->dPriv->pStamp; + ctx->r_stamp = *ctx->rPriv->pStamp; + + st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + + /* Ask the X server for new renderbuffers. */ dri_get_buffers(ctx->dPriv); + if (ctx->dPriv != ctx->rPriv) + dri_get_buffers(ctx->rPriv); + } void diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 2052867..1b02fe9 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -61,6 +61,17 @@ static const __DRItexBufferExtension dri2TexBufferExtension = { dri2_set_tex_buffer2, }; +static void +dri2_flush_drawable(__DRIdrawable *draw) +{ +} + +static const __DRI2flushExtension dri2FlushExtension = { + { __DRI2_FLUSH, __DRI2_FLUSH_VERSION }, + dri2_flush_drawable, + dri2InvalidateDrawable, +}; + static const __DRIextension *dri_screen_extensions[] = { &driReadDrawableExtension, &driCopySubBufferExtension.base, @@ -68,6 +79,7 @@ static const __DRItexBufferExtension dri2TexBufferExtension = { &driFrameTrackingExtension.base, &driMediaStreamCounterExtension.base, &dri2TexBufferExtension.base, + &dri2FlushExtension.base, NULL }; diff --git a/src/mesa/SConscript b/src/mesa/SConscript index ea5bad2..0726fcb 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -174,7 +174,6 @@ if env['platform'] != 'winddk': 'state_tracker/st_cb_readpixels.c', 'state_tracker/st_cb_strings.c', 'state_tracker/st_cb_texture.c', - 'state_tracker/st_cb_viewport.c', 'state_tracker/st_context.c', 'state_tracker/st_debug.c', 'state_tracker/st_draw.c', diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 12d4c28..3543319 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -204,7 +204,6 @@ STATETRACKER_SOURCES = \ state_tracker/st_cb_readpixels.c \ state_tracker/st_cb_strings.c \ state_tracker/st_cb_texture.c \ - state_tracker/st_cb_viewport.c \ state_tracker/st_context.c \ state_tracker/st_debug.c \ state_tracker/st_draw.c \ diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index 73df44d..6a7ebff 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -35,7 +35,8 @@ #include "st_cb_bitmap.h" #include "st_program.h" - +#include "pipe/p_context.h" + /** * This is used to initialize st->atoms[]. @@ -135,6 +136,10 @@ void st_validate_state( struct st_context *st ) check_program_state( st ); + if (st->pipe->screen->update_buffer) + st->pipe->screen->update_buffer(st->pipe->screen, + st->pipe->priv); + if (state->st == 0) return; diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c deleted file mode 100644 index b29191a..0000000 --- a/src/mesa/state_tracker/st_cb_viewport.c +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "main/glheader.h" -#include "st_context.h" -#include "st_cb_viewport.h" - -#include "pipe/p_context.h" -#include "pipe/p_state.h" -#include "pipe/p_defines.h" - - -static void st_viewport(GLcontext * ctx, GLint x, GLint y, - GLsizei width, GLsizei height) -{ - struct st_context *st = ctx->st; - - if (st->pipe->screen && st->pipe->screen->update_buffer) - st->pipe->screen->update_buffer( st->pipe->screen, - st->pipe->priv ); -} - -void st_init_viewport_functions(struct dd_function_table *functions) -{ - functions->Viewport = st_viewport; -} diff --git a/src/mesa/state_tracker/st_cb_viewport.h b/src/mesa/state_tracker/st_cb_viewport.h deleted file mode 100644 index 44948e5..0000000 --- a/src/mesa/state_tracker/st_cb_viewport.h +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -extern void -st_init_viewport_functions(struct dd_function_table *functions); diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 8f6a0c2..5b3987d 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -56,7 +56,6 @@ #include "st_cb_texture.h" #include "st_cb_flush.h" #include "st_cb_strings.h" -#include "st_cb_viewport.h" #include "st_atom.h" #include "st_draw.h" #include "st_extensions.h" @@ -343,7 +342,6 @@ void st_init_driver_functions(struct dd_function_table *functions) st_init_texture_functions(functions); st_init_flush_functions(functions); st_init_string_functions(functions); - st_init_viewport_functions(functions); functions->UpdateState = st_invalidate_state; } -- 1.6.4.4 |
Re: [Mesa3d-dev] [xserver patch v4 4/5] glx/dri2: Notify the driver
when its buffers become invalid.
From: Keith W. <ke...@vm...> - 2010-02-08 18:34:02
|
Francisco, Will Mesa continue to build after these changes for people who have not tracked the latest glproto and dri2proto repos? I'd prefer to be able to build Mesa on at least the most recently released major distros, which may require the use of some #ifdefs in the changes. Keith On Mon, 2010-02-08 at 10:25 -0800, Francisco Jerez wrote: > Signed-off-by: Francisco Jerez <cur...@ri...> > --- > glx/glxdri2.c | 28 +++++++++++++++++++++++++--- > 1 files changed, 25 insertions(+), 3 deletions(-) > > diff --git a/glx/glxdri2.c b/glx/glxdri2.c > index 0f998de..dae7b42 100644 > --- a/glx/glxdri2.c > +++ b/glx/glxdri2.c > @@ -67,6 +67,7 @@ struct __GLXDRIscreen { > > xf86EnterVTProc *enterVT; > xf86LeaveVTProc *leaveVT; > + PreConfigureWindowProcPtr PreConfigureWindow; > > const __DRIcoreExtension *core; > const __DRIdri2Extension *dri2; > @@ -217,13 +218,13 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable) > __GLXDRIscreen *screen = priv->screen; > CARD64 unused; > > - if (screen->flush) > - (*screen->flush->flushInvalidate)(priv->driDrawable); > - > if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, > __glXdriSwapEvent, drawable->pDraw) != Success) > return FALSE; > > + if (screen->flush) > + (*screen->flush->invalidate)(priv->driDrawable); > + > return TRUE; > } > > @@ -607,6 +608,24 @@ glxDRILeaveVT (int index, int flags) > } > > static void > +glxDRIPreConfigureWindow(WindowPtr pWin, int x, int y, int w, int h, int bw, > + WindowPtr pSib) > +{ > + ScreenPtr pScreen = pWin->drawable.pScreen; > + __GLXDRIscreen *screen = (__GLXDRIscreen *)glxGetScreen(pScreen); > + __GLXDRIdrawable *draw = (__GLXDRIdrawable *)glxGetDrawableFromWindow(pWin); > + > + if (screen->PreConfigureWindow) > + (*screen->PreConfigureWindow)(pWin, x, y, w, h, bw, pSib); > + > + if (!draw || (draw->height == h && draw->width == w)) > + return; > + > + if (screen->flush) > + screen->flush->invalidate(draw->driDrawable); > +} > + > +static void > initializeExtensions(__GLXDRIscreen *screen) > { > const __DRIextension **extensions; > @@ -782,6 +801,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen) > screen->leaveVT = pScrn->LeaveVT; > pScrn->LeaveVT = glxDRILeaveVT; > > + screen->PreConfigureWindow = pScreen->PreConfigureWindow; > + pScreen->PreConfigureWindow = glxDRIPreConfigureWindow; > + > LogMessage(X_INFO, > "AIGLX: Loaded and initialized %s\n", filename); > |
Re: [Mesa3d-dev] [xserver patch v4 4/5] glx/dri2: Notify the driver
when its buffers become invalid.
From: Francisco J. <cur...@ri...> - 2010-02-08 18:39:46
|
Keith Whitwell <ke...@vm...> writes: > Francisco, > > Will Mesa continue to build after these changes for people who have not > tracked the latest glproto and dri2proto repos? > > I'd prefer to be able to build Mesa on at least the most recently > released major distros, which may require the use of some #ifdefs in the > changes. > That's one of the reasons of the last rebase, see the comments in "[mesa patch v4 1/3] dri2: Event driven buffer validation.". > Keith > > On Mon, 2010-02-08 at 10:25 -0800, Francisco Jerez wrote: >> Signed-off-by: Francisco Jerez <cur...@ri...> >> --- >> glx/glxdri2.c | 28 +++++++++++++++++++++++++--- >> 1 files changed, 25 insertions(+), 3 deletions(-) >> >> diff --git a/glx/glxdri2.c b/glx/glxdri2.c >> index 0f998de..dae7b42 100644 >> --- a/glx/glxdri2.c >> +++ b/glx/glxdri2.c >> @@ -67,6 +67,7 @@ struct __GLXDRIscreen { >> >> xf86EnterVTProc *enterVT; >> xf86LeaveVTProc *leaveVT; >> + PreConfigureWindowProcPtr PreConfigureWindow; >> >> const __DRIcoreExtension *core; >> const __DRIdri2Extension *dri2; >> @@ -217,13 +218,13 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable) >> __GLXDRIscreen *screen = priv->screen; >> CARD64 unused; >> >> - if (screen->flush) >> - (*screen->flush->flushInvalidate)(priv->driDrawable); >> - >> if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, >> __glXdriSwapEvent, drawable->pDraw) != Success) >> return FALSE; >> >> + if (screen->flush) >> + (*screen->flush->invalidate)(priv->driDrawable); >> + >> return TRUE; >> } >> >> @@ -607,6 +608,24 @@ glxDRILeaveVT (int index, int flags) >> } >> >> static void >> +glxDRIPreConfigureWindow(WindowPtr pWin, int x, int y, int w, int h, int bw, >> + WindowPtr pSib) >> +{ >> + ScreenPtr pScreen = pWin->drawable.pScreen; >> + __GLXDRIscreen *screen = (__GLXDRIscreen *)glxGetScreen(pScreen); >> + __GLXDRIdrawable *draw = (__GLXDRIdrawable *)glxGetDrawableFromWindow(pWin); >> + >> + if (screen->PreConfigureWindow) >> + (*screen->PreConfigureWindow)(pWin, x, y, w, h, bw, pSib); >> + >> + if (!draw || (draw->height == h && draw->width == w)) >> + return; >> + >> + if (screen->flush) >> + screen->flush->invalidate(draw->driDrawable); >> +} >> + >> +static void >> initializeExtensions(__GLXDRIscreen *screen) >> { >> const __DRIextension **extensions; >> @@ -782,6 +801,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen) >> screen->leaveVT = pScrn->LeaveVT; >> pScrn->LeaveVT = glxDRILeaveVT; >> >> + screen->PreConfigureWindow = pScreen->PreConfigureWindow; >> + pScreen->PreConfigureWindow = glxDRIPreConfigureWindow; >> + >> LogMessage(X_INFO, >> "AIGLX: Loaded and initialized %s\n", filename); >> |
Re: [Mesa3d-dev] [xserver patch v4 4/5] glx/dri2: Notify the driver
when its buffers become invalid.
From: Keith W. <ke...@vm...> - 2010-02-08 18:51:34
|
On Mon, 2010-02-08 at 10:41 -0800, Francisco Jerez wrote: > Keith Whitwell <ke...@vm...> writes: > > > Francisco, > > > > Will Mesa continue to build after these changes for people who have not > > tracked the latest glproto and dri2proto repos? > > > > I'd prefer to be able to build Mesa on at least the most recently > > released major distros, which may require the use of some #ifdefs in the > > changes. > > > That's one of the reasons of the last rebase, see the comments in "[mesa > patch v4 1/3] dri2: Event driven buffer validation.". Ah, fantastic! Thanks Francisco. Keith |
From: Francisco J. <cur...@ri...> - 2010-02-08 18:46:40
|
The spec says (regarding glXCreateWindow): "If there is already a GLXFBConfig associated with win (as a result of a previous glXCreateWindow call), then a BadAlloc error is generated.". It will also come useful to implement DRI2InvalidateBuffers for the indirect case. Signed-off-by: Francisco Jerez <cur...@ri...> --- glx/glxcmds.c | 51 +++++++++++++++++++++++++++++++++++++++++++++------ glx/glxserver.h | 1 + 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/glx/glxcmds.c b/glx/glxcmds.c index 77afbf4..0e1c89c 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -51,6 +51,15 @@ #include "indirect_table.h" #include "indirect_util.h" +static int glxWindowPrivateKeyIndex; +static DevPrivateKey glxWindowPrivateKey = &glxWindowPrivateKeyIndex; + +__GLXdrawable * +glxGetDrawableFromWindow(WindowPtr pWin) +{ + return dixLookupPrivate(&pWin->devPrivates, glxWindowPrivateKey); +} + static int validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err) { @@ -473,6 +482,7 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, int *error) { DrawablePtr pDraw; + WindowPtr pWin; __GLXdrawable *pGlxDraw; int rc; @@ -499,6 +509,12 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, return NULL; } + pWin = (WindowPtr)pDraw; + + pGlxDraw = glxGetDrawableFromWindow(pWin); + if (pGlxDraw) + return pGlxDraw; + if (pDraw->pScreen != glxc->pGlxScreen->pScreen) { client->errorValue = pDraw->pScreen->myNum; *error = BadMatch; @@ -519,6 +535,8 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, return NULL; } + dixSetPrivate(&pWin->devPrivates, glxWindowPrivateKey, pGlxDraw); + return pGlxDraw; } @@ -1107,9 +1125,10 @@ __glXDrawableRelease(__GLXdrawable *drawable) } } -static int +static int DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config, - DrawablePtr pDraw, XID glxDrawableId, int type) + DrawablePtr pDraw, XID glxDrawableId, int type, + __GLXdrawable **ret) { __GLXdrawable *pGlxDraw; @@ -1128,6 +1147,9 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *conf return BadAlloc; } + if (ret) + *ret = pGlxDraw; + return Success; } @@ -1149,7 +1171,7 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config } err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, - glxDrawableId, GLX_DRAWABLE_PIXMAP); + glxDrawableId, GLX_DRAWABLE_PIXMAP, NULL); if (err == Success) ((PixmapPtr) pDraw)->refcnt++; @@ -1305,7 +1327,7 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, __glXleaveServer(GL_FALSE); return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable, - glxDrawableId, GLX_DRAWABLE_PBUFFER); + glxDrawableId, GLX_DRAWABLE_PBUFFER, NULL); } int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc) @@ -1409,6 +1431,8 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) __GLXscreen *pGlxScreen; ClientPtr client = cl->client; DrawablePtr pDraw; + WindowPtr pWin; + __GLXdrawable *pGlxDraw; int err; if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) @@ -1422,11 +1446,26 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) return BadWindow; } + pWin = (WindowPtr)pDraw; + + /* Make sure there're no already associated GLX drawables. */ + if (glxGetDrawableFromWindow(pWin)) { + client->errorValue = req->window; + return BadAlloc; + } + if (!validGlxFBConfigForWindow(client, config, pDraw, &err)) return err; - return DoCreateGLXDrawable(client, pGlxScreen, config, - pDraw, req->glxwindow, GLX_DRAWABLE_WINDOW); + err = DoCreateGLXDrawable(client, pGlxScreen, config, + pDraw, req->glxwindow, + GLX_DRAWABLE_WINDOW, &pGlxDraw); + if (err) + return err; + + dixSetPrivate(&pWin->devPrivates, glxWindowPrivateKey, pGlxDraw); + + return Success; } int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc) diff --git a/glx/glxserver.h b/glx/glxserver.h index 1daf977..3c49b5e 100644 --- a/glx/glxserver.h +++ b/glx/glxserver.h @@ -80,6 +80,7 @@ typedef struct __GLXcontext __GLXcontext; extern __GLXscreen *glxGetScreen(ScreenPtr pScreen); extern __GLXclientState *glxGetClient(ClientPtr pClient); +extern __GLXdrawable *glxGetDrawableFromWindow(WindowPtr pWin); /************************************************************************/ -- 1.6.4.4 |
From: Kristian H. <kr...@bi...> - 2010-02-08 22:26:51
|
On Mon, Feb 8, 2010 at 1:25 PM, Francisco Jerez <cur...@ri...> wrote: > The spec says (regarding glXCreateWindow): "If there is already a > GLXFBConfig associated with win (as a result of a previous > glXCreateWindow call), then a BadAlloc error is generated.". It will > also come useful to implement DRI2InvalidateBuffers for the indirect > case. (from elsewhere in the thread:) >> Can you just use the existing __glXDrawableRes for tracking this? >> > I don't think so. To implement DRI2InvalidateBuffers we need a way to > map an X11 window to its GLX window: In the GLX1.3 world the client > decides the IDs of its GLX drawables so in general GLX and X11 drawable > IDs aren't going to be the same. Ah yes, you're right. A few comments below. > Signed-off-by: Francisco Jerez <cur...@ri...> > --- > glx/glxcmds.c | 51 +++++++++++++++++++++++++++++++++++++++++++++------ > glx/glxserver.h | 1 + > 2 files changed, 46 insertions(+), 6 deletions(-) > > diff --git a/glx/glxcmds.c b/glx/glxcmds.c > index 77afbf4..0e1c89c 100644 > --- a/glx/glxcmds.c > +++ b/glx/glxcmds.c > @@ -51,6 +51,15 @@ > #include "indirect_table.h" > #include "indirect_util.h" > > +static int glxWindowPrivateKeyIndex; > +static DevPrivateKey glxWindowPrivateKey = &glxWindowPrivateKeyIndex; > + > +__GLXdrawable * > +glxGetDrawableFromWindow(WindowPtr pWin) > +{ > + return dixLookupPrivate(&pWin->devPrivates, glxWindowPrivateKey); > +} > + > static int > validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err) > { > @@ -473,6 +482,7 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, > int *error) > { > DrawablePtr pDraw; > + WindowPtr pWin; > __GLXdrawable *pGlxDraw; > int rc; > > @@ -499,6 +509,12 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, > return NULL; > } > > + pWin = (WindowPtr)pDraw; > + > + pGlxDraw = glxGetDrawableFromWindow(pWin); > + if (pGlxDraw) > + return pGlxDraw; If there already is a GLXWindow for the window, the validGlxDrawable() call above should return the __GLXdrawable for it, so this hunk shouldn't be necessary. > if (pDraw->pScreen != glxc->pGlxScreen->pScreen) { > client->errorValue = pDraw->pScreen->myNum; > *error = BadMatch; > @@ -519,6 +535,8 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, > return NULL; > } > > + dixSetPrivate(&pWin->devPrivates, glxWindowPrivateKey, pGlxDraw); > + > return pGlxDraw; > } > > @@ -1107,9 +1125,10 @@ __glXDrawableRelease(__GLXdrawable *drawable) > } > } > > -static int > +static int > DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config, > - DrawablePtr pDraw, XID glxDrawableId, int type) > + DrawablePtr pDraw, XID glxDrawableId, int type, > + __GLXdrawable **ret) > { > __GLXdrawable *pGlxDraw; > > @@ -1128,6 +1147,9 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *conf > return BadAlloc; > } > > + if (ret) > + *ret = pGlxDraw; > + I would just see if type is GLX_DRAWABLE_WINDOW and set the window private in DoCreateGLXDrawable() if it is. Less code churn. The rest looks good. Kristian |
From: Francisco J. <cur...@ri...> - 2010-02-08 23:11:15
|
The spec says (regarding glXCreateWindow): "If there is already a GLXFBConfig associated with win (as a result of a previous glXCreateWindow call), then a BadAlloc error is generated.". It will also come useful to implement DRI2InvalidateBuffers for the indirect case. Signed-off-by: Francisco Jerez <cur...@ri...> --- v5: Simplification as suggested by Kristian. glx/glxcmds.c | 24 +++++++++++++++++++++++- glx/glxserver.h | 1 + 2 files changed, 24 insertions(+), 1 deletions(-) diff --git a/glx/glxcmds.c b/glx/glxcmds.c index 77afbf4..cac30e6 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -51,6 +51,15 @@ #include "indirect_table.h" #include "indirect_util.h" +static int glxWindowPrivateKeyIndex; +static DevPrivateKey glxWindowPrivateKey = &glxWindowPrivateKeyIndex; + +__GLXdrawable * +glxGetDrawableFromWindow(WindowPtr pWin) +{ + return dixLookupPrivate(&pWin->devPrivates, glxWindowPrivateKey); +} + static int validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err) { @@ -519,6 +528,9 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, return NULL; } + dixSetPrivate(&((WindowPtr)pDraw)->devPrivates, glxWindowPrivateKey, + pGlxDraw); + return pGlxDraw; } @@ -1107,7 +1119,7 @@ __glXDrawableRelease(__GLXdrawable *drawable) } } -static int +static int DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config, DrawablePtr pDraw, XID glxDrawableId, int type) { @@ -1128,6 +1140,10 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *conf return BadAlloc; } + if (type == GLX_DRAWABLE_WINDOW) + dixSetPrivate(&((WindowPtr)pDraw)->devPrivates, + glxWindowPrivateKey, pGlxDraw); + return Success; } @@ -1422,6 +1438,12 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) return BadWindow; } + /* Make sure there're no already associated GLX drawables. */ + if (glxGetDrawableFromWindow((WindowPtr)pDraw)) { + client->errorValue = req->window; + return BadAlloc; + } + if (!validGlxFBConfigForWindow(client, config, pDraw, &err)) return err; diff --git a/glx/glxserver.h b/glx/glxserver.h index 1daf977..3c49b5e 100644 --- a/glx/glxserver.h +++ b/glx/glxserver.h @@ -80,6 +80,7 @@ typedef struct __GLXcontext __GLXcontext; extern __GLXscreen *glxGetScreen(ScreenPtr pScreen); extern __GLXclientState *glxGetClient(ClientPtr pClient); +extern __GLXdrawable *glxGetDrawableFromWindow(WindowPtr pWin); /************************************************************************/ -- 1.6.4.4 |
From: Kristian H. <kr...@bi...> - 2010-02-08 23:52:44
|
2010/2/8 Francisco Jerez <cur...@ri...>: > The spec says (regarding glXCreateWindow): "If there is already a > GLXFBConfig associated with win (as a result of a previous > glXCreateWindow call), then a BadAlloc error is generated.". It will > also come useful to implement DRI2InvalidateBuffers for the indirect > case. > > Signed-off-by: Francisco Jerez <cur...@ri...> Looks good, Reviewed-by: Kristian Høgsberg <kr...@bi...> > --- > v5: Simplification as suggested by Kristian. > > glx/glxcmds.c | 24 +++++++++++++++++++++++- > glx/glxserver.h | 1 + > 2 files changed, 24 insertions(+), 1 deletions(-) > > diff --git a/glx/glxcmds.c b/glx/glxcmds.c > index 77afbf4..cac30e6 100644 > --- a/glx/glxcmds.c > +++ b/glx/glxcmds.c > @@ -51,6 +51,15 @@ > #include "indirect_table.h" > #include "indirect_util.h" > > +static int glxWindowPrivateKeyIndex; > +static DevPrivateKey glxWindowPrivateKey = &glxWindowPrivateKeyIndex; > + > +__GLXdrawable * > +glxGetDrawableFromWindow(WindowPtr pWin) > +{ > + return dixLookupPrivate(&pWin->devPrivates, glxWindowPrivateKey); > +} > + > static int > validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err) > { > @@ -519,6 +528,9 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, > return NULL; > } > > + dixSetPrivate(&((WindowPtr)pDraw)->devPrivates, glxWindowPrivateKey, > + pGlxDraw); > + > return pGlxDraw; > } > > @@ -1107,7 +1119,7 @@ __glXDrawableRelease(__GLXdrawable *drawable) > } > } > > -static int > +static int > DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config, > DrawablePtr pDraw, XID glxDrawableId, int type) > { > @@ -1128,6 +1140,10 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *conf > return BadAlloc; > } > > + if (type == GLX_DRAWABLE_WINDOW) > + dixSetPrivate(&((WindowPtr)pDraw)->devPrivates, > + glxWindowPrivateKey, pGlxDraw); > + > return Success; > } > > @@ -1422,6 +1438,12 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) > return BadWindow; > } > > + /* Make sure there're no already associated GLX drawables. */ > + if (glxGetDrawableFromWindow((WindowPtr)pDraw)) { > + client->errorValue = req->window; > + return BadAlloc; > + } > + > if (!validGlxFBConfigForWindow(client, config, pDraw, &err)) > return err; > > diff --git a/glx/glxserver.h b/glx/glxserver.h > index 1daf977..3c49b5e 100644 > --- a/glx/glxserver.h > +++ b/glx/glxserver.h > @@ -80,6 +80,7 @@ typedef struct __GLXcontext __GLXcontext; > > extern __GLXscreen *glxGetScreen(ScreenPtr pScreen); > extern __GLXclientState *glxGetClient(ClientPtr pClient); > +extern __GLXdrawable *glxGetDrawableFromWindow(WindowPtr pWin); > > /************************************************************************/ > > -- > 1.6.4.4 > > |
From: Ian R. <id...@fr...> - 2010-03-22 19:57:54
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kristian Høgsberg wrote: > 2010/2/8 Francisco Jerez <cur...@ri...>: >> The spec says (regarding glXCreateWindow): "If there is already a >> GLXFBConfig associated with win (as a result of a previous >> glXCreateWindow call), then a BadAlloc error is generated.". It will >> also come useful to implement DRI2InvalidateBuffers for the indirect >> case. >> >> Signed-off-by: Francisco Jerez <cur...@ri...> I've put this version of this patch (with krh's R-b) in my GLX-fixes tree. Are the all the rest in Kristian's dri2-invalidate tree? > Looks good, > > Reviewed-by: Kristian Høgsberg <kr...@bi...> > >> --- >> v5: Simplification as suggested by Kristian. >> >> glx/glxcmds.c | 24 +++++++++++++++++++++++- >> glx/glxserver.h | 1 + >> 2 files changed, 24 insertions(+), 1 deletions(-) >> >> diff --git a/glx/glxcmds.c b/glx/glxcmds.c >> index 77afbf4..cac30e6 100644 >> --- a/glx/glxcmds.c >> +++ b/glx/glxcmds.c >> @@ -51,6 +51,15 @@ >> #include "indirect_table.h" >> #include "indirect_util.h" >> >> +static int glxWindowPrivateKeyIndex; >> +static DevPrivateKey glxWindowPrivateKey = &glxWindowPrivateKeyIndex; >> + >> +__GLXdrawable * >> +glxGetDrawableFromWindow(WindowPtr pWin) >> +{ >> + return dixLookupPrivate(&pWin->devPrivates, glxWindowPrivateKey); >> +} >> + >> static int >> validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err) >> { >> @@ -519,6 +528,9 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, >> return NULL; >> } >> >> + dixSetPrivate(&((WindowPtr)pDraw)->devPrivates, glxWindowPrivateKey, >> + pGlxDraw); >> + >> return pGlxDraw; >> } >> >> @@ -1107,7 +1119,7 @@ __glXDrawableRelease(__GLXdrawable *drawable) >> } >> } >> >> -static int >> +static int >> DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config, >> DrawablePtr pDraw, XID glxDrawableId, int type) >> { >> @@ -1128,6 +1140,10 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *conf >> return BadAlloc; >> } >> >> + if (type == GLX_DRAWABLE_WINDOW) >> + dixSetPrivate(&((WindowPtr)pDraw)->devPrivates, >> + glxWindowPrivateKey, pGlxDraw); >> + >> return Success; >> } >> >> @@ -1422,6 +1438,12 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) >> return BadWindow; >> } >> >> + /* Make sure there're no already associated GLX drawables. */ >> + if (glxGetDrawableFromWindow((WindowPtr)pDraw)) { >> + client->errorValue = req->window; >> + return BadAlloc; >> + } >> + >> if (!validGlxFBConfigForWindow(client, config, pDraw, &err)) >> return err; >> >> diff --git a/glx/glxserver.h b/glx/glxserver.h >> index 1daf977..3c49b5e 100644 >> --- a/glx/glxserver.h >> +++ b/glx/glxserver.h >> @@ -80,6 +80,7 @@ typedef struct __GLXcontext __GLXcontext; >> >> extern __GLXscreen *glxGetScreen(ScreenPtr pScreen); >> extern __GLXclientState *glxGetClient(ClientPtr pClient); >> +extern __GLXdrawable *glxGetDrawableFromWindow(WindowPtr pWin); >> >> /************************************************************************/ >> >> -- >> 1.6.4.4 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuny3IACgkQX1gOwKyEAw8s7wCdHFT2LwWBMvANCHW3vAfCbRLv S/4An3U/kZH+Q4OxUJD3q6YlrFiG2RW4 =g9WK -----END PGP SIGNATURE----- |
From: Kristian H. <kr...@bi...> - 2010-03-22 21:21:41
|
2010/3/22 Ian Romanick <id...@fr...>: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Kristian Høgsberg wrote: >> 2010/2/8 Francisco Jerez <cur...@ri...>: >>> The spec says (regarding glXCreateWindow): "If there is already a >>> GLXFBConfig associated with win (as a result of a previous >>> glXCreateWindow call), then a BadAlloc error is generated.". It will >>> also come useful to implement DRI2InvalidateBuffers for the indirect >>> case. >>> >>> Signed-off-by: Francisco Jerez <cur...@ri...> > > I've put this version of this patch (with krh's R-b) in my GLX-fixes > tree. Are the all the rest in Kristian's dri2-invalidate tree? We dropped this one, and the rest is in my dri2-invalidate tree. Kristian |
From: Ian R. <id...@fr...> - 2010-03-23 00:50:47
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kristian Høgsberg wrote: > 2010/3/22 Ian Romanick <id...@fr...>: >> Kristian Høgsberg wrote: >>> 2010/2/8 Francisco Jerez <cur...@ri...>: >>>> The spec says (regarding glXCreateWindow): "If there is already a >>>> GLXFBConfig associated with win (as a result of a previous >>>> glXCreateWindow call), then a BadAlloc error is generated.". It will >>>> also come useful to implement DRI2InvalidateBuffers for the indirect >>>> case. >>>> >>>> Signed-off-by: Francisco Jerez <cur...@ri...> >> I've put this version of this patch (with krh's R-b) in my GLX-fixes >> tree. Are the all the rest in Kristian's dri2-invalidate tree? > > We dropped this one, and the rest is in my dri2-invalidate tree. Why was it dropped? I believe that it enforced correct behavior. If this really does need to be removed, any suggestions how to fix my tree? :( git-revert seems the only way, but that makes for ugly history in a tree like this. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuoEBcACgkQX1gOwKyEAw+iWgCePAg8e40Lj+kYXt3xT+ZiQG+g r6sAnRf0ez7NGhXarxYEw3oPk5E0xBi7 =CVLf -----END PGP SIGNATURE----- |
From: Pauli N. <su...@gm...> - 2010-03-23 09:29:14
|
2010/3/23 Ian Romanick <id...@fr...>: > Kristian Høgsberg wrote: >> 2010/3/22 Ian Romanick <id...@fr...>: >>> Kristian Høgsberg wrote: >>>> 2010/2/8 Francisco Jerez <cur...@ri...>: >>>>> The spec says (regarding glXCreateWindow): "If there is already a >>>>> GLXFBConfig associated with win (as a result of a previous >>>>> glXCreateWindow call), then a BadAlloc error is generated.". It will >>>>> also come useful to implement DRI2InvalidateBuffers for the indirect >>>>> case. >>>>> >>>>> Signed-off-by: Francisco Jerez <cur...@ri...> >>> I've put this version of this patch (with krh's R-b) in my GLX-fixes >>> tree. Are the all the rest in Kristian's dri2-invalidate tree? >> >> We dropped this one, and the rest is in my dri2-invalidate tree. > > Why was it dropped? I believe that it enforced correct behavior. If > this really does need to be removed, any suggestions how to fix my tree? > :( git-revert seems the only way, but that makes for ugly history in a > tree like this. You can fix git history with git commit --amend and git rebase --onto. If your tree mixes good and bad commit it would be easier to create new branch and use git cherry-pick. |
From: Francisco J. <cur...@ri...> - 2010-03-23 11:01:04
|
Ian Romanick <id...@fr...> writes: > Kristian Høgsberg wrote: >> 2010/3/22 Ian Romanick <id...@fr...>: >>> Kristian Høgsberg wrote: >>>> 2010/2/8 Francisco Jerez <cur...@ri...>: >>>>> The spec says (regarding glXCreateWindow): "If there is already a >>>>> GLXFBConfig associated with win (as a result of a previous >>>>> glXCreateWindow call), then a BadAlloc error is generated.". It will >>>>> also come useful to implement DRI2InvalidateBuffers for the indirect >>>>> case. >>>>> >>>>> Signed-off-by: Francisco Jerez <cur...@ri...> >>> I've put this version of this patch (with krh's R-b) in my GLX-fixes >>> tree. Are the all the rest in Kristian's dri2-invalidate tree? >> >> We dropped this one, and the rest is in my dri2-invalidate tree. > > Why was it dropped? I believe that it enforced correct behavior. If > this really does need to be removed, any suggestions how to fix my tree? > :( git-revert seems the only way, but that makes for ugly history in a > tree like this. We stopped caring about this one because a refactoring of the dri2 code made it irrelevant to the invalidate event implementation, but yeah, I think the behavior it enforced was correct. |
From: Jesse B. <jb...@vi...> - 2010-04-06 17:25:14
|
On Mon, 8 Feb 2010 19:25:14 +0100 Francisco Jerez <cur...@ri...> wrote: > The spec says (regarding glXCreateWindow): "If there is already a > GLXFBConfig associated with win (as a result of a previous > glXCreateWindow call), then a BadAlloc error is generated.". It will > also come useful to implement DRI2InvalidateBuffers for the indirect > case. > > Signed-off-by: Francisco Jerez <cur...@ri...> > --- > glx/glxcmds.c | 51 +++++++++++++++++++++++++++++++++++++++++++++------ > glx/glxserver.h | 1 + > 2 files changed, 46 insertions(+), 6 deletions(-) > > diff --git a/glx/glxcmds.c b/glx/glxcmds.c > index 77afbf4..0e1c89c 100644 > --- a/glx/glxcmds.c > +++ b/glx/glxcmds.c > @@ -51,6 +51,15 @@ > #include "indirect_table.h" > #include "indirect_util.h" > > +static int glxWindowPrivateKeyIndex; > +static DevPrivateKey glxWindowPrivateKey = &glxWindowPrivateKeyIndex; > + > +__GLXdrawable * > +glxGetDrawableFromWindow(WindowPtr pWin) > +{ > + return dixLookupPrivate(&pWin->devPrivates, glxWindowPrivateKey); > +} Thanks for pointing this out. Can we use this in glxscreens.c:glxDestroyWindow() to invalidate the drawable pointer in the glx drawable at window destroy time? That would be a good way to fix https://bugs.freedesktop.org/show_bug.cgi?id=26394; probably better than trying to mix in (or totally switch to) XIDs for tracking things. -- Jesse Barnes, Intel Open Source Technology Center |
From: Kristian H. <kr...@bi...> - 2010-02-08 20:10:34
|
On Mon, Feb 8, 2010 at 1:25 PM, Francisco Jerez <cur...@ri...> wrote: > The spec says (regarding glXCreateWindow): "If there is already a > GLXFBConfig associated with win (as a result of a previous > glXCreateWindow call), then a BadAlloc error is generated.". It will > also come useful to implement DRI2InvalidateBuffers for the indirect > case. Can you just use the existing __glXDrawableRes for tracking this? cheers, Kristian |
From: Francisco J. <cur...@ri...> - 2010-02-08 20:59:31
|
Kristian Høgsberg <kr...@bi...> writes: > On Mon, Feb 8, 2010 at 1:25 PM, Francisco Jerez <cur...@ri...> wrote: >> The spec says (regarding glXCreateWindow): "If there is already a >> GLXFBConfig associated with win (as a result of a previous >> glXCreateWindow call), then a BadAlloc error is generated.". It will >> also come useful to implement DRI2InvalidateBuffers for the indirect >> case. > > Can you just use the existing __glXDrawableRes for tracking this? > I don't think so. To implement DRI2InvalidateBuffers we need a way to map an X11 window to its GLX window: In the GLX1.3 world the client decides the IDs of its GLX drawables so in general GLX and X11 drawable IDs aren't going to be the same. > cheers, > Kristian |
From: Keith W. <ke...@vm...> - 2010-01-22 16:40:53
|
It's a very rare application that can render half a frame to one sized framebuffer and the other half to another and expect to have a meaningful result. It's also incredibly difficult to write a driver that produces any sensible result when the render-target size changes halfway through a frame. There are a bunch of reasons for this, including the fact that the driver will have unflushed command buffers referring to the old size that are suddenly invalid when a new size materializes. Basically one of the best things we ever did was stop checking the DRI1 sarea for window size changes except at swapbuffer and makecurrent times. Being able to resize windows without seeing mangled/garbage frames in the middle was a huge step forwards. My pet take on this is that we should go one step further and modify GLX semantics to allow a stretch blit on swapbuffers to scale the rendered image up/down to the new window size. There is no possible way to make sure that the driver always produces a frame that matches the new window size (as it may change in the middle of a frame, etc), this seems like by far the nicest approach from a users perspective. It disregards an aspect of the GLX spec - I'm interested to hear if anyone can figure out a way to square that circle... Keith ________________________________________ From: Michel Dänzer [mi...@da...] Sent: Friday, January 22, 2010 4:11 AM To: Francisco Jerez Cc: mes...@li... Subject: Re: [Mesa3d-dev] [mesa patch 1/3] dri2: Event driven buffer validation. > > When the invalidate event is available, IMO the buffers should also only > > be invalidated after a buffer swap / front buffer flush, not 'in the > > middle of a frame'. > > > Event-driven applications want the new buffers immediately after getting > the resize event, otherwise they could try to draw outside the bounds of > the old buffers, and that rendering would be lost. I still don't see any benefit to changing the buffers while the app is rendering a frame, but I guess the problem is that the DRI2 code in libGL doesn't know if that's the case or not... |
From: Francisco J. <cur...@ri...> - 2010-01-22 17:42:39
|
Keith Whitwell <ke...@vm...> writes: > It's a very rare application that can render half a frame to one sized framebuffer and the other half to another and expect to have a meaningful result. > > It's also incredibly difficult to write a driver that produces any sensible result when the render-target size changes halfway through a frame. There are a bunch of reasons for this, including the fact that the driver will have unflushed command buffers referring to the old size that are suddenly invalid when a new size materializes. > > Basically one of the best things we ever did was stop checking the DRI1 sarea for window size changes except at swapbuffer and makecurrent times. Being able to resize windows without seeing mangled/garbage frames in the middle was a huge step forwards. > As Michel said, that isn't what this changeset does, the new buffers don't kick in until the application becomes aware of them. And that shouldn't happen "mid-frame" unless the application is expecting it to happen at that point. > My pet take on this is that we should go one step further and modify GLX semantics to allow a stretch blit on swapbuffers to scale the rendered image up/down to the new window size. > Wouldn't that mean modifying the viewport transform behind the user's back? Or would the "window" dimensions stay constant? > There is no possible way to make sure that the driver always produces a frame that matches the new window size (as it may change in the middle of a frame, etc), this seems like by far the nicest approach from a users perspective. It disregards an aspect of the GLX spec - I'm interested to hear if anyone can figure out a way to square that circle... > > Keith |
From: Keith W. <ke...@vm...> - 2010-01-26 18:47:32
|
On Fri, 2010-01-22 at 09:40 -0800, Francisco Jerez wrote: > Keith Whitwell <ke...@vm...> writes: > > > It's a very rare application that can render half a frame to one sized framebuffer and the other half to another and expect to have a meaningful result. > > > > It's also incredibly difficult to write a driver that produces any sensible result when the render-target size changes halfway through a frame. There are a bunch of reasons for this, including the fact that the driver will have unflushed command buffers referring to the old size that are suddenly invalid when a new size materializes. > > > > Basically one of the best things we ever did was stop checking the DRI1 sarea for window size changes except at swapbuffer and makecurrent times. Being able to resize windows without seeing mangled/garbage frames in the middle was a huge step forwards. > > > > As Michel said, that isn't what this changeset does, the new buffers > don't kick in until the application becomes aware of them. And that > shouldn't happen "mid-frame" unless the application is expecting it to > happen at that point. OK, understood. > > My pet take on this is that we should go one step further and modify GLX semantics to allow a stretch blit on swapbuffers to scale the rendered image up/down to the new window size. > > > Wouldn't that mean modifying the viewport transform behind the user's > back? Or would the "window" dimensions stay constant? No, I mean turning SwapBuffers into a stretch-blit to bridge the gap between whatever we thought the window size was when we rendered the frame to what it really is when we do the swap. Michel doesn't like this too much, though... Keith |