Changeset 82692 in vbox
- Timestamp:
- Jan 9, 2020 12:41:11 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/display-svga.cpp
r82680 r82692 89 89 AssertCompileSize(struct DRMVMWRECT, 16); 90 90 91 struct DISPLAYCACHE92 {93 int fEnabled;94 struct DRMVMWRECT rect;95 };96 97 91 #define DRM_IOCTL_VERSION _IOWR('d', 0x00, struct DRMVERSION) 98 92 … … 102 96 }; 103 97 104 struct DISPLAYCACHE aRects[VMW_MAX_HEADS];105 98 106 99 static void drmConnect(struct DRMCONTEXT *pContext) … … 190 183 (void)fDaemonised; 191 184 struct DRMCONTEXT drmContext = { NIL_RTFILE }; 192 185 static struct VMMDevDisplayDef aMonitors[VMW_MAX_HEADS]; 193 186 int rc; 194 unsigned c Heads;187 unsigned cEnabledMonitors; 195 188 /* Do not acknowledge the first event we query for to pick up old events, 196 189 * e.g. from before a guest reboot. */ … … 208 201 VBClLogFatalError("Failed to register resizing support, rc=%Rrc\n", rc); 209 202 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 214 203 for (;;) 215 204 { … … 233 222 if (idDisplay >= VMW_MAX_HEADS) 234 223 continue; 224 aMonitors[idDisplay].fDisplayFlags = aDisplays[i].fDisplayFlags; 235 225 if (!(aDisplays[i].fDisplayFlags & VMMDEV_DISPLAY_DISABLED)) 236 226 { 237 227 if ((idDisplay == 0) || (aDisplays[i].fDisplayFlags & VMMDEV_DISPLAY_ORIGIN)) 238 228 { 239 a Rects[idDisplay].rect.x= aDisplays[i].xOrigin;240 a Rects[idDisplay].rect.y= aDisplays[i].yOrigin;229 aMonitors[idDisplay].xOrigin = aDisplays[i].xOrigin; 230 aMonitors[idDisplay].yOrigin = aDisplays[i].yOrigin; 241 231 } else { 242 a Rects[idDisplay].rect.x = aRects[idDisplay - 1].rect.x + aRects[idDisplay - 1].rect.w;243 a Rects[idDisplay].rect.y = aRects[idDisplay - 1].rect.y;232 aMonitors[idDisplay].xOrigin = aMonitors[idDisplay - 1].xOrigin + aMonitors[idDisplay - 1].cx; 233 aMonitors[idDisplay].yOrigin = aMonitors[idDisplay - 1].yOrigin; 244 234 } 245 aRects[idDisplay].rect.w = aDisplays[i].cx; 246 aRects[idDisplay].rect.h = aDisplays[i].cy; 247 aRects[idDisplay].fEnabled = 1; 235 aMonitors[idDisplay].cx = aDisplays[i].cx; 236 aMonitors[idDisplay].cy = aDisplays[i].cy; 248 237 } 249 else250 aRects[idDisplay].fEnabled = 0;251 238 } 252 239 /* Create an dense (consisting of enable monitors only) array to pass to DRM. */ 253 cHeads = 0; 254 struct DRMVMWRECT enabledMonitors[VMW_MAX_HEADS]; 255 240 cEnabledMonitors = 0; 241 struct DRMVMWRECT aEnabledMonitors[VMW_MAX_HEADS]; 256 242 for (int j = 0; j < VMW_MAX_HEADS; ++j) 257 243 { 258 if ( aRects[j].fEnabled)244 if (!(aMonitors[j].fDisplayFlags & VMMDEV_DISPLAY_DISABLED)) 259 245 { 260 enabledMonitors[cHeads] = aRects[j].rect; 261 if (cHeads > 0) 262 enabledMonitors[cHeads].x = enabledMonitors[cHeads - 1].x + enabledMonitors[cHeads - 1].w; 263 ++cHeads; 246 aEnabledMonitors[cEnabledMonitors].x = aMonitors[j].xOrigin; 247 aEnabledMonitors[cEnabledMonitors].y = aMonitors[j].yOrigin; 248 aEnabledMonitors[cEnabledMonitors].w = aMonitors[j].cx; 249 aEnabledMonitors[cEnabledMonitors].h = aMonitors[j].cy; 250 if (cEnabledMonitors > 0) 251 aEnabledMonitors[cEnabledMonitors].x = aEnabledMonitors[cEnabledMonitors - 1].x + aEnabledMonitors[cEnabledMonitors - 1].w; 252 ++cEnabledMonitors; 264 253 } 265 254 } 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); 255 for (unsigned i = 0; i < cEnabledMonitors; ++i) 256 printf("Monitor %u: %dx%d, (%d, %d)\n", i, (int)aEnabledMonitors[i].w, (int)aEnabledMonitors[i].h, 257 (int)aEnabledMonitors[i].x, (int)aEnabledMonitors[i].y); 258 drmSendHints(&drmContext, aEnabledMonitors, cEnabledMonitors); 271 259 } 272 260 do
Note:
See TracChangeset
for help on using the changeset viewer.