glx: Do not call into Composite if it is disabled.
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 <msrb@suse.com>
This commit is contained in:
parent
b9764b8489
commit
1326ee0bc5
|
@ -35,6 +35,7 @@
|
||||||
#include <GL/glxtokens.h>
|
#include <GL/glxtokens.h>
|
||||||
#include <GL/internal/dri_interface.h>
|
#include <GL/internal/dri_interface.h>
|
||||||
#include <os.h>
|
#include <os.h>
|
||||||
|
#include "extinit.h"
|
||||||
#include "glxserver.h"
|
#include "glxserver.h"
|
||||||
#include "glxext.h"
|
#include "glxext.h"
|
||||||
#include "glxcontext.h"
|
#include "glxcontext.h"
|
||||||
|
@ -183,28 +184,30 @@ createModeFromConfig(const __DRIcoreExtension * core,
|
||||||
config->config.yInverted = GL_TRUE;
|
config->config.yInverted = GL_TRUE;
|
||||||
|
|
||||||
#ifdef COMPOSITE
|
#ifdef COMPOSITE
|
||||||
/*
|
if (!noCompositeExtension) {
|
||||||
* Here we decide what fbconfigs will be duplicated for compositing.
|
/*
|
||||||
* fgbconfigs marked with duplicatedForConf will be reserved for
|
* Here we decide what fbconfigs will be duplicated for compositing.
|
||||||
* compositing visuals.
|
* fgbconfigs marked with duplicatedForConf will be reserved for
|
||||||
* It might look strange to do this decision this late when translation
|
* compositing visuals.
|
||||||
* from a __DRIConfig is already done, but using the __DRIConfig
|
* It might look strange to do this decision this late when translation
|
||||||
* accessor function becomes worse both with respect to code complexity
|
* from a __DRIConfig is already done, but using the __DRIConfig
|
||||||
* and CPU usage.
|
* accessor function becomes worse both with respect to code complexity
|
||||||
*/
|
* and CPU usage.
|
||||||
if (duplicateForComp &&
|
*/
|
||||||
(render_type_is_pbuffer_only(renderType) ||
|
if (duplicateForComp &&
|
||||||
config->config.rgbBits != 32 ||
|
(render_type_is_pbuffer_only(renderType) ||
|
||||||
config->config.redBits != 8 ||
|
config->config.rgbBits != 32 ||
|
||||||
config->config.greenBits != 8 ||
|
config->config.redBits != 8 ||
|
||||||
config->config.blueBits != 8 ||
|
config->config.greenBits != 8 ||
|
||||||
config->config.visualRating != GLX_NONE ||
|
config->config.blueBits != 8 ||
|
||||||
config->config.sampleBuffers != 0)) {
|
config->config.visualRating != GLX_NONE ||
|
||||||
free(config);
|
config->config.sampleBuffers != 0)) {
|
||||||
return NULL;
|
free(config);
|
||||||
}
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
config->config.duplicatedForComp = duplicateForComp;
|
config->config.duplicatedForComp = duplicateForComp;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return &config->config;
|
return &config->config;
|
||||||
|
@ -238,14 +241,16 @@ glxConvertConfigs(const __DRIcoreExtension * core,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef COMPOSITE
|
#ifdef COMPOSITE
|
||||||
/* Duplicate fbconfigs for use with compositing visuals */
|
if (!noCompositeExtension) {
|
||||||
for (i = 0; configs[i]; i++) {
|
/* Duplicate fbconfigs for use with compositing visuals */
|
||||||
tail->next = createModeFromConfig(core, configs[i], GLX_TRUE_COLOR,
|
for (i = 0; configs[i]; i++) {
|
||||||
GL_TRUE);
|
tail->next = createModeFromConfig(core, configs[i], GLX_TRUE_COLOR,
|
||||||
if (tail->next == NULL)
|
GL_TRUE);
|
||||||
continue;
|
if (tail->next == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
tail = tail->next;
|
tail = tail->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <os.h>
|
#include <os.h>
|
||||||
#include <colormapst.h>
|
#include <colormapst.h>
|
||||||
|
|
||||||
|
#include "extinit.h"
|
||||||
#include "privates.h"
|
#include "privates.h"
|
||||||
#include "glxserver.h"
|
#include "glxserver.h"
|
||||||
#include "glxutil.h"
|
#include "glxutil.h"
|
||||||
|
@ -280,10 +281,12 @@ pickFBConfig(__GLXscreen * pGlxScreen, VisualPtr visual)
|
||||||
if (config->visualID != 0)
|
if (config->visualID != 0)
|
||||||
continue;
|
continue;
|
||||||
#ifdef COMPOSITE
|
#ifdef COMPOSITE
|
||||||
/* Use only duplicated configs for compIsAlternateVisuals */
|
if (!noCompositeExtension) {
|
||||||
if (!!compIsAlternateVisual(pGlxScreen->pScreen, visual->vid) !=
|
/* Use only duplicated configs for compIsAlternateVisuals */
|
||||||
!!config->duplicatedForComp)
|
if (!!compIsAlternateVisual(pGlxScreen->pScreen, visual->vid) !=
|
||||||
continue;
|
!!config->duplicatedForComp)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* If possible, use the same swapmethod for all built-in visual
|
* If possible, use the same swapmethod for all built-in visual
|
||||||
|
@ -353,8 +356,10 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
|
||||||
pGlxScreen->visuals[pGlxScreen->numVisuals++] = config;
|
pGlxScreen->visuals[pGlxScreen->numVisuals++] = config;
|
||||||
config->visualID = visual->vid;
|
config->visualID = visual->vid;
|
||||||
#ifdef COMPOSITE
|
#ifdef COMPOSITE
|
||||||
if (compIsAlternateVisual(pScreen, visual->vid))
|
if (!noCompositeExtension) {
|
||||||
config->visualSelectGroup++;
|
if (compIsAlternateVisual(pScreen, visual->vid))
|
||||||
|
config->visualSelectGroup++;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,10 +381,12 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
|
||||||
*/
|
*/
|
||||||
depth = config->redBits + config->greenBits + config->blueBits;
|
depth = config->redBits + config->greenBits + config->blueBits;
|
||||||
#ifdef COMPOSITE
|
#ifdef COMPOSITE
|
||||||
if (config->duplicatedForComp) {
|
if (!noCompositeExtension) {
|
||||||
depth += config->alphaBits;
|
if (config->duplicatedForComp) {
|
||||||
config->visualSelectGroup++;
|
depth += config->alphaBits;
|
||||||
}
|
config->visualSelectGroup++;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Make sure that our FBconfig's depth can actually be displayed
|
/* Make sure that our FBconfig's depth can actually be displayed
|
||||||
* (corresponds to an existing visual).
|
* (corresponds to an existing visual).
|
||||||
|
@ -404,8 +411,10 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef COMPOSITE
|
#ifdef COMPOSITE
|
||||||
if (config->duplicatedForComp)
|
if (!noCompositeExtension) {
|
||||||
(void) CompositeRegisterAlternateVisuals(pScreen, &visual->vid, 1);
|
if (config->duplicatedForComp)
|
||||||
|
(void) CompositeRegisterAlternateVisuals(pScreen, &visual->vid, 1);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
pGlxScreen->visuals[pGlxScreen->numVisuals++] = config;
|
pGlxScreen->visuals[pGlxScreen->numVisuals++] = config;
|
||||||
initGlxVisual(visual, config);
|
initGlxVisual(visual, config);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user