xserver: Branch 'server-1.20-branch' - 2 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 14 21:33:30 UTC 2021
glx/glxcmds.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
New commits:
commit 2a83c840c8f38281b7f93b5522e20a71f6723b08
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Thu Jun 3 17:51:01 2021 +0200
glx: Set ContextTag for all contexts
Currently, xorgGlxMakeCurrent() would set the context tag only for
indirect GLX contexts.
However, several other places expect to find a context for the tag or
they would raise a GLXBadContextTag error, such as WaitGL() or WaitX().
Set the context tag for direct contexts as well, to avoid raising an
error and possibly killing the client.
Thanks to Erik Kurzinger <ekurzinger at nvidia.com> for spotting the issue.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>
(cherry picked from commit c468d34c7208c9041f9c077b54a00ae9cccad6a3)
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 2d77fb3e3..d148c79bf 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -650,9 +650,10 @@ xorgGlxMakeCurrent(ClientPtr client, GLXContextTag tag, XID drawId, XID readId,
}
glxc->currentClient = client;
- glxServer.setContextTagPrivate(client, newContextTag, glxc);
}
+ glxServer.setContextTagPrivate(client, newContextTag, glxc);
+
if (prevglxc) {
prevglxc->currentClient = NULL;
if (!prevglxc->idExists) {
commit 394b6cc1cf614ba7b13db7976b0739035da86d28
Author: Erik Kurzinger <ekurzinger at nvidia.com>
Date: Thu Dec 10 14:24:32 2020 -0800
glx: don't create implicit GLXWindow if one already exists
If a GLXMakeCurrent request specifies an X window as its drawable,
__glXGetDrawable will implicitly create a GLXWindow for it. However,
the client may have already explicitly created a GLXWindow for that X
window. If that happens, two __glXDrawableRes resources will be added
to the window.
If the explicitly-created GLXWindow is later destroyed by the client,
DrawableGone will call FreeResourceByType on the X window, but this
will actually free the resource for the implicitly-created GLXWindow,
since that one would be at the head of the list.
Then if the X window is destroyed after that, the resource for the
explicitly-created GLXWindow will be freed. But that GLXWindow was
already destroyed above. This crashes the server when it tries to call
the destroyed GLXWindow's destructor. It also means the
implicitly-created GLXWindow would have been leaked since the
FreeResourceByType call mentioned above skips calling the destructor.
To fix this, if __glXGetDrawable is given an X window, it should check
if there is already a GLXWindow associated with it, and only create an
implicit one if there is not.
Signed-off-by: Erik Kurzinger <ekurzinger at nvidia.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>
(cherry picked from commit b7a85e44da91d1663d5b4eabac06327c92a80f91)
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 75e42823c..2d77fb3e3 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -473,8 +473,15 @@ __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client,
__GLXscreen *pGlxScreen;
int rc;
- if (validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
- DixWriteAccess, &pGlxDraw, &rc)) {
+ rc = dixLookupResourceByType((void **)&pGlxDraw, drawId,
+ __glXDrawableRes, client, DixWriteAccess);
+ if (rc == Success &&
+ /* If pGlxDraw->drawId == drawId, drawId is a valid GLX drawable.
+ * Otherwise, if pGlxDraw->type == GLX_DRAWABLE_WINDOW, drawId is
+ * an X window, but the client has already created a GLXWindow
+ * associated with it, so we don't want to create another one. */
+ (pGlxDraw->drawId == drawId ||
+ pGlxDraw->type == GLX_DRAWABLE_WINDOW)) {
if (glxc != NULL &&
glxc->config != NULL &&
glxc->config != pGlxDraw->config) {
More information about the xorg-commit
mailing list