mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-20 04:40:02 +01:00
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> (cherry picked from commit1326ee0bc5)
This commit is contained in:
parent
b39e5c4080
commit
9f72dc854b
2 changed files with 54 additions and 40 deletions
|
|
@ -35,6 +35,7 @@
|
|||
#include <GL/glxtokens.h>
|
||||
#include <GL/internal/dri_interface.h>
|
||||
#include <os.h>
|
||||
#include "extinit.h"
|
||||
#include "glxserver.h"
|
||||
#include "glxext.h"
|
||||
#include "glxcontext.h"
|
||||
|
|
@ -206,28 +207,30 @@ createModeFromConfig(const __DRIcoreExtension * core,
|
|||
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.redBits != 8 ||
|
||||
config->config.greenBits != 8 ||
|
||||
config->config.blueBits != 8 ||
|
||||
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.redBits != 8 ||
|
||||
config->config.greenBits != 8 ||
|
||||
config->config.blueBits != 8 ||
|
||||
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;
|
||||
|
|
@ -261,14 +264,16 @@ glxConvertConfigs(const __DRIcoreExtension * core,
|
|||
}
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include <os.h>
|
||||
#include <colormapst.h>
|
||||
|
||||
#include "extinit.h"
|
||||
#include "privates.h"
|
||||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
|
|
@ -287,10 +288,12 @@ pickFBConfig(__GLXscreen * pGlxScreen, VisualPtr visual)
|
|||
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
|
||||
|
|
@ -360,8 +363,10 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
|
|||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -383,10 +388,12 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
|
|||
*/
|
||||
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).
|
||||
|
|
@ -411,8 +418,10 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
|
|||
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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue