From ceb47b757245c9862fc89fa4ef8adb045a1b8ff3f84e3349678e96cd45f8d915 Mon Sep 17 00:00:00 2001 From: Stefan Dirsch Date: Wed, 18 Apr 2018 09:56:20 +0000 Subject: [PATCH] Accepting request 597422 from home:michalsrb:branches:bnc1079607:X11:XOrg - U_glx-Do-not-call-into-Composite-if-it-is-disabled.patch * Fixes crash when GLX is enabled and Composite disabled. (bnc#1079607) OBS-URL: https://build.opensuse.org/request/show/597422 OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=700 --- ...all-into-Composite-if-it-is-disabled.patch | 173 ++++++++++++++++++ xorg-x11-server.changes | 7 + xorg-x11-server.spec | 4 + 3 files changed, 184 insertions(+) create mode 100644 U_glx-Do-not-call-into-Composite-if-it-is-disabled.patch diff --git a/U_glx-Do-not-call-into-Composite-if-it-is-disabled.patch b/U_glx-Do-not-call-into-Composite-if-it-is-disabled.patch new file mode 100644 index 0000000..bbff497 --- /dev/null +++ b/U_glx-Do-not-call-into-Composite-if-it-is-disabled.patch @@ -0,0 +1,173 @@ +Git-commit: 1326ee0bc5eb858c3c00847b3ba65134e4ca2e2d +Patch-mainline: Upstream +Author: Michal Srb +Subject: glx: Do not call into Composite if it is disabled. +References: bnc#1079607 fdo#104993 + +Otherwise X server crashes if GLX is enabled and Composite disabled. For +example the compIsAlternateVisual function will try to lookup CompScreenPtr +using the CompScreenPrivateKey, but that was never initialized if Composite is +disabled. + +Fixes: f84e59a4f4. ("glx: Duplicate relevant fbconfigs for compositing visuals") +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104993 +Signed-off-by: Michal Srb +--- + glx/glxdricommon.c | 63 +++++++++++++++++++++++++++++------------------------- + glx/glxscreens.c | 33 +++++++++++++++++----------- + 2 files changed, 55 insertions(+), 41 deletions(-) + +Index: xorg-server-1.19.6/glx/glxdricommon.c +=================================================================== +--- xorg-server-1.19.6.orig/glx/glxdricommon.c ++++ xorg-server-1.19.6/glx/glxdricommon.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include "extinit.h" + #include "glxserver.h" + #include "glxext.h" + #include "glxcontext.h" +@@ -206,25 +207,27 @@ createModeFromConfig(const __DRIcoreExte + config->config.yInverted = GL_TRUE; + + #ifdef COMPOSITE +- /* +- * Here we decide what fbconfigs will be duplicated for compositing. +- * fgbconfigs marked with duplicatedForConf will be reserved for +- * compositing visuals. +- * It might look strange to do this decision this late when translation +- * from a __DRIConfig is already done, but using the __DRIConfig +- * accessor function becomes worse both with respect to code complexity +- * and CPU usage. +- */ +- if (duplicateForComp && +- (render_type_is_pbuffer_only(renderType) || +- config->config.rgbBits != 32 || +- config->config.visualRating != GLX_NONE || +- config->config.sampleBuffers != 0)) { +- free(config); +- return NULL; +- } ++ if (!noCompositeExtension) { ++ /* ++ * Here we decide what fbconfigs will be duplicated for compositing. ++ * fgbconfigs marked with duplicatedForConf will be reserved for ++ * compositing visuals. ++ * It might look strange to do this decision this late when translation ++ * from a __DRIConfig is already done, but using the __DRIConfig ++ * accessor function becomes worse both with respect to code complexity ++ * and CPU usage. ++ */ ++ if (duplicateForComp && ++ (render_type_is_pbuffer_only(renderType) || ++ config->config.rgbBits != 32 || ++ config->config.visualRating != GLX_NONE || ++ config->config.sampleBuffers != 0)) { ++ free(config); ++ return NULL; ++ } + +- config->config.duplicatedForComp = duplicateForComp; ++ config->config.duplicatedForComp = duplicateForComp; ++ } + #endif + + return &config->config; +@@ -258,14 +261,16 @@ glxConvertConfigs(const __DRIcoreExtensi + } + + #ifdef COMPOSITE +- /* Duplicate fbconfigs for use with compositing visuals */ +- for (i = 0; configs[i]; i++) { +- tail->next = createModeFromConfig(core, configs[i], GLX_TRUE_COLOR, +- GL_TRUE); +- if (tail->next == NULL) +- continue; ++ if (!noCompositeExtension) { ++ /* Duplicate fbconfigs for use with compositing visuals */ ++ for (i = 0; configs[i]; i++) { ++ tail->next = createModeFromConfig(core, configs[i], GLX_TRUE_COLOR, ++ GL_TRUE); ++ if (tail->next == NULL) ++ continue; + +- tail = tail->next; ++ tail = tail->next; ++ } + } + #endif + +Index: xorg-server-1.19.6/glx/glxscreens.c +=================================================================== +--- xorg-server-1.19.6.orig/glx/glxscreens.c ++++ xorg-server-1.19.6/glx/glxscreens.c +@@ -38,6 +38,7 @@ + #include + #include + ++#include "extinit.h" + #include "privates.h" + #include "glxserver.h" + #include "glxutil.h" +@@ -279,10 +280,12 @@ pickFBConfig(__GLXscreen * pGlxScreen, V + if (config->visualID != 0) + continue; + #ifdef COMPOSITE +- /* Use only duplicated configs for compIsAlternateVisuals */ +- if (!!compIsAlternateVisual(pGlxScreen->pScreen, visual->vid) != +- !!config->duplicatedForComp) +- continue; ++ if (!noCompositeExtension) { ++ /* Use only duplicated configs for compIsAlternateVisuals */ ++ if (!!compIsAlternateVisual(pGlxScreen->pScreen, visual->vid) != ++ !!config->duplicatedForComp) ++ continue; ++ } + #endif + /* + * If possible, use the same swapmethod for all built-in visual +@@ -352,8 +355,10 @@ __glXScreenInit(__GLXscreen * pGlxScreen + pGlxScreen->visuals[pGlxScreen->numVisuals++] = config; + config->visualID = visual->vid; + #ifdef COMPOSITE +- if (compIsAlternateVisual(pScreen, visual->vid)) +- config->visualSelectGroup++; ++ if (!noCompositeExtension) { ++ if (compIsAlternateVisual(pScreen, visual->vid)) ++ config->visualSelectGroup++; ++ } + #endif + } + } +@@ -375,10 +380,12 @@ __glXScreenInit(__GLXscreen * pGlxScreen + */ + depth = config->redBits + config->greenBits + config->blueBits; + #ifdef COMPOSITE +- if (config->duplicatedForComp) { +- depth += config->alphaBits; +- config->visualSelectGroup++; +- } ++ if (!noCompositeExtension) { ++ if (config->duplicatedForComp) { ++ depth += config->alphaBits; ++ config->visualSelectGroup++; ++ } ++ } + #endif + /* Make sure that our FBconfig's depth can actually be displayed + * (corresponds to an existing visual). +@@ -403,8 +410,10 @@ __glXScreenInit(__GLXscreen * pGlxScreen + continue; + + #ifdef COMPOSITE +- if (config->duplicatedForComp) +- (void) CompositeRegisterAlternateVisuals(pScreen, &visual->vid, 1); ++ if (!noCompositeExtension) { ++ if (config->duplicatedForComp) ++ (void) CompositeRegisterAlternateVisuals(pScreen, &visual->vid, 1); ++ } + #endif + pGlxScreen->visuals[pGlxScreen->numVisuals++] = config; + initGlxVisual(visual, config); diff --git a/xorg-x11-server.changes b/xorg-x11-server.changes index 365292f..eed0e86 100644 --- a/xorg-x11-server.changes +++ b/xorg-x11-server.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Apr 17 10:30:46 UTC 2018 - msrb@suse.com + +- U_glx-Do-not-call-into-Composite-if-it-is-disabled.patch + * Fixes crash when GLX is enabled and Composite disabled. + (bnc#1079607) + ------------------------------------------------------------------- Mon Apr 16 08:10:50 UTC 2018 - msrb@suse.com diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 01c97ed..282a9d7 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -236,6 +236,8 @@ Patch1400: U_xfree86-Remove-broken-RANDR-disabling-logic-v4.patch Patch1401: u_randr-Do-not-crash-if-slave-screen-does-not-have-pro.patch Patch1402: n_add-dummy-xf86DisableRandR.patch +Patch1500: U_glx-Do-not-call-into-Composite-if-it-is-disabled.patch + %description This package contains the X.Org Server. @@ -389,6 +391,8 @@ sh %{SOURCE92} --verify . %{SOURCE91} %patch1401 -p1 %patch1402 -p1 +%patch1500 -p1 + %build test -e source-file-list || \ find -L . -type f \! -name '*.orig' \! -path ./source-file-list > \