Changeset 47480 in vbox
- Timestamp:
- Jul 30, 2013 6:47:16 PM (11 years ago)
- Location:
- trunk/src/VBox/Additions/linux/drm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/files_vboxvideo_drv
r43113 r47480 55 55 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_drv.c=>vboxvideo_drv.c \ 56 56 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_drv.h=>vboxvideo_drv.h \ 57 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_fbdev.c=>vboxvideo_fbdev.c \ 58 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_framebuffer.c=>vboxvideo_framebuffer.c \ 57 59 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_kms.c=>vboxvideo_kms.c \ 58 60 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_mode.h=>vboxvideo_mode.h \ -
trunk/src/VBox/Additions/linux/drm/vboxvideo.h
r47417 r47480 47 47 48 48 #include "vboxvideo_mode.h" 49 #include <VBox/VBoxVideoGuest.h> 49 50 #include "drm/drmP.h" 50 51 … … 61 62 struct pci_dev *pdev; 62 63 unsigned long flags; 63 /** @todo move this into flags */64 HGSMIGUESTCOMMANDCONTEXT Ctx; 64 65 bool fAnyX; 66 bool fHaveHGSMI; 67 size_t offViewInfo; 68 size_t offCommandBuffers; 65 69 66 70 drm_local_map_t *framebuffer; -
trunk/src/VBox/Additions/linux/drm/vboxvideo_crtc.c
r47417 r47480 51 51 #include "drm/drm_crtc_helper.h" 52 52 53 /** Set a graphics mode. Poke any required values into registers, do an HGSMI 54 * mode set and tell the host we support advanced graphics functions. 55 */ 56 static void vboxvideo_do_modeset(struct drm_crtc *crtc) 57 { 58 struct vboxvideo_crtc *vboxvideo_crtc = to_vboxvideo_crtc(crtc); 59 struct vboxvideo_device *gdev = crtc->dev->dev_private; 60 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) 61 int pitch = crtc->fb.pitch; 62 #else 63 int pitch = crtc->fb.pitches[0]; 64 #endif 65 66 if (vboxvideo_crtc->crtc_id == 0) 67 VBoxVideoSetModeRegisters(vboxvideo_crtc->last_width, 68 vboxvideo_crtc->last_height, 69 pitch, 70 crtc->fb.bits_per_pixel, 0, 71 vboxvideo_crtc->last_x, 72 vboxvideo_crtc->last_y); 73 if (gdev->fHaveHGSMI) 74 { 75 uint16_t fFlags = VBVA_SCREEN_F_ACTIVE; 76 fFlags |= (vboxvideo_crtc->enabled ? 0 : VBVA_SCREEN_F_DISABLED); 77 VBoxHGSMIProcessDisplayInfo(&gdev->Ctx, vboxvideo_crtc->crtc_id, 78 vboxvideo_crtc->last_x, 79 vboxvideo_crtc->last_y, 80 vboxvideo_crtc->last_x 81 * crtc->fb.bits_per_pixel 82 + vboxvideo_crtc->last_y * pitch, 83 pitch, 84 vboxvideo_crtc->last_width, 85 vboxvideo_crtc->last_height, 86 crtc->fb.bits_per_pixel, fFlags); 87 } 88 } 89 90 53 91 static void vboxvideo_crtc_dpms(struct drm_crtc *crtc, int mode) 54 92 { 55 93 struct vboxvideo_crtc *vboxvideo_crtc = to_vboxvideo_crtc(crtc); 56 struct drm_device *dev = crtc->dev;57 struct vboxvideo_device *gdev = dev->dev_private;58 94 59 95 if (mode == vboxvideo_crtc->last_dpms) /* Don't do unnecesary mode changes. */ … … 163 199 .mode_fixup = vboxvideo_crtc_mode_fixup, 164 200 .mode_set = vboxvideo_crtc_mode_set, 165 /*166 .mode_set_base = vboxvideo_crtc_set_base,167 */168 201 .prepare = vboxvideo_crtc_prepare, 169 202 .commit = vboxvideo_crtc_commit, … … 187 220 188 221 vboxvideo_crtc->crtc_id = index; 222 if (gdev->fHaveHGSMI) 223 { 224 vboxvideo_crtc->offCommandBuffer = gdev->offViewInfo 225 - (index + 1) * VBVA_MIN_BUFFER_SIZE; 226 VBoxVBVASetupBufferContext(&vboxvideo_crtc->VbvaCtx, 227 vboxvideo_crtc->offCommandBuffer, 228 VBVA_MIN_BUFFER_SIZE); 229 } 189 230 vboxvideo_crtc->last_dpms = VBOXVIDEO_DPMS_CLEARED; 190 231 gdev->mode_info.crtcs[index] = vboxvideo_crtc; -
trunk/src/VBox/Additions/linux/drm/vboxvideo_device.c
r47417 r47480 55 55 unsigned size; 56 56 int ret; 57 int rc = VINF_SUCCESS; 58 uint32_t offVRAMBaseMapping, offGuestHeapMemory, cbGuestHeapMemory; 59 void *pvGuestHeapMemory; 57 60 58 61 /* set accessible VRAM */ … … 71 74 _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, 72 75 &gdev->framebuffer); 76 if (!pVBox->fHaveHGSMI) 77 return 0; 78 VBoxHGSMIGetBaseMappingInfo(gdev->mc.vram_size, &offVRAMBaseMapping, 79 NULL, &offGuestHeapMemory, &cbGuestHeapMemory, 80 NULL); 81 pvGuestHeapMemory = ((uint8_t *)gdev->framebuffer->handle) 82 + offVRAMBaseMapping + offGuestHeapMemory; 83 rc = VBoxHGSMISetupGuestContext(&gdev->Ctx, pvGuestHeapMemory, 84 cbGuestHeapMemory, 85 offVRAMBaseMapping + offGuestHeapMemory); 86 if (RT_FAILURE(rc)) 87 { 88 gdev->fHaveHGSMI = false; 89 return 0; 90 } 91 gdev->offViewInfo = offVRAMBaseMapping; 73 92 return 0; 74 93 } … … 80 99 if (gdev->mc.vram_base) 81 100 release_region(gdev->mc.vram_base, gdev->mc.vram_size); 101 } 102 103 static int vboxvideo_command_buffers_init(struct vboxvideo_device *gdev) 104 { 105 unsigned i; 106 gdev->offCommandBuffers = gdev->offViewInfo 107 - gdev->num_crtc * VBVA_MIN_BUFFER_SIZE; 108 for (i = 0; i < gdev->num_crtc; ++i) 109 { 110 gdev->offCommandBuffers -= VBVA_MIN_BUFFER_SIZE; 111 VBoxVBVASetupBufferContext(&pVBox->aVbvaCtx[i], 112 pVBox->aoffVBVABuffer[i], 113 VBVA_MIN_BUFFER_SIZE); 114 } 115 TRACE_LOG("Maximum framebuffer size: %lu (0x%lx)\n", 116 (unsigned long) pVBox->cbFBMax, 117 (unsigned long) pVBox->cbFBMax); 118 rc = VBoxHGSMISendViewInfo(&pVBox->guestCtx, pVBox->cScreens, 119 vboxFillViewInfo, (void *)pVBox); 120 if (RT_FAILURE(rc)) 121 { 122 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to send the view information to the host, rc=%d\n", rc); 123 return FALSE; 124 } 125 return TRUE; 126 82 127 } 83 128 … … 98 143 * stuff. 99 144 */ 145 gdev->fHaveHGSMI = VBoxHGSMIIsSupported(); 100 146 ret = vboxvideo_vram_init(gdev); 101 147 if (ret) 102 148 return ret; 103 149 if (!gdev->fHaveHGSMI) 150 return 0; 151 gdev->num_crtc = VBoxHGSMIGetMonitorCount(&gdev->Ctx); 152 ret = vboxvideo_command_buffers_init(gdev); 153 if (ret) 154 { 155 gdev->fHaveHGSMI = false; 156 return ret; 157 } 104 158 return 0; 105 159 } -
trunk/src/VBox/Additions/linux/drm/vboxvideo_drv.h
r47417 r47480 68 68 #define MB (1024 * 1024) 69 69 70 #define VBOXVIDEOFB_CONN_LIMIT VBOX_VIDEO_MAX_SCREENS 70 #define VBOXVIDEOFB_CONN_LIMIT VBOX_VIDEO_MAX_SCREENS°° 71 71 72 72 /* vboxvideo_crtc.c */ -
trunk/src/VBox/Additions/linux/drm/vboxvideo_mode.h
r47417 r47480 69 69 struct drm_crtc base; 70 70 int crtc_id; 71 size_t offCommandBuffer; 72 struct VBVABUFFERCONTEXT VbvaCtx; 71 73 int last_dpms; 74 int last_hdisplay; 75 int last_vdisplay; 76 int last_x; 77 int last_y; 72 78 bool enabled; 73 79 }; … … 76 82 { 77 83 bool mode_config_initialized; 78 struct vboxvideo_crtc *crtcs[ 1]; /* FIXME: how many CRTCs? */84 struct vboxvideo_crtc *crtcs[VBOX_VIDEO_MAX_SCREENS]; 79 85 /* pointer to fbdev info structure */ 80 86 struct vboxvideo_fbdev *gfbdev;
Note:
See TracChangeset
for help on using the changeset viewer.