VirtualBox

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

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

TestVBoxOGL: fixed -test 3D, more verbose help

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1/* $Id: OpenGLTest.cpp 24005 2009-10-23 06:58:55Z vboxsync $ */
2/** @file
3 * VBox host opengl support test - generic implementation.
4 */
5
6/*
7 * Copyright (C) 2009 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#include <VBox/err.h>
23#include <iprt/assert.h>
24#include <iprt/env.h>
25#include <iprt/param.h>
26#include <iprt/path.h>
27#include <iprt/process.h>
28#include <iprt/string.h>
29#include <iprt/time.h>
30#include <iprt/thread.h>
31
32bool is3DAccelerationSupported()
33{
34 static char pszVBoxPath[RTPATH_MAX];
35 const char *papszArgs[4] = { NULL, "-test", "3D", NULL};
36 int rc;
37 RTPROCESS Process;
38 RTPROCSTATUS ProcStatus;
39 uint64_t StartTS;
40
41 rc = RTPathExecDir(pszVBoxPath, RTPATH_MAX); AssertRCReturn(rc, false);
42#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
43 rc = RTPathAppend(pszVBoxPath, RTPATH_MAX, "VBoxTestOGL.exe");
44#else
45 rc = RTPathAppend(pszVBoxPath, RTPATH_MAX, "VBoxTestOGL");
46#endif
47 AssertRCReturn(rc, false);
48 papszArgs[0] = pszVBoxPath; /* argv[0] */
49
50 rc = RTProcCreate(pszVBoxPath, papszArgs, RTENV_DEFAULT, 0, &Process);
51 if (RT_FAILURE(rc))
52 return false;
53
54 StartTS = RTTimeMilliTS();
55
56 while (1)
57 {
58 rc = RTProcWait(Process, RTPROCWAIT_FLAGS_NOBLOCK, &ProcStatus);
59 if (rc != VERR_PROCESS_RUNNING)
60 break;
61
62 if (RTTimeMilliTS() - StartTS > 30*1000 /* 30 sec */)
63 {
64 RTProcTerminate(Process);
65 RTThreadSleep(100);
66 RTProcWait(Process, RTPROCWAIT_FLAGS_NOBLOCK, &ProcStatus);
67 return false;
68 }
69 RTThreadSleep(100);
70 }
71
72 if (RT_SUCCESS(rc))
73 {
74 if ((ProcStatus.enmReason==RTPROCEXITREASON_NORMAL) && (ProcStatus.iStatus==0))
75 {
76 return true;
77 }
78 }
79
80 return false;
81}
82
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