VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.cpp@ 78190

最後變更 在這個檔案從78190是 78190,由 vboxsync 提交於 6 年 前

Merge first stage of the Chromium cleanup from the branch:

  • r129818 (Remove VBOX_WITH_CR_DISPLAY_LISTS and accompanying code as it was disabled since r108676 and was never brought back (see ​bugref:3456 and ​bugref:8485))
  • r129819 (HostServices/SharedOpenGL: Remove unused main entry point from upstream server process based implementation)
  • r129820 (HostServices/SharedOpenGL: Started eliminating all backends other than HGCM. They are not used and probably wouldn't work anymore anyway)
  • r129821 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill crTimer* API as it is not used anywhere)
  • r129822 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill most from cr_process.h apart from two used methods)
  • r129823 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill crList* API as it is unused)
  • r129824 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill crHullInteriorBox API as it is unused)
  • r129825 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill crWarpPoint API as it is unused)
  • r129826 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill CrSa* API as it is unused and not even compiled in)
  • r129827 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill cr_bbox.h as it is unused)
  • r129828 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove a few crParseUrl() two uses)
  • r129829 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove last crParseURL() use)
  • r129830 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove crParseURL())
  • r129831 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove VBOX_WITH_COCOA_QT and related code when not set as it is the default for years now and we don't support anything else anymore)
  • r129832 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_logo.h)
  • r129833 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused crut_api.h and crut_clientapi.h)
  • r129834 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_dmx.h)
  • r129835 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_perf.h)
  • r129836 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove cr_rand.h and friends as it is not actively used anywhere)
  • r129837 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of all the swapped versions in the packer SPU, we never change endianess from guest to host and don't need it)
  • r129838 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129839 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129840 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused pack_pica.c)
  • r129841 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129842 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of cr_endianess.h and friends)
  • r129843 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused lowercase.py)
  • r129844 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused cr_calllists.h and friends)
  • r129845 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of completely unused idpool.c, not even compiled in)
  • r129846 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused cr_debugopcodes.h and friends)
  • r129847 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Make the cr_mem.h API inline and get rid of the implementation in the util library)
  • r129848 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of SPUOptions and related code as it is of no use for us)
  • r129849 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of cr_environment.h and friends and convert usage to RTEnv* APIs)
  • r129850 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused renderspu_agl.c)
  • r129851 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused code in cr_htable.h)
  • r129853 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Introduce a state paremeter for the unpacker workers instead of reyling on global variables, work in progress)
  • r129854 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Let the caller of crUnpack set up the initial state. This allows to get rid of the global return_ptr and writeback_ptr as they get supplied in the unpacker state by the server)
  • r129855 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of the cr_lastDispatch and cr_unpackDispatch as they are of no use now)
  • r129856 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of the global cr_unpackData and cr_unpackDataEnd symbols by indtroducing another hack to make it possible for certail server dispatch callbacks to access the data buffer)
  • r129857 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: build fix for release builds)
  • r129858 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Make the pointer to the unpacker state non const (is required for the access verification))
  • r129859 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: First iteration of the buffer size validation to prevent out of bound read access + added todos for places where additional checks are needed)
  • r129860 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129861 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129871 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129872 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Stop as soon as the unpacker encountered an error)
  • r129876 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129880 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129882 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Fixed some offsets in unpack_texture.c, 3DMark03 renders correctly again)
  • r130013 (HostServices/SharedOpenGL: Convert files to C++ so we can use C99 featuers on Windows with cl.exe)
  • r130014 (HostServices/SharedOpenGL,GuestHost/OpenGL: WIndows build fixes)
  • r130015 (HostServices/SharedOpenGL,GuestHost/OpenGL: More Windows build fixes)
  • r130036 (Config.kmk: Fix linker error on Windows by temporarily disabling the use of VBoxGuestR3DllMinW2K)
  • r130094 (src/VBox/GuestHost/OpenGL: Revert inlining the allocation/free functions in R3 completely as it doesn't work on Windows if memory is allocated and freed across different DLLs which don't share a common CRT, causes crashes in RtlValidtaeHeap())
  • r130095 (src/VBox/GuestHost/OpenGL,src/VBox/Additions/common/crOpenGL/pack: Don't use floating point specifiers in packspu_GetString() to avoid R6002 errors (couldn't fully understand why they occur suddenly after the rework but this gets rid of it))
  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id Revision
