1 | /* $Id: check3d.cpp 76553 2019-01-01 01:45:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * X11 guest client - 3D pass-through check.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011-2019 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 |
|
---|
24 | #include <stdlib.h>
|
---|
25 |
|
---|
26 | #define CR_VBOX_CAP_HOST_CAPS_NOT_SUFFICIENT 0x00000020
|
---|
27 |
|
---|
28 | static int run(struct VBCLSERVICE **ppInterface, bool fDaemonised)
|
---|
29 | {
|
---|
30 | int rc;
|
---|
31 | HGCMCLIENTID idClient;
|
---|
32 | CRVBOXHGCMGETCAPS caps;
|
---|
33 | LogFlowFunc(("\n"));
|
---|
34 |
|
---|
35 | NOREF(ppInterface);
|
---|
36 | NOREF(fDaemonised);
|
---|
37 | /* Initialise the guest library. */
|
---|
38 | rc = VbglR3InitUser();
|
---|
39 | if (RT_FAILURE(rc))
|
---|
40 | exit(1);
|
---|
41 | rc = VbglR3HGCMConnect("VBoxSharedCrOpenGL", &idClient);
|
---|
42 | if (RT_FAILURE(rc))
|
---|
43 | exit(1);
|
---|
44 |
|
---|
45 | VBGL_HGCM_HDR_INIT(&caps.hdr, idClient, SHCRGL_GUEST_FN_GET_CAPS_LEGACY, SHCRGL_CPARMS_GET_CAPS_LEGACY);
|
---|
46 | caps.Caps.type = VMMDevHGCMParmType_32bit;
|
---|
47 | caps.Caps.u.value32 = 0;
|
---|
48 | rc = VbglR3HGCMCall(&caps.hdr, sizeof(caps));
|
---|
49 | if (RT_FAILURE(rc))
|
---|
50 | exit(1);
|
---|
51 | if (caps.Caps.u.value32 & CR_VBOX_CAP_HOST_CAPS_NOT_SUFFICIENT)
|
---|
52 | exit(1);
|
---|
53 | VbglR3HGCMDisconnect(idClient);
|
---|
54 | VbglR3Term();
|
---|
55 | LogFlowFunc(("returning %Rrc\n", rc));
|
---|
56 | return rc;
|
---|
57 | }
|
---|
58 |
|
---|
59 | static struct VBCLSERVICE g_vbclCheck3DInterface =
|
---|
60 | {
|
---|
61 | NULL,
|
---|
62 | VBClServiceDefaultHandler, /* init */
|
---|
63 | run,
|
---|
64 | VBClServiceDefaultCleanup
|
---|
65 | };
|
---|
66 | static struct VBCLSERVICE *g_pvbclCheck3DInterface = &g_vbclCheck3DInterface;
|
---|
67 |
|
---|
68 | /* Static factory */
|
---|
69 | struct VBCLSERVICE **VBClCheck3DService()
|
---|
70 | {
|
---|
71 | return &g_pvbclCheck3DInterface;
|
---|
72 | }
|
---|
73 |
|
---|