Changeset 59568 in vbox for trunk/src/VBox/Additions/linux/drm/vbox_mode.c
- Timestamp:
- Feb 3, 2016 9:33:34 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/vbox_mode.c
r59526 r59568 72 72 struct vbox_private *vbox; 73 73 int width, height, cBPP, pitch; 74 unsigned iCrtc;74 unsigned crtc_id; 75 75 uint16_t fFlags; 76 76 … … 80 80 width = mode->hdisplay ? mode->hdisplay : 640; 81 81 height = mode->vdisplay ? mode->vdisplay : 480; 82 iCrtc= vbox_crtc->crtc_id;82 crtc_id = vbox_crtc->crtc_id; 83 83 cBPP = crtc->enabled ? CRTC_FB(crtc)->bits_per_pixel : 32; 84 84 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) … … 93 93 fFlags = VBVA_SCREEN_F_ACTIVE; 94 94 fFlags |= (crtc->enabled ? 0 : VBVA_SCREEN_F_DISABLED); 95 VBoxHGSMIProcessDisplayInfo(&vbox-> Ctx, vbox_crtc->crtc_id,95 VBoxHGSMIProcessDisplayInfo(&vbox->submit_info, vbox_crtc->crtc_id, 96 96 crtc->x, crtc->y, 97 97 crtc->x * cBPP / 8 + crtc->y * pitch, 98 98 pitch, width, height, 99 vbox_crtc-> fBlanked ? 0 : cBPP, fFlags);100 VBoxHGSMIReportFlagsLocation(&vbox-> Ctx, vbox->offHostFlags);101 VBoxHGSMISendCapsInfo(&vbox-> Ctx, VBVACAPS_VIDEO_MODE_HINTS | VBVACAPS_DISABLE_CURSOR_INTEGRATION);99 vbox_crtc->blanked ? 0 : cBPP, fFlags); 100 VBoxHGSMIReportFlagsLocation(&vbox->submit_info, vbox->host_flags_offset); 101 VBoxHGSMISendCapsInfo(&vbox->submit_info, VBVACAPS_VIDEO_MODE_HINTS | VBVACAPS_DISABLE_CURSOR_INTEGRATION); 102 102 LogFunc(("vboxvideo: %d\n", __LINE__)); 103 103 } … … 118 118 * the first view be the managed memory plus the first command buffer, the 119 119 * second the same plus the second buffer and so on. */ 120 p = VBoxHGSMIBufferAlloc(&vbox-> Ctx, sizeof(VBVAINFOVIEW), HGSMI_CH_VBVA,120 p = VBoxHGSMIBufferAlloc(&vbox->submit_info, sizeof(VBVAINFOVIEW), HGSMI_CH_VBVA, 121 121 VBVA_INFO_VIEW); 122 122 if (p) … … 124 124 VBVAINFOVIEW *pInfo = (VBVAINFOVIEW *)p; 125 125 pInfo->u32ViewIndex = vbox_crtc->crtc_id; 126 pInfo->u32ViewOffset = vbox_crtc-> offFB;127 pInfo->u32ViewSize = vbox->vram_size - vbox_crtc-> offFB126 pInfo->u32ViewOffset = vbox_crtc->fb_offset; 127 pInfo->u32ViewSize = vbox->vram_size - vbox_crtc->fb_offset 128 128 + vbox_crtc->crtc_id * VBVA_MIN_BUFFER_SIZE; 129 pInfo->u32MaxScreenSize = vbox->vram_size - vbox_crtc-> offFB;130 VBoxHGSMIBufferSubmit(&vbox-> Ctx, p);131 VBoxHGSMIBufferFree(&vbox-> Ctx, p);129 pInfo->u32MaxScreenSize = vbox->vram_size - vbox_crtc->fb_offset; 130 VBoxHGSMIBufferSubmit(&vbox->submit_info, p); 131 VBoxHGSMIBufferFree(&vbox->submit_info, p); 132 132 } 133 133 else … … 152 152 switch (mode) { 153 153 case DRM_MODE_DPMS_ON: 154 vbox_crtc-> fBlanked = false;154 vbox_crtc->blanked = false; 155 155 break; 156 156 case DRM_MODE_DPMS_STANDBY: 157 157 case DRM_MODE_DPMS_SUSPEND: 158 158 case DRM_MODE_DPMS_OFF: 159 vbox_crtc-> fBlanked = true;159 vbox_crtc->blanked = true; 160 160 break; 161 161 } … … 222 222 223 223 /* vbox_set_start_address_crt1(crtc, (u32)gpu_addr); */ 224 vbox_crtc-> offFB= gpu_addr;224 vbox_crtc->fb_offset = gpu_addr; 225 225 226 226 LogFunc(("vboxvideo: %d: vbox_fb=%p, obj=%p, bo=%p, gpu_addr=%u\n", … … 413 413 LogFunc(("vboxvideo: %d: vbox_connector=%p\n", __LINE__, vbox_connector)); 414 414 pVBox = vbox_connector->base.dev->dev_private; 415 rc = VBoxHGSMIGetModeHints(&pVBox-> Ctx, pVBox->cCrtcs, pVBox->paVBVAModeHints);415 rc = VBoxHGSMIGetModeHints(&pVBox->submit_info, pVBox->num_crtcs, pVBox->last_mode_hints); 416 416 AssertMsgRCReturnVoid(rc, ("VBoxHGSMIGetModeHints failed, rc=%Rrc.\n", rc)); 417 if (pVBox-> paVBVAModeHints[vbox_connector->iCrtc].magic == VBVAMODEHINT_MAGIC)417 if (pVBox->last_mode_hints[vbox_connector->crtc_id].magic == VBVAMODEHINT_MAGIC) 418 418 { 419 vbox_connector->mode Hint.cX = pVBox->paVBVAModeHints[vbox_connector->iCrtc].cx & 0x8fff;420 vbox_connector->mode Hint.cY = pVBox->paVBVAModeHints[vbox_connector->iCrtc].cy & 0x8fff;421 vbox_connector->mode Hint.fDisconnected = !(pVBox->paVBVAModeHints[vbox_connector->iCrtc].fEnabled);422 LogFunc(("vboxvideo: %d: cX=%u, cY=%u, fDisconnected=%RTbool\n", __LINE__,423 (unsigned)vbox_connector->mode Hint.cX, (unsigned)vbox_connector->modeHint.cY,424 vbox_connector->mode Hint.fDisconnected));419 vbox_connector->mode_hint.width = pVBox->last_mode_hints[vbox_connector->crtc_id].cx & 0x8fff; 420 vbox_connector->mode_hint.height = pVBox->last_mode_hints[vbox_connector->crtc_id].cy & 0x8fff; 421 vbox_connector->mode_hint.disconnected = !(pVBox->last_mode_hints[vbox_connector->crtc_id].fEnabled); 422 LogFunc(("vboxvideo: %d: width=%u, height=%u, disconnected=%RTbool\n", __LINE__, 423 (unsigned)vbox_connector->mode_hint.width, (unsigned)vbox_connector->mode_hint.height, 424 vbox_connector->mode_hint.disconnected)); 425 425 } 426 426 } … … 431 431 struct drm_display_mode *pMode = NULL; 432 432 unsigned cModes = 0; 433 int cxPreferred, cyPreferred;433 int widthPreferred, heightPreferred; 434 434 435 435 LogFunc(("vboxvideo: %d: connector=%p\n", __LINE__, connector)); … … 437 437 vboxUpdateHints(vbox_connector); 438 438 cModes = drm_add_modes_noedid(connector, 2560, 1600); 439 cxPreferred = vbox_connector->modeHint.cX ? vbox_connector->modeHint.cX: 1024;440 cyPreferred = vbox_connector->modeHint.cY ? vbox_connector->modeHint.cY: 768;441 pMode = drm_cvt_mode(connector->dev, cxPreferred, cyPreferred, 60, false,439 widthPreferred = vbox_connector->mode_hint.width ? vbox_connector->mode_hint.width : 1024; 440 heightPreferred = vbox_connector->mode_hint.height ? vbox_connector->mode_hint.height : 768; 441 pMode = drm_cvt_mode(connector->dev, widthPreferred, heightPreferred, 60, false, 442 442 false, false); 443 443 if (pMode) … … 462 462 LogFunc(("vboxvideo: %d: connector=%p\n", __LINE__, connector)); 463 463 vbox_connector = to_vbox_connector(connector); 464 device_remove_file(connector->dev->dev, &vbox_connector-> deviceAttribute);464 device_remove_file(connector->dev->dev, &vbox_connector->sysfs_node); 465 465 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) 466 466 drm_sysfs_connector_remove(connector); … … 481 481 vbox_connector = to_vbox_connector(connector); 482 482 vboxUpdateHints(vbox_connector); 483 return !vbox_connector->mode Hint.fDisconnected;483 return !vbox_connector->mode_hint.disconnected; 484 484 } 485 485 … … 525 525 dev, pAttr, psz, (unsigned long long)cch)); 526 526 vbox_connector = container_of(pAttr, struct vbox_connector, 527 deviceAttribute);527 sysfs_node); 528 528 pVBox = vbox_connector->base.dev->dev_private; 529 529 drm_kms_helper_hotplug_event(vbox_connector->base.dev); … … 547 547 548 548 connector = &vbox_connector->base; 549 vbox_connector-> iCrtc= cScreen;549 vbox_connector->crtc_id = cScreen; 550 550 551 551 /* … … 553 553 * space. 554 554 */ 555 snprintf(vbox_connector-> szName, sizeof(vbox_connector->szName),555 snprintf(vbox_connector->name, sizeof(vbox_connector->name), 556 556 "vbox_screen_%u", cScreen); 557 vbox_connector-> deviceAttribute.attr.name = vbox_connector->szName;558 vbox_connector-> deviceAttribute.attr.mode = S_IWUSR;559 vbox_connector-> deviceAttribute.show = NULL;560 vbox_connector-> deviceAttribute.store = vbox_connector_write_sysfs;561 rc = device_create_file(dev->dev, &vbox_connector-> deviceAttribute);557 vbox_connector->sysfs_node.attr.name = vbox_connector->name; 558 vbox_connector->sysfs_node.attr.mode = S_IWUSR; 559 vbox_connector->sysfs_node.show = NULL; 560 vbox_connector->sysfs_node.store = vbox_connector_write_sysfs; 561 rc = device_create_file(dev->dev, &vbox_connector->sysfs_node); 562 562 if (rc < 0) 563 563 { … … 638 638 /* vbox_cursor_init(dev); */ 639 639 LogFunc(("vboxvideo: %d: dev=%p\n", __LINE__, dev)); 640 for (i = 0; i < pVBox-> cCrtcs; ++i)640 for (i = 0; i < pVBox->num_crtcs; ++i) 641 641 { 642 642 vbox_crtc_init(dev, i); … … 654 654 655 655 656 void VBoxRefreshModes(struct drm_device *dev)656 void vbox_refresh_modes(struct drm_device *dev) 657 657 { 658 658 struct vbox_private *vbox = dev->dev_private; … … 702 702 if (!handle) { 703 703 /* Hide cursor. */ 704 VBoxHGSMIUpdatePointerShape(&vbox-> Ctx, 0, 0, 0, 0, 0, NULL, 0);704 VBoxHGSMIUpdatePointerShape(&vbox->submit_info, 0, 0, 0, 0, 0, NULL, 0); 705 705 return 0; 706 706 } … … 733 733 | VBOX_MOUSE_POINTER_ALPHA; 734 734 copy_cursor_image(src, dst, width, height, cbMask); 735 rc = VBoxHGSMIUpdatePointerShape(&vbox-> Ctx, fFlags,735 rc = VBoxHGSMIUpdatePointerShape(&vbox->submit_info, fFlags, 736 736 hot_x, hot_y, width, 737 737 height, dst, cbData);
Note:
See TracChangeset
for help on using the changeset viewer.