summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2017-09-06 16:27:54 +0200
committerAdam Jackson <ajax@redhat.com>2017-12-20 15:20:43 -0500
commit22b0880df680aee95e21bb8f93d6dd7d3434c681 (patch)
tree20916172df92c3b0eae03936c2a85c204061b736 /glx
parent1726badd61358e644b96f7c561ba239a68d87ba6 (diff)
glx: Fix visual fbconfig matching with respect to swap method
For the built in visuals, we'd typically select the "best" fbconfig without considering the swap method. If the client then requests a specific swap method, say GLX_SWAP_COPY_OML, it may well happen that the first fbconfig matching requirements would have been paired with the 32-bit compositing visual, and the client would render a potentially transparent window. Fix this so that we try to match fbconfigs with the same swap method to all built-in visuals. That would guarantee that selecting a specific swap- method would not influence the chance of getting a compositing visual. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit 4486d199bd3bcb5b2b8ad9bc54eb11604d9bd653)
Diffstat (limited to 'glx')
-rw-r--r--glx/glxscreens.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 78e0aaff9..00cdce40a 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -279,6 +279,15 @@ pickFBConfig(__GLXscreen * pGlxScreen, VisualPtr visual)
if (config->visualID != 0)
continue;
+ /*
+ * If possible, use the same swapmethod for all built-in visual
+ * fbconfigs, to avoid getting the 32-bit composite visual when
+ * requesting, for example, a SWAP_COPY fbconfig.
+ */
+ if (config->swapMethod == GLX_SWAP_UNDEFINED_OML)
+ score += 32;
+ if (config->swapMethod == GLX_SWAP_EXCHANGE_OML)
+ score += 16;
if (config->doubleBufferMode > 0)
score += 8;
if (config->depthBits > 0)