Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/platformsupport/eglconvenience/qxlibeglintegration.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | const QLoggingCategory &lcXlibEglDebug() { static const QLoggingCategory category("qt.egl.xlib.debug"); return never executed: category;return category; never executed: }return category; | 0 | ||||||||||||
3 | - | |||||||||||||
4 | VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLDisplay eglDisplay, EGLConfig config) | - | ||||||||||||
5 | { | - | ||||||||||||
6 | VisualID visualId = 0; | - | ||||||||||||
7 | EGLint eglValue = 0; | - | ||||||||||||
8 | - | |||||||||||||
9 | EGLint configRedSize = 0; | - | ||||||||||||
10 | eglGetConfigAttrib(eglDisplay, config, 0x3024, &configRedSize); | - | ||||||||||||
11 | - | |||||||||||||
12 | EGLint configGreenSize = 0; | - | ||||||||||||
13 | eglGetConfigAttrib(eglDisplay, config, 0x3023, &configGreenSize); | - | ||||||||||||
14 | - | |||||||||||||
15 | EGLint configBlueSize = 0; | - | ||||||||||||
16 | eglGetConfigAttrib(eglDisplay, config, 0x3022, &configBlueSize); | - | ||||||||||||
17 | - | |||||||||||||
18 | EGLint configAlphaSize = 0; | - | ||||||||||||
19 | eglGetConfigAttrib(eglDisplay, config, 0x3021, &configAlphaSize); | - | ||||||||||||
20 | - | |||||||||||||
21 | eglGetConfigAttrib(eglDisplay, config, 0x3028, &eglValue); | - | ||||||||||||
22 | int configId = eglValue; | - | ||||||||||||
23 | - | |||||||||||||
24 | - | |||||||||||||
25 | eglGetConfigAttrib(eglDisplay, config, 0x302E, &eglValue); | - | ||||||||||||
26 | visualId = (VisualID)eglValue; | - | ||||||||||||
27 | if (visualId
| 0 | ||||||||||||
28 | - | |||||||||||||
29 | XVisualInfo visualInfoTemplate; | - | ||||||||||||
30 | memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); | - | ||||||||||||
31 | visualInfoTemplate.visualid = visualId; | - | ||||||||||||
32 | - | |||||||||||||
33 | XVisualInfo *chosenVisualInfo; | - | ||||||||||||
34 | int matchingCount = 0; | - | ||||||||||||
35 | chosenVisualInfo = XGetVisualInfo(display, 0x1, &visualInfoTemplate, &matchingCount); | - | ||||||||||||
36 | if (chosenVisualInfo
| 0 | ||||||||||||
37 | - | |||||||||||||
38 | - | |||||||||||||
39 | if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")
| 0 | ||||||||||||
40 | XFree(chosenVisualInfo); | - | ||||||||||||
41 | return never executed: visualId;return visualId; never executed: return visualId; | 0 | ||||||||||||
42 | } | - | ||||||||||||
43 | - | |||||||||||||
44 | const char *vendor = eglQueryString(eglDisplay, 0x3053); | - | ||||||||||||
45 | if (vendor
| 0 | ||||||||||||
46 | XFree(chosenVisualInfo); | - | ||||||||||||
47 | return never executed: visualId;return visualId; never executed: return visualId; | 0 | ||||||||||||
48 | } | - | ||||||||||||
49 | - | |||||||||||||
50 | int visualRedSize = qPopulationCount(chosenVisualInfo->red_mask); | - | ||||||||||||
51 | int visualGreenSize = qPopulationCount(chosenVisualInfo->green_mask); | - | ||||||||||||
52 | int visualBlueSize = qPopulationCount(chosenVisualInfo->blue_mask); | - | ||||||||||||
53 | int visualAlphaSize = chosenVisualInfo->depth == 32
| 0 | ||||||||||||
54 | - | |||||||||||||
55 | const bool visualMatchesConfig = visualRedSize == configRedSize
| 0 | ||||||||||||
56 | && visualGreenSize == configGreenSize
| 0 | ||||||||||||
57 | && visualBlueSize == configBlueSize
| 0 | ||||||||||||
58 | && visualAlphaSize == configAlphaSize
| 0 | ||||||||||||
59 | - | |||||||||||||
60 | - | |||||||||||||
61 | - | |||||||||||||
62 | if (!visualMatchesConfig
| 0 | ||||||||||||
63 | visualId = 0; | - | ||||||||||||
64 | for (bool qt_category_enabled = lcXlibEglDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 109 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d (%d %d %d depth %d) for EGL config %d" "(%d %d %d %d), but this is incompatible", (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, chosenVisualInfo->depth, configId, configRedSize, configGreenSize, configBlueSize, configAlphaSize) ; | 0 | ||||||||||||
65 | 0 | |||||||||||||
66 | 0 | |||||||||||||
67 | 0 | |||||||||||||
68 | __FILE__ never executed: QMessageLogger( __FILE__ , 109 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d (%d %d %d depth %d) for EGL config %d" "(%d %d %d %d), but this is incompatible", (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, chosenVisualInfo->depth, configId, configRedSize, configGreenSize, configBlueSize, configAlphaSize) ; | 0 | ||||||||||||
69 | , never executed: QMessageLogger( __FILE__ , 109 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d (%d %d %d depth %d) for EGL config %d" "(%d %d %d %d), but this is incompatible", (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, chosenVisualInfo->depth, configId, configRedSize, configGreenSize, configBlueSize, configAlphaSize) ; | 0 | ||||||||||||
70 | 0 | |||||||||||||
71 | 0 | |||||||||||||
72 | 0 | |||||||||||||
73 | 109 never executed: QMessageLogger( __FILE__ , 109 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d (%d %d %d depth %d) for EGL config %d" "(%d %d %d %d), but this is incompatible", (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, chosenVisualInfo->depth, configId, configRedSize, configGreenSize, configBlueSize, configAlphaSize) ; | 0 | ||||||||||||
74 | , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d (%d %d %d depth %d) for EGL config %d" "(%d %d %d %d), but this is incompatible", (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, chosenVisualInfo->depth, configId, configRedSize, configGreenSize, configBlueSize, configAlphaSize) never executed: QMessageLogger( __FILE__ , 109 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d (%d %d %d depth %d) for EGL config %d" "(%d %d %d %d), but this is incompatible", (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, chosenVisualInfo->depth, configId, configRedSize, configGreenSize, configBlueSize, configAlphaSize) ; | 0 | ||||||||||||
75 | 0 | |||||||||||||
76 | 0 | |||||||||||||
77 | 0 | |||||||||||||
78 | ; never executed: QMessageLogger( __FILE__ , 109 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d (%d %d %d depth %d) for EGL config %d" "(%d %d %d %d), but this is incompatible", (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, chosenVisualInfo->depth, configId, configRedSize, configGreenSize, configBlueSize, configAlphaSize) ; | 0 | ||||||||||||
79 | } never executed: end of block | 0 | ||||||||||||
80 | } never executed: else {end of block | 0 | ||||||||||||
81 | for (bool qt_category_enabled = lcXlibEglDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 113 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", (int)visualId, configId) ; | 0 | ||||||||||||
82 | __FILE__ never executed: QMessageLogger( __FILE__ , 113 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", (int)visualId, configId) ; | 0 | ||||||||||||
83 | , never executed: QMessageLogger( __FILE__ , 113 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", (int)visualId, configId) ; | 0 | ||||||||||||
84 | 113 never executed: QMessageLogger( __FILE__ , 113 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", (int)visualId, configId) ; | 0 | ||||||||||||
85 | , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", (int)visualId, configId) never executed: QMessageLogger( __FILE__ , 113 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", (int)visualId, configId) ; | 0 | ||||||||||||
86 | ; never executed: QMessageLogger( __FILE__ , 113 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", (int)visualId, configId) ; | 0 | ||||||||||||
87 | visualId = 0; | - | ||||||||||||
88 | } never executed: end of block | 0 | ||||||||||||
89 | XFree(chosenVisualInfo); | - | ||||||||||||
90 | } never executed: end of block | 0 | ||||||||||||
91 | else | - | ||||||||||||
92 | for (bool qt_category_enabled = lcXlibEglDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 119, __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); | 0 | ||||||||||||
93 | - | |||||||||||||
94 | if (visualId
| 0 | ||||||||||||
95 | for (bool qt_category_enabled = lcXlibEglDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 124 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug(configAlphaSize > 0 ? "Using ARGB Visual ID %d provided by EGL for config %d" : "Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId) ; | 0 | ||||||||||||
96 | 0 | |||||||||||||
97 | __FILE__ never executed: QMessageLogger( __FILE__ , 124 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug(configAlphaSize > 0 ? "Using ARGB Visual ID %d provided by EGL for config %d" : "Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId) ; | 0 | ||||||||||||
98 | , never executed: QMessageLogger( __FILE__ , 124 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug(configAlphaSize > 0 ? "Using ARGB Visual ID %d provided by EGL for config %d" : "Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId) ; | 0 | ||||||||||||
99 | 0 | |||||||||||||
100 | 124 never executed: QMessageLogger( __FILE__ , 124 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug(configAlphaSize > 0 ? "Using ARGB Visual ID %d provided by EGL for config %d" : "Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId) ; | 0 | ||||||||||||
101 | , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug(configAlphaSize > 0 ? "Using ARGB Visual ID %d provided by EGL for config %d" : "Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId) never executed: QMessageLogger( __FILE__ , 124 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug(configAlphaSize > 0 ? "Using ARGB Visual ID %d provided by EGL for config %d" : "Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId) ; | 0 | ||||||||||||
102 | 0 | |||||||||||||
103 | ; never executed: QMessageLogger( __FILE__ , 124 , __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug(configAlphaSize > 0 ? "Using ARGB Visual ID %d provided by EGL for config %d" : "Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId) ; | 0 | ||||||||||||
104 | return never executed: visualId;return visualId; never executed: return visualId; | 0 | ||||||||||||
105 | } | - | ||||||||||||
106 | - | |||||||||||||
107 | - | |||||||||||||
108 | if (!visualId
| 0 | ||||||||||||
109 | XVisualInfo visualInfoTemplate; | - | ||||||||||||
110 | memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); | - | ||||||||||||
111 | XVisualInfo *matchingVisuals; | - | ||||||||||||
112 | int matchingCount = 0; | - | ||||||||||||
113 | - | |||||||||||||
114 | visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; | - | ||||||||||||
115 | matchingVisuals = XGetVisualInfo(display, | - | ||||||||||||
116 | 0x4, | - | ||||||||||||
117 | &visualInfoTemplate, | - | ||||||||||||
118 | &matchingCount); | - | ||||||||||||
119 | if (!matchingVisuals
| 0 | ||||||||||||
120 | - | |||||||||||||
121 | visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; | - | ||||||||||||
122 | matchingVisuals = XGetVisualInfo(display, | - | ||||||||||||
123 | 0x4, | - | ||||||||||||
124 | &visualInfoTemplate, | - | ||||||||||||
125 | &matchingCount); | - | ||||||||||||
126 | } never executed: end of block | 0 | ||||||||||||
127 | - | |||||||||||||
128 | if (matchingVisuals
| 0 | ||||||||||||
129 | visualId = matchingVisuals[0].visualid; | - | ||||||||||||
130 | XFree(matchingVisuals); | - | ||||||||||||
131 | } never executed: end of block | 0 | ||||||||||||
132 | } never executed: end of block | 0 | ||||||||||||
133 | - | |||||||||||||
134 | if (visualId
| 0 | ||||||||||||
135 | for (bool qt_category_enabled = lcXlibEglDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 156, __PRETTY_FUNCTION__, lcXlibEglDebug().categoryName()).debug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); | 0 | ||||||||||||
136 | return never executed: visualId;return visualId; never executed: return visualId; | 0 | ||||||||||||
137 | } | - | ||||||||||||
138 | - | |||||||||||||
139 | QMessageLogger(__FILE__, 160, __PRETTY_FUNCTION__).warning("Unable to find an X11 visual which matches EGL config %d", configId); | - | ||||||||||||
140 | return never executed: (VisualID)0;return (VisualID)0; never executed: return (VisualID)0; | 0 | ||||||||||||
141 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |