diff options
author | Martin Jansa <Martin.Jansa@gmail.com> | 2010-02-21 14:40:26 +0100 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2010-02-23 15:18:02 +0100 |
commit | 9471f8941b763c03eabc3ef0d87110687e2f26db (patch) | |
tree | 1cc19614c9a4a8d9d250aa8a1567fedc0dc7578a /recipes/xorg-xserver | |
parent | cd2745db6cf32de9c756646806eae7e42b044695 (diff) |
xserver-xorg_git: add more pending patches for latest dri2 changes
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'recipes/xorg-xserver')
8 files changed, 787 insertions, 28 deletions
diff --git a/recipes/xorg-xserver/0006-glxdri2-remove-flushInvalidate.patch b/recipes/xorg-xserver/0006-glxdri2-remove-flushInvalidate.patch new file mode 100644 index 0000000000..b6c633970a --- /dev/null +++ b/recipes/xorg-xserver/0006-glxdri2-remove-flushInvalidate.patch @@ -0,0 +1,26 @@ +From 4f62a6e6738b4563aa1015e6c165a30231363e1f Mon Sep 17 00:00:00 2001 +From: Martin Jansa <Martin.Jansa@gmail.com> +Date: Sun, 21 Feb 2010 15:01:45 +0100 +Subject: [PATCH] glxdri2: remove flushInvalidate() + +--- + glx/glxdri2.c | 3 --- + 1 files changed, 0 insertions(+), 3 deletions(-) + +diff --git a/glx/glxdri2.c b/glx/glxdri2.c +index e4f2d60..dae7b42 100644 +--- a/glx/glxdri2.c ++++ b/glx/glxdri2.c +@@ -225,9 +225,6 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable) + if (screen->flush) + (*screen->flush->invalidate)(priv->driDrawable); + +- if (screen->flush && screen->flush->flushInvalidate) +- (*screen->flush->flushInvalidate)(priv->driDrawable); +- + return TRUE; + } + +-- +1.7.0 + diff --git a/recipes/xorg-xserver/xserver-xorg/0001-Add-a-PreConfigureWindow-hook.patch b/recipes/xorg-xserver/xserver-xorg/0001-Add-a-PreConfigureWindow-hook.patch new file mode 100644 index 0000000000..c99b3e3299 --- /dev/null +++ b/recipes/xorg-xserver/xserver-xorg/0001-Add-a-PreConfigureWindow-hook.patch @@ -0,0 +1,80 @@ +From 653153e878ed568ce085ce6386d5c7f6ec4cb18e Mon Sep 17 00:00:00 2001 +From: Francisco Jerez <currojerez@riseup.net> +Date: Fri, 22 Jan 2010 06:29:34 -0800 +Subject: [PATCH 1/5] Add a PreConfigureWindow hook. + +Executed from the ConfigureWindow request, right before sending +ConfigureNotify to the clients. + +This commit breaks the ScreenRec ABI. + +Signed-off-by: Francisco Jerez <currojerez@riseup.net> +--- + 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 2676a54..980436a 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.7.0 + diff --git a/recipes/xorg-xserver/xserver-xorg/0001-glxdri2-flushInvalidate-was-renamed-to-invalidate-in.patch b/recipes/xorg-xserver/xserver-xorg/0001-glxdri2-flushInvalidate-was-renamed-to-invalidate-in.patch deleted file mode 100644 index 697bbb43e2..0000000000 --- a/recipes/xorg-xserver/xserver-xorg/0001-glxdri2-flushInvalidate-was-renamed-to-invalidate-in.patch +++ /dev/null @@ -1,25 +0,0 @@ -From afb5e0c9c3a9421c6e05b5a0f61c7e8ab67d4cc6 Mon Sep 17 00:00:00 2001 -From: Martin Jansa <Martin.Jansa@gmail.com> -Date: Fri, 19 Feb 2010 00:24:06 +0100 -Subject: [PATCH] glxdri2: flushInvalidate was renamed to invalidate in http://cgit.freedesktop.org/mesa/mesa/commit/?id=debf00e5fc3828f63e0f99d72c7fa6cd6ce012c5 - ---- - glx/glxdri2.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/glx/glxdri2.c b/glx/glxdri2.c -index 0f998de..a98b522 100644 ---- a/glx/glxdri2.c -+++ b/glx/glxdri2.c -@@ -218,7 +218,7 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable) - CARD64 unused; - - if (screen->flush) -- (*screen->flush->flushInvalidate)(priv->driDrawable); -+ (*screen->flush->invalidate)(priv->driDrawable); - - if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, - __glXdriSwapEvent, drawable->pDraw) != Success) --- -1.7.0 - diff --git a/recipes/xorg-xserver/xserver-xorg/0002-dri2-No-need-to-blit-from-front-on-DRI2GetBuffers-if.patch b/recipes/xorg-xserver/xserver-xorg/0002-dri2-No-need-to-blit-from-front-on-DRI2GetBuffers-if.patch new file mode 100644 index 0000000000..25c073b81e --- /dev/null +++ b/recipes/xorg-xserver/xserver-xorg/0002-dri2-No-need-to-blit-from-front-on-DRI2GetBuffers-if.patch @@ -0,0 +1,111 @@ +From 2723b7a678e75e0a070e90ec223309c9b739d24b Mon Sep 17 00:00:00 2001 +From: Francisco Jerez <currojerez@riseup.net> +Date: Fri, 22 Jan 2010 06:29:35 -0800 +Subject: [PATCH 2/5] dri2: No need to blit from front on DRI2GetBuffers if they're just being reused. + +It can be quite an expensive operation, so we're better off not doing +it unless it's totally required. + +Signed-off-by: Francisco Jerez <currojerez@riseup.net> +--- + hw/xfree86/dri2/dri2.c | 42 +++++++++++++++++++++++------------------- + 1 files changed, 23 insertions(+), 19 deletions(-) + +diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c +index cd69ca0..48618e1 100644 +--- a/hw/xfree86/dri2/dri2.c ++++ b/hw/xfree86/dri2/dri2.c +@@ -202,27 +202,25 @@ find_attachment(DRI2DrawablePtr pPriv, unsigned attachment) + return -1; + } + +-static DRI2BufferPtr ++static Bool + allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds, + DRI2DrawablePtr pPriv, + unsigned int attachment, unsigned int format, +- int dimensions_match) ++ int dimensions_match, DRI2BufferPtr *buffer) + { +- DRI2BufferPtr buffer; +- int old_buf; +- +- old_buf = find_attachment(pPriv, attachment); ++ int old_buf = find_attachment(pPriv, attachment); + + if ((old_buf < 0) + || !dimensions_match + || (pPriv->buffers[old_buf]->format != format)) { +- buffer = (*ds->CreateBuffer)(pDraw, attachment, format); ++ *buffer = (*ds->CreateBuffer)(pDraw, attachment, format); ++ return TRUE; ++ + } else { +- buffer = pPriv->buffers[old_buf]; ++ *buffer = pPriv->buffers[old_buf]; + pPriv->buffers[old_buf] = NULL; ++ return FALSE; + } +- +- return buffer; + } + + static DRI2BufferPtr * +@@ -238,6 +236,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, + int have_fake_front = 0; + int front_format = 0; + int dimensions_match; ++ int buffers_changed = 0; + int i; + + if (!pPriv) { +@@ -256,8 +255,10 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, + const unsigned attachment = *(attachments++); + const unsigned format = (has_format) ? *(attachments++) : 0; + +- buffers[i] = allocate_or_reuse_buffer(pDraw, ds, pPriv, attachment, +- format, dimensions_match); ++ if (allocate_or_reuse_buffer(pDraw, ds, pPriv, attachment, ++ format, dimensions_match, ++ &buffers[i])) ++ buffers_changed = 1; + + /* If the drawable is a window and the front-buffer is requested, + * silently add the fake front-buffer to the list of requested +@@ -287,15 +288,18 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, + } + + if (need_real_front > 0) { +- buffers[i++] = allocate_or_reuse_buffer(pDraw, ds, pPriv, +- DRI2BufferFrontLeft, +- front_format, dimensions_match); ++ if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFrontLeft, ++ front_format, dimensions_match, ++ &buffers[i++])) ++ buffers_changed = 1; + } + + if (need_fake_front > 0) { +- buffers[i++] = allocate_or_reuse_buffer(pDraw, ds, pPriv, +- DRI2BufferFakeFrontLeft, +- front_format, dimensions_match); ++ if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFakeFrontLeft, ++ front_format, dimensions_match, ++ &buffers[i++])) ++ buffers_changed = 1; ++ + have_fake_front = 1; + } + +@@ -324,7 +328,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, + * contents of the real front-buffer. This ensures correct operation of + * applications that call glXWaitX before calling glDrawBuffer. + */ +- if (have_fake_front) { ++ if (have_fake_front && buffers_changed) { + BoxRec box; + RegionRec region; + +-- +1.7.0 + diff --git a/recipes/xorg-xserver/xserver-xorg/0003-glx-Enforce-a-1-1-correspondence-between-GLX-and-X11.patch b/recipes/xorg-xserver/xserver-xorg/0003-glx-Enforce-a-1-1-correspondence-between-GLX-and-X11.patch new file mode 100644 index 0000000000..74bff9b9b9 --- /dev/null +++ b/recipes/xorg-xserver/xserver-xorg/0003-glx-Enforce-a-1-1-correspondence-between-GLX-and-X11.patch @@ -0,0 +1,161 @@ +From b629ae3db6a87fa91e5b2fd5deb4ccc6075ad243 Mon Sep 17 00:00:00 2001 +From: Francisco Jerez <currojerez@riseup.net> +Date: Fri, 22 Jan 2010 06:29:36 -0800 +Subject: [PATCH 3/5] glx: Enforce a 1:1 correspondence between GLX and X11 windows. + +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 <currojerez@riseup.net> +--- + 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.7.0 + diff --git a/recipes/xorg-xserver/xserver-xorg/0004-glx-dri2-Notify-the-driver-when-its-buffers-become-i.patch b/recipes/xorg-xserver/xserver-xorg/0004-glx-dri2-Notify-the-driver-when-its-buffers-become-i.patch new file mode 100644 index 0000000000..4429c1da40 --- /dev/null +++ b/recipes/xorg-xserver/xserver-xorg/0004-glx-dri2-Notify-the-driver-when-its-buffers-become-i.patch @@ -0,0 +1,80 @@ +From cf5c8721705bcbac27986e5a29a37d2a1686570a Mon Sep 17 00:00:00 2001 +From: Francisco Jerez <currojerez@riseup.net> +Date: Fri, 22 Jan 2010 06:29:37 -0800 +Subject: [PATCH 4/5] glx/dri2: Notify the driver when its buffers become invalid. + +Signed-off-by: Francisco Jerez <currojerez@riseup.net> +--- + glx/glxdri2.c | 31 ++++++++++++++++++++++++++++--- + 1 files changed, 28 insertions(+), 3 deletions(-) + +diff --git a/glx/glxdri2.c b/glx/glxdri2.c +index 0f998de..e4f2d60 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,16 @@ __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); ++ ++ if (screen->flush && screen->flush->flushInvalidate) ++ (*screen->flush->flushInvalidate)(priv->driDrawable); ++ + return TRUE; + } + +@@ -607,6 +611,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 +804,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.7.0 + diff --git a/recipes/xorg-xserver/xserver-xorg/0005-dri2-Support-the-DRI2InvalidateBuffers-event.patch b/recipes/xorg-xserver/xserver-xorg/0005-dri2-Support-the-DRI2InvalidateBuffers-event.patch new file mode 100644 index 0000000000..9bf4f27072 --- /dev/null +++ b/recipes/xorg-xserver/xserver-xorg/0005-dri2-Support-the-DRI2InvalidateBuffers-event.patch @@ -0,0 +1,319 @@ +From 2b9b1327984cb1f3588e77b1bdb2e7641de2ffb9 Mon Sep 17 00:00:00 2001 +From: Francisco Jerez <currojerez@riseup.net> +Date: Fri, 22 Jan 2010 06:29:38 -0800 +Subject: [PATCH 5/5] dri2: Support the DRI2InvalidateBuffers event. + +Bumps the supported DRI2 protocol version. + +Signed-off-by: Francisco Jerez <currojerez@riseup.net> +--- + configure.ac | 2 +- + hw/xfree86/dri2/dri2.c | 110 +++++++++++++++++++++++++++++++++++++++++++ + hw/xfree86/dri2/dri2.h | 5 ++ + hw/xfree86/dri2/dri2ext.c | 35 ++++++++++++-- + include/protocol-versions.h | 2 +- + 5 files changed, 148 insertions(+), 6 deletions(-) + +diff --git a/configure.ac b/configure.ac +index de252f3..e9ca45a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -759,7 +759,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..51040d4 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) +@@ -759,6 +843,8 @@ DRI2DestroyDrawable(DrawablePtr pDraw) + DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); + DRI2DrawablePtr pPriv; + ++ DRI2ClientRefPtr ref; ++ + pPriv = DRI2GetDrawable(pDraw); + if (pPriv == NULL) + return; +@@ -776,6 +862,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 +900,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 +976,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.7.0 + diff --git a/recipes/xorg-xserver/xserver-xorg_git.bb b/recipes/xorg-xserver/xserver-xorg_git.bb index 7cc29504e1..9046e8f13e 100644 --- a/recipes/xorg-xserver/xserver-xorg_git.bb +++ b/recipes/xorg-xserver/xserver-xorg_git.bb @@ -3,15 +3,22 @@ require xorg-xserver-common.inc DESCRIPTION = "the X.Org X server" DEPENDS += "pixman libpciaccess openssl dri2proto glproto xorg-minimal-fonts font-util-native" PV = "1.7.999" -PR = "r2" +PR = "r3" PR_append = "+gitr${SRCREV}" PE = "2" DEFAULT_PREFERENCE = "-1" -SRCREV = "84905007702da2c05a4f7446b3fc5ff52be49655" +SRCREV = "db4f676f25c6d8e58263d5151942be730592d444" SRC_URI = "git://anongit.freedesktop.org/xorg/xserver;protocol=git;branch=master \ - file://0001-glxdri2-flushInvalidate-was-renamed-to-invalidate-in.patch;patch=1 \ +# pending changes http://lists.x.org/archives/xorg-devel/2010-January/005127.html + file://0001-Add-a-PreConfigureWindow-hook.patch;patch=1 \ + file://0002-dri2-No-need-to-blit-from-front-on-DRI2GetBuffers-if.patch;patch=1 \ + file://0003-glx-Enforce-a-1-1-correspondence-between-GLX-and-X11.patch;patch=1 \ + file://0004-glx-dri2-Notify-the-driver-when-its-buffers-become-i.patch;patch=1 \ + file://0005-dri2-Support-the-DRI2InvalidateBuffers-event.patch;patch=1 \ +# flushInvalidate version removed in latest mesa + file://0006-glxdri2-remove-flushInvalidate.patch;patch=1 \ file://dolt-fix-1.7.0.patch;patch=1 \ file://randr-support-1.7.0.patch;patch=1 \ file://hack-fbdev-ignore-return-mode.patch;patch=1 \ |