VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTest.cpp@ 51670

Last change on this file since 51670 was 50406, checked in by vboxsync, 11 years ago

Some RTEnvGet cleanup, adding todos for the rest.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1/* $Id: OpenGLTest.cpp 50406 2014-02-10 20:35:11Z vboxsync $ */
2/** @file
3 * VBox host opengl support test - generic implementation.
4 */
5
6/*
7 * Copyright (C) 2009-2012 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#include <iprt/env.h>
28#include <iprt/log.h>
29
30#include <VBox/VBoxOGLTest.h>
31
32bool RTCALL VBoxOglIs3DAccelerationSupported()
33{
34 if (RTEnvExist("VBOX_CROGL_FORCE_SUPPORTED"))
35 {
36 LogRel(("VBOX_CROGL_FORCE_SUPPORTED is specified, skipping 3D test, and treating as supported\n"));
37 return true;
38 }
39
40 static char pszVBoxPath[RTPATH_MAX];
41 const char *papszArgs[4] = { NULL, "-test", "3D", NULL};
42 int rc;
43 RTPROCESS Process;
44 RTPROCSTATUS ProcStatus;
45 uint64_t StartTS;
46
47 rc = RTPathExecDir(pszVBoxPath, RTPATH_MAX); AssertRCReturn(rc, false);
48#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
49 rc = RTPathAppend(pszVBoxPath, RTPATH_MAX, "VBoxTestOGL.exe");
50#else
51 rc = RTPathAppend(pszVBoxPath, RTPATH_MAX, "VBoxTestOGL");
52#endif
53 papszArgs[0] = pszVBoxPath; /* argv[0] */
54 AssertRCReturn(rc, false);
55
56 rc = RTProcCreate(pszVBoxPath, papszArgs, RTENV_DEFAULT, 0, &Process);
57 if (RT_FAILURE(rc))
58 return false;
59
60 StartTS = RTTimeMilliTS();
61
62 while (1)
63 {
64 rc = RTProcWait(Process, RTPROCWAIT_FLAGS_NOBLOCK, &ProcStatus);
65 if (rc != VERR_PROCESS_RUNNING)
66 break;
67
68#ifndef DEBUG_misha
69 if (RTTimeMilliTS() - StartTS > 30*1000 /* 30 sec */)
70 {
71 RTProcTerminate(Process);
72 RTThreadSleep(100);
73 RTProcWait(Process, RTPROCWAIT_FLAGS_NOBLOCK, &ProcStatus);
74 return false;
75 }
76#endif
77 RTThreadSleep(100);
78 }
79
80 if (RT_SUCCESS(rc))
81 {
82 if ((ProcStatus.enmReason==RTPROCEXITREASON_NORMAL) && (ProcStatus.iStatus==0))
83 {
84 return true;
85 }
86 }
87
88 return false;
89}
90
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