檔案大小: 5.7 KB
 
1 /* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include <string.h>
8#include "cr_mem.h"
9#include "cr_string.h"
10#include "cr_error.h"
11#include "cr_glstate.h"
12#include "server.h"
13
14#include <iprt/env.h>
15
16#ifdef WINDOWS
17#pragma warning( disable: 4706 )
18#endif
19
20static void
21setDefaults(void)
22{
23 cr_server.run_queue = NULL;
24 cr_server.optimizeBucket = 1;
25 cr_server.useL2 = 0;
26 cr_server.maxBarrierCount = 0;
27 cr_server.ignore_papi = 0;
28 cr_server.only_swap_once = 0;
29 cr_server.overlapBlending = 0;
30 cr_server.debug_barriers = 0;
31 cr_server.sharedDisplayLists = 0;
32 cr_server.sharedTextureObjects = 0;
33 cr_server.sharedPrograms = 0;
34 cr_server.sharedWindows = 0;
35 cr_server.useDMX = 0;
36 cr_server.vpProjectionMatrixParameter = -1;
37 cr_server.vpProjectionMatrixVariable = NULL;
38 cr_server.currentProgram = 0;
39
40 cr_server.num_overlap_intens = 0;
41 cr_server.overlap_intens = 0;
42 crMemset(&cr_server.MainContextInfo, 0, sizeof (cr_server.MainContextInfo));
43
44 crMatrixInit(&cr_server.viewMatrix[0]);
45 crMatrixInit(&cr_server.viewMatrix[1]);
46 crMatrixInit(&cr_server.projectionMatrix[0]);
47 crMatrixInit(&cr_server.projectionMatrix[1]);
48 cr_server.currentEye = -1;
49
50 cr_server.uniqueWindows = 0;
51
52 cr_server.screenCount = 0;
53 cr_server.bUsePBOForReadback = GL_FALSE;
54 cr_server.bWindowsInitiallyHidden = GL_FALSE;
55
56 cr_server.pfnNotifyEventCB = NULL;
57}
58
59/* Check if host reports minimal OpenGL capabilities.
60 *
61 * Require OpenGL 2.1 or later.
62 *
63 * For example, on Windows host this may happen if host has no graphics
64 * card drivers installed or drivers were not properly signed or VBox
65 * is running via remote desktop session etc. Currently, we take care
66 * about Windows host only when specific RENDERER and VERSION strings
67 * returned in this case. Later this check should be expanded to the
68 * rest of hosts. */
69static bool crServerHasInsufficientCaps()
70{
71 const char *pszRealVersion;
72 int rc;
73 uint32_t u32VerMajor = 0;
74 uint32_t u32VerMinor = 0;
75 char *pszNext = NULL;
76
77 if (!cr_server.head_spu)
78 return true;
79
80 pszRealVersion = (const char *)cr_server.head_spu->dispatch_table.GetString(GL_REAL_VERSION);
81 if (!pszRealVersion)
82 return true; /* No version == insufficient. */
83
84 rc = RTStrToUInt32Ex(pszRealVersion, &pszNext, 10, &u32VerMajor);
85 if ( RT_SUCCESS(rc)
86 && *pszNext == '.')
87 RTStrToUInt32Ex(pszNext + 1, NULL, 10, &u32VerMinor);
88
89 crInfo("Host supports version %d.%d [%s]", u32VerMajor, u32VerMinor, pszRealVersion);
90
91 if ( u32VerMajor > 2
92 || (u32VerMajor == 2 && u32VerMinor >= 1))
93 return false; /* >= 2.1, i.e. good enough. */
94
95 return true; /* Insufficient. */
96}
97
98void crServerSetVBoxConfigurationHGCM()
99{
100 CRMuralInfo *defaultMural;
101
102 int spu_ids[1] = {0};
103 char *spu_names[1] = {"render"};
104 char *spu_dir = NULL;
105 int i;
106 GLint dims[4];
107 const char * env;
108
109 defaultMural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, 0);
110 CRASSERT(defaultMural);
111
112 /// @todo should be moved to addclient so we have a chain for each client
113
114 setDefaults();
115
116 /* Load the SPUs */
117 cr_server.head_spu = crSPULoadChain(1, spu_ids, spu_names, spu_dir, &cr_server);
118
119 if (!cr_server.head_spu)
120 return;
121
122
123 env = RTEnvGet( "CR_SERVER_DEFAULT_VISUAL_BITS" );
124 if (env != NULL && env[0] != '\0')
125 {
126 unsigned int bits = (unsigned int)crStrParseI32(env, 0);
127 if (bits <= CR_ALL_BITS)
128 cr_server.fVisualBitsDefault = bits;
129 else
130 crWarning("invalid bits option %c", bits);
131 }
132 else
133 cr_server.fVisualBitsDefault = CR_RGB_BIT | CR_ALPHA_BIT | CR_DOUBLE_BIT;
134
135
136 env = RTEnvGet("CR_SERVER_CAPS");
137 if (env && env[0] != '\0')
138 {
139 cr_server.u32Caps = crStrParseI32(env, 0);
140 cr_server.u32Caps &= CR_VBOX_CAPS_ALL;
141 }
142 else
143 {
144 cr_server.u32Caps = CR_VBOX_CAP_TEX_PRESENT
145 | CR_VBOX_CAP_CMDVBVA
146 | CR_VBOX_CAP_CMDBLOCKS
147 | CR_VBOX_CAP_GETATTRIBSLOCATIONS
148 | CR_VBOX_CAP_CMDBLOCKS_FLUSH
149 ;
150 }
151
152 if (crServerHasInsufficientCaps())
153 {
154 crDebug("Cfg: report minimal OpenGL capabilities");
155 cr_server.u32Caps |= CR_VBOX_CAP_HOST_CAPS_NOT_SUFFICIENT;
156 }
157
158 crInfo("Cfg: u32Caps(%#x), fVisualBitsDefault(%#x)",
159 cr_server.u32Caps,
160 cr_server.fVisualBitsDefault);
161
162 cr_server.head_spu->dispatch_table.GetChromiumParametervCR(GL_WINDOW_POSITION_CR, 0, GL_INT, 2, &dims[0]);
163 cr_server.head_spu->dispatch_table.GetChromiumParametervCR(GL_WINDOW_SIZE_CR, 0, GL_INT, 2, &dims[2]);
164
165 defaultMural->gX = dims[0];
166 defaultMural->gY = dims[1];
167 defaultMural->width = dims[2];
168 defaultMural->height = dims[3];
169
170 cr_server.mtu = 1024 * 250;
171
172 cr_server.numClients = 0;
173 strcpy(cr_server.protocol, "vboxhgcm");
174
175 for (i = 0; i < cr_server.numClients; i++)
176 {
177 CRClient *newClient = (CRClient *) crCalloc(sizeof(CRClient));
178 newClient->spu_id = 0;
179 newClient->conn = crNetAcceptClient(cr_server.protocol, NULL,
180 cr_server.tcpip_port,
181 cr_server.mtu, 0);
182 newClient->currentCtxInfo = &cr_server.MainContextInfo;
183 crServerAddToRunQueue(newClient);
184
185 cr_server.clients[i] = newClient;
186 }
187
188 /* set default client and mural */
189 if (cr_server.numClients > 0) {
190 cr_server.curClient = cr_server.clients[0];
191 cr_server.curClient->currentMural = defaultMural;
192 cr_server.client_spu_id =cr_server.clients[0]->spu_id;
193 }
194}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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