XWin Server starts but terminates shortly after
Jon Turney
jon.turney@dronecode.org.uk
Thu Nov 19 20:21:00 GMT 2015
On 17/11/2015 15:13, Jon Turney wrote:
> On 13/11/2015 15:13, Thomas Schweikle wrote:
>> Adding "-nowgl" does the trick. XWin is running again.
>
> It seems that this problem manifests itself when running on a Windows
> guest under VMWare, with their SVGA driver.
>
> This seems to be caused by a c0000374 (STATUS_HEAP_CORRUPTION) exception
> raised whilst loading the VMWare OpenGL driver.
This is easy to reduce to just the code that XWin uses to probe the
capabilities of the native OpenGL renderer (attached).
$ gcc -Wall xwin-gl-probe.c -lgdi32 -lopengl32 -o xwin-gl-probe.exe
$ strace ./xwin-gl-probe.exe
[...]
--- Process 2356, exception c0000374 at 0000000077B64102
[...]
If I add a checking with HeapValidate() before the crashing call to
ChoosePixelFormat(), that doesn't report any problems, so that seems to
rule out the heap corruption being introduced by this code.
Compiling the same code with VS 2013 works without problems on my test
VM (VMWare Player 12.0.1 + W7 x64 + VMWare SVGA driver)
This doesn't really get me any further forward though. Does this crash
loading vm3dgl64 because of a bug in vm3dgl64 which is only exposed in
Cygwin? or because the Cygwin environment doesn't satisfy some
requirement of vm3dgl64 that it should?
This isn't the first report of a crash in this probe with various
graphics drivers (although typically the exception is c0000005, which we
can catch and fallback to software rendering), so while it's tempting to
assume this is a problem in the graphics driver, it's possible that
something systematic is wrong.
--
Jon TURNEY
Volunteer Cygwin/X X Server maintainer
-------------- next part --------------
//
// gcc xwin-gl-probe.c -lgdi32 -lopengl32 -o xwin-gl-probe.exe -Wall
//
#include <stdio.h>
#include <windows.h>
int
main(void)
{
HWND hwnd;
HDC hdc;
HGLRC hglrc;
// create window class
#define WIN_GL_TEST_WINDOW_CLASS L"XWinGLTest"
{
static ATOM glTestWndClass = 0;
if (glTestWndClass == 0) {
WNDCLASSEXW wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = DefWindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(NULL);
wc.hIcon = 0;
wc.hCursor = 0;
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = WIN_GL_TEST_WINDOW_CLASS;
wc.hIconSm = 0;
RegisterClassExW(&wc);
}
}
// create an invisible window for a scratch DC
hwnd = CreateWindowExW(0,
WIN_GL_TEST_WINDOW_CLASS,
L"XWin GL Renderer Capabilities Test Window",
WS_OVERLAPPEDWINDOW|WS_VISIBLE, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL),
NULL);
if (hwnd == NULL) {
printf("Couldn't create a window for render capabilities testing\n");
goto error;
}
hdc = GetDC(hwnd);
if (!hdc) {
printf("Couldn't create a DC for render capabilities testing\n");
goto error;
}
// we must set a pixel format before we can create a context
{
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DEPTH_DONTCARE | PFD_DOUBLEBUFFER_DONTCARE | PFD_STEREO_DONTCARE,
PFD_TYPE_RGBA,
24,
0, 0, 0, 0, 0, 0,
0,
0,
0,
0, 0, 0, 0,
0,
0,
0,
PFD_MAIN_PLANE,
0,
0, 0, 0
};
int iPixelFormat = ChoosePixelFormat(hdc, &pfd);
if (iPixelFormat == 0) {
printf("ChoosePixelFormat failed\n");
goto error;
}
if (!SetPixelFormat(hdc, iPixelFormat, NULL)) {
printf("SetPixelFormat %d failed\n", iPixelFormat);
goto error;
}
printf("Testing pixelFormatIndex %d\n",iPixelFormat);
}
hglrc = wglCreateContext(hdc);
if (!wglMakeCurrent(hdc, hglrc)) {
printf("wglMakeCurrent error: %08x dc %p ctx %p\n", (unsigned)GetLastError(), hdc, hglrc);
}
printf("Done\n");
error:
return 0;
}
-------------- next part --------------
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list