VirtualBox

source: vbox/trunk/src/VBox/Main/generic/OpenGLTest.cpp@ 29532

Last change on this file since 29532 was 29208, checked in by vboxsync, 15 years ago

3D/win: make 3D support test work again for VBox install path with spaces

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1/* $Id: OpenGLTest.cpp 29208 2010-05-07 13:09:51Z vboxsync $ */
2/** @file
3 * VBox host opengl support test - generic implementation.
4 */
5
6/*
7 * Copyright (C) 2009 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#include <VBox/err.h>
19#include <iprt/assert.h>
20#include <iprt/env.h>
21#include <iprt/param.h>
22#include <iprt/path.h>
23#include <iprt/process.h>
24#include <iprt/string.h>
25#include <iprt/time.h>
26#include <iprt/thread.h>
27
28bool is3DAccelerationSupported()
29{
30 static char pszVBoxPath[RTPATH_MAX];
31 const char *papszArgs[4] = { NULL, "-test", "3D", NULL};
32 int rc;
33 RTPROCESS Process;
34 RTPROCSTATUS ProcStatus;
35 uint64_t StartTS;
36
37 rc = RTPathExecDir(pszVBoxPath, RTPATH_MAX); AssertRCReturn(rc, false);
38#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
39 rc = RTPathAppend(pszVBoxPath, RTPATH_MAX, "VBoxTestOGL.exe");
40#else
41 rc = RTPathAppend(pszVBoxPath, RTPATH_MAX, "VBoxTestOGL");
42#endif
43 papszArgs[0] = pszVBoxPath; /* argv[0] */
44 AssertRCReturn(rc, false);
45
46 rc = RTProcCreate(pszVBoxPath, papszArgs, RTENV_DEFAULT, 0, &Process);
47 if (RT_FAILURE(rc))
48 return false;
49
50 StartTS = RTTimeMilliTS();
51
52 while (1)
53 {
54 rc = RTProcWait(Process, RTPROCWAIT_FLAGS_NOBLOCK, &ProcStatus);
55 if (rc != VERR_PROCESS_RUNNING)
56 break;
57
58 if (RTTimeMilliTS() - StartTS > 30*1000 /* 30 sec */)
59 {
60 RTProcTerminate(Process);
61 RTThreadSleep(100);
62 RTProcWait(Process, RTPROCWAIT_FLAGS_NOBLOCK, &ProcStatus);
63 return false;
64 }
65 RTThreadSleep(100);
66 }
67
68 if (RT_SUCCESS(rc))
69 {
70 if ((ProcStatus.enmReason==RTPROCEXITREASON_NORMAL) && (ProcStatus.iStatus==0))
71 {
72 return true;
73 }
74 }
75
76 return false;
77}
78
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette