Changeset 82680 in vbox for trunk/src/VBox/Additions/x11/VBoxClient
- Timestamp:
- Jan 8, 2020 8:06:11 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/display-svga.cpp
r82674 r82680 89 89 AssertCompileSize(struct DRMVMWRECT, 16); 90 90 91 struct DISPLAYCACHE 92 { 93 int fEnabled; 94 struct DRMVMWRECT rect; 95 }; 96 91 97 #define DRM_IOCTL_VERSION _IOWR('d', 0x00, struct DRMVERSION) 92 98 … … 95 101 RTFILE hDevice; 96 102 }; 103 104 struct DISPLAYCACHE aRects[VMW_MAX_HEADS]; 97 105 98 106 static void drmConnect(struct DRMCONTEXT *pContext) … … 182 190 (void)fDaemonised; 183 191 struct DRMCONTEXT drmContext = { NIL_RTFILE }; 184 unsigned i; 192 185 193 int rc; 186 struct DRMVMWRECT aRects[VMW_MAX_HEADS];187 194 unsigned cHeads; 188 195 /* Do not acknowledge the first event we query for to pick up old events, 189 196 * e.g. from before a guest reboot. */ 190 197 bool fAck = false; 191 192 198 drmConnect(&drmContext); 193 199 if (drmContext.hDevice == NIL_RTFILE) … … 201 207 if (RT_FAILURE(rc)) 202 208 VBClLogFatalError("Failed to register resizing support, rc=%Rrc\n", rc); 209 210 /* For the time being we initialize all the monitors as disabled as per VMM device initialization. */ 211 for (int i = 0; i < VMW_MAX_HEADS; ++i) 212 aRects[i].fEnabled = 0; 213 203 214 for (;;) 204 215 { … … 217 228 if (cDisplaysOut > 0) 218 229 { 219 cHeads = 0; 220 for (i = 0; i < cDisplaysOut && i < VMW_MAX_HEADS; ++i) 230 for (unsigned i = 0; i < cDisplaysOut && i < VMW_MAX_HEADS; ++i) 221 231 { 232 uint32_t idDisplay = aDisplays[i].idDisplay; 233 if (idDisplay >= VMW_MAX_HEADS) 234 continue; 222 235 if (!(aDisplays[i].fDisplayFlags & VMMDEV_DISPLAY_DISABLED)) 223 236 { 224 if ((i == 0) || (aDisplays[i].fDisplayFlags & VMMDEV_DISPLAY_ORIGIN))237 if ((idDisplay == 0) || (aDisplays[i].fDisplayFlags & VMMDEV_DISPLAY_ORIGIN)) 225 238 { 226 aRects[ cHeads].x = aDisplays[i].xOrigin;227 aRects[ cHeads].y = aDisplays[i].yOrigin;239 aRects[idDisplay].rect.x = aDisplays[i].xOrigin; 240 aRects[idDisplay].rect.y = aDisplays[i].yOrigin; 228 241 } else { 229 aRects[ cHeads].x = aRects[cHeads - 1].x + aRects[cHeads - 1].w;230 aRects[ cHeads].y = aRects[cHeads - 1].y;242 aRects[idDisplay].rect.x = aRects[idDisplay - 1].rect.x + aRects[idDisplay - 1].rect.w; 243 aRects[idDisplay].rect.y = aRects[idDisplay - 1].rect.y; 231 244 } 232 aRects[cHeads].w = aDisplays[i].cx; 233 aRects[cHeads].h = aDisplays[i].cy; 245 aRects[idDisplay].rect.w = aDisplays[i].cx; 246 aRects[idDisplay].rect.h = aDisplays[i].cy; 247 aRects[idDisplay].fEnabled = 1; 248 } 249 else 250 aRects[idDisplay].fEnabled = 0; 251 } 252 /* Create an dense (consisting of enable monitors only) array to pass to DRM. */ 253 cHeads = 0; 254 struct DRMVMWRECT enabledMonitors[VMW_MAX_HEADS]; 255 256 for (int j = 0; j < VMW_MAX_HEADS; ++j) 257 { 258 if (aRects[j].fEnabled) 259 { 260 enabledMonitors[cHeads] = aRects[j].rect; 261 if (cHeads > 0) 262 enabledMonitors[cHeads].x = enabledMonitors[cHeads - 1].x + enabledMonitors[cHeads - 1].w; 234 263 ++cHeads; 235 264 } 236 265 } 237 for (i = 0; i < cHeads; ++i) 238 printf("Head %u: %dx%d, (%d, %d)\n", i, (int)aRects[i].w, (int)aRects[i].h, 239 (int)aRects[i].x, (int)aRects[i].y); 240 drmSendHints(&drmContext, aRects, cHeads); 266 267 for (unsigned i = 0; i < cHeads; ++i) 268 printf("Monitor %u: %dx%d, (%d, %d)\n", i, (int)enabledMonitors[i].w, (int)enabledMonitors[i].h, 269 (int)enabledMonitors[i].x, (int)enabledMonitors[i].y); 270 drmSendHints(&drmContext, enabledMonitors, cHeads); 241 271 } 242 272 do
Note:
See TracChangeset
for help on using the changeset viewer.