1 | /* $Id: check3d.cpp 64114 2016-09-30 19:26:47Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * X11 guest client - 3D pass-through check.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011-2016 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 "VBoxClient.h"
|
---|
19 |
|
---|
20 | #include <VBox/VBoxGuest.h>
|
---|
21 | #include <VBox/VBoxGuestLib.h>
|
---|
22 | #include <VBox/HostServices/VBoxCrOpenGLSvc.h>
|
---|
23 | #include "../../common/VBoxGuestLib/VBGLR3Internal.h" /* HACK ALERT! Using vbglR3DoIOCtl directly!! */
|
---|
24 |
|
---|
25 | #include <stdlib.h>
|
---|
26 |
|
---|
27 | #define CR_VBOX_CAP_HOST_CAPS_NOT_SUFFICIENT 0x00000020
|
---|
28 |
|
---|
29 | static int run(struct VBCLSERVICE **ppInterface, bool fDaemonised)
|
---|
30 | {
|
---|
31 | int rc;
|
---|
32 | HGCMCLIENTID cClientID;
|
---|
33 | CRVBOXHGCMGETCAPS caps;
|
---|
34 | LogFlowFunc(("\n"));
|
---|
35 |
|
---|
36 | NOREF(ppInterface);
|
---|
37 | NOREF(fDaemonised);
|
---|
38 | /* Initialise the guest library. */
|
---|
39 | rc = VbglR3InitUser();
|
---|
40 | if (RT_FAILURE(rc))
|
---|
41 | exit(1);
|
---|
42 | rc = VbglR3HGCMConnect("VBoxSharedCrOpenGL", &cClientID);
|
---|
43 | if (RT_FAILURE(rc))
|
---|
44 | exit(1);
|
---|
45 | caps.hdr.result = VERR_WRONG_ORDER;
|
---|
46 | caps.hdr.u32ClientID = cClientID;
|
---|
47 | caps.hdr.u32Function = SHCRGL_GUEST_FN_GET_CAPS_LEGACY;
|
---|
48 | caps.hdr.cParms = SHCRGL_CPARMS_GET_CAPS_LEGACY;
|
---|
49 |
|
---|
50 | caps.Caps.type = VMMDevHGCMParmType_32bit;
|
---|
51 | caps.Caps.u.value32 = 0;
|
---|
52 |
|
---|
53 | rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(caps)), &caps, sizeof(caps));
|
---|
54 | if (RT_FAILURE(rc))
|
---|
55 | exit(1);
|
---|
56 | if (caps.Caps.u.value32 & CR_VBOX_CAP_HOST_CAPS_NOT_SUFFICIENT)
|
---|
57 | exit(1);
|
---|
58 | VbglR3HGCMDisconnect(cClientID);
|
---|
59 | VbglR3Term();
|
---|
60 | LogFlowFunc(("returning %Rrc\n", rc));
|
---|
61 | return rc;
|
---|
62 | }
|
---|
63 |
|
---|
64 | static struct VBCLSERVICE g_vbclCheck3DInterface =
|
---|
65 | {
|
---|
66 | NULL,
|
---|
67 | VBClServiceDefaultHandler, /* init */
|
---|
68 | run,
|
---|
69 | VBClServiceDefaultCleanup
|
---|
70 | };
|
---|
71 | static struct VBCLSERVICE *g_pvbclCheck3DInterface = &g_vbclCheck3DInterface;
|
---|
72 |
|
---|
73 | /* Static factory */
|
---|
74 | struct VBCLSERVICE **VBClCheck3DService()
|
---|
75 | {
|
---|
76 | return &g_pvbclCheck3DInterface;
|
---|
77 | }
|
---|
78 |
|
---|