Changeset 51121 in vbox for trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
- Timestamp:
- Apr 23, 2014 11:39:21 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
r51013 r51121 496 496 pVBVA->hostFlags.u32SupportedOrders = 0; 497 497 498 rc = pVGAState->pDrv->pfnVBVAEnable (pVGAState->pDrv, uScreenId, &pVBVA->hostFlags );498 rc = pVGAState->pDrv->pfnVBVAEnable (pVGAState->pDrv, uScreenId, &pVBVA->hostFlags, false); 499 499 } 500 500 else … … 1903 1903 } 1904 1904 1905 int VBVAInfoView(PVGASTATE pVGAState, VBVAINFOVIEW *pView) 1906 { 1907 LogFlowFunc(("VBVA_INFO_VIEW: index %d, offset 0x%x, size 0x%x, max screen size 0x%x\n", 1908 pView->u32ViewIndex, pView->u32ViewOffset, pView->u32ViewSize, pView->u32MaxScreenSize)); 1909 1910 PHGSMIINSTANCE pIns = pVGAState->pHGSMI; 1911 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns); 1912 1913 /* @todo verify view data. */ 1914 if (pView->u32ViewIndex >= pCtx->cViews) 1915 { 1916 Log(("View index too large %d!!!\n", 1917 pView->u32ViewIndex)); 1918 return VERR_INVALID_PARAMETER; 1919 } 1920 1921 pCtx->aViews[pView->u32ViewIndex].view = *pView; 1922 1923 return VINF_SUCCESS; 1924 } 1925 1926 int VBVAInfoScreen(PVGASTATE pVGAState, VBVAINFOSCREEN *pScreen) 1927 { 1928 PHGSMIINSTANCE pIns = pVGAState->pHGSMI; 1929 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns); 1930 VBVAINFOVIEW *pView = &pCtx->aViews[pScreen->u32ViewIndex].view; 1931 /* Calculate the offset of the end of the screen so we can make 1932 * sure it is inside the view. I assume that screen rollover is not 1933 * implemented. */ 1934 int64_t offEnd = (int64_t)pScreen->u32Height * pScreen->u32LineSize 1935 + pScreen->u32Width + pScreen->u32StartOffset; 1936 LogRel(("VBVA_INFO_SCREEN: [%d] @%d,%d %dx%d, line 0x%x, BPP %d, flags 0x%x\n", 1937 pScreen->u32ViewIndex, pScreen->i32OriginX, pScreen->i32OriginY, 1938 pScreen->u32Width, pScreen->u32Height, 1939 pScreen->u32LineSize, pScreen->u16BitsPerPixel, pScreen->u16Flags)); 1940 1941 if ( pScreen->u32ViewIndex < RT_ELEMENTS (pCtx->aViews) 1942 && pScreen->u16BitsPerPixel <= 32 1943 && pScreen->u32Width <= UINT16_MAX 1944 && pScreen->u32Height <= UINT16_MAX 1945 && pScreen->u32LineSize <= UINT16_MAX * 4 1946 && offEnd < pView->u32MaxScreenSize) 1947 { 1948 vbvaResize (pVGAState, &pCtx->aViews[pScreen->u32ViewIndex], pScreen); 1949 return VINF_SUCCESS; 1950 } 1951 1952 LogRelFlow(("VBVA_INFO_SCREEN [%lu]: bad data: %lux%lu, line 0x%lx, BPP %u, start offset %lu, max screen size %lu\n", 1953 (unsigned long)pScreen->u32ViewIndex, 1954 (unsigned long)pScreen->u32Width, 1955 (unsigned long)pScreen->u32Height, 1956 (unsigned long)pScreen->u32LineSize, 1957 (unsigned long)pScreen->u16BitsPerPixel, 1958 (unsigned long)pScreen->u32StartOffset, 1959 (unsigned long)pView->u32MaxScreenSize)); 1960 return VERR_INVALID_PARAMETER; 1961 } 1962 1905 1963 1906 1964 /* … … 2069 2127 pView++, cbBuffer -= sizeof (VBVAINFOVIEW)) 2070 2128 { 2071 LogFlowFunc(("VBVA_INFO_VIEW: index %d, offset 0x%x, size 0x%x, max screen size 0x%x\n", 2072 pView->u32ViewIndex, pView->u32ViewOffset, pView->u32ViewSize, pView->u32MaxScreenSize)); 2073 2074 /* @todo verify view data. */ 2075 if (pView->u32ViewIndex >= pCtx->cViews) 2076 { 2077 Log(("View index too large %d!!!\n", 2078 pView->u32ViewIndex)); 2079 rc = VERR_INVALID_PARAMETER; 2129 VBVAINFOVIEW View = *pView; 2130 rc = VBVAInfoView(pVGAState, &View); 2131 if (RT_FAILURE(rc)) 2080 2132 break; 2081 }2082 2083 pCtx->aViews[pView->u32ViewIndex].view = *pView;2084 2133 } 2085 2134 } break; … … 2124 2173 2125 2174 VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)pvBuffer; 2126 VBVAINFOVIEW *pView = &pCtx->aViews[pScreen->u32ViewIndex].view; 2127 /* Calculate the offset of the end of the screen so we can make 2128 * sure it is inside the view. I assume that screen rollover is not 2129 * implemented. */ 2130 int64_t offEnd = (int64_t)pScreen->u32Height * pScreen->u32LineSize 2131 + pScreen->u32Width + pScreen->u32StartOffset; 2132 LogRel(("VBVA_INFO_SCREEN: [%d] @%d,%d %dx%d, line 0x%x, BPP %d, flags 0x%x\n", 2133 pScreen->u32ViewIndex, pScreen->i32OriginX, pScreen->i32OriginY, 2134 pScreen->u32Width, pScreen->u32Height, 2135 pScreen->u32LineSize, pScreen->u16BitsPerPixel, pScreen->u16Flags)); 2136 2137 if ( pScreen->u32ViewIndex < RT_ELEMENTS (pCtx->aViews) 2138 && pScreen->u16BitsPerPixel <= 32 2139 && pScreen->u32Width <= UINT16_MAX 2140 && pScreen->u32Height <= UINT16_MAX 2141 && pScreen->u32LineSize <= UINT16_MAX * 4 2142 && offEnd < pView->u32MaxScreenSize) 2143 { 2144 vbvaResize (pVGAState, &pCtx->aViews[pScreen->u32ViewIndex], pScreen); 2145 } 2146 else 2147 { 2148 LogRelFlow(("VBVA_INFO_SCREEN [%lu]: bad data: %lux%lu, line 0x%lx, BPP %u, start offset %lu, max screen size %lu\n", 2149 (unsigned long)pScreen->u32ViewIndex, 2150 (unsigned long)pScreen->u32Width, 2151 (unsigned long)pScreen->u32Height, 2152 (unsigned long)pScreen->u32LineSize, 2153 (unsigned long)pScreen->u16BitsPerPixel, 2154 (unsigned long)pScreen->u32StartOffset, 2155 (unsigned long)pView->u32MaxScreenSize)); 2156 rc = VERR_INVALID_PARAMETER; 2157 } 2175 VBVAINFOSCREEN Screen = *pScreen; 2176 rc = VBVAInfoScreen(pVGAState, &Screen); 2158 2177 } break; 2159 2178 … … 2442 2461 pVGAState->pHGSMI = NULL; 2443 2462 } 2444 2445 int VBVAGetScreenInfo(PVGASTATE pVGAState, unsigned uScreenId, struct VBVAINFOSCREEN *pScreen, void **ppvVram)2446 {2447 PPDMDEVINS pDevIns = pVGAState->pDevInsR3;2448 PHGSMIINSTANCE pIns = pVGAState->pHGSMI;2449 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns);2450 int rc = PDMCritSectEnter(&pVGAState->CritSect, VERR_SEM_BUSY);2451 if (RT_SUCCESS(rc))2452 {2453 if (uScreenId < pCtx->cViews)2454 {2455 VBVAVIEW *pView = &pCtx->aViews[uScreenId];2456 if (pView->pVBVA)2457 {2458 uint8_t *pu8VRAM = pVGAState->vram_ptrR3 + pView->view.u32ViewOffset;2459 *pScreen = pView->screen;2460 *ppvVram = (void*)pu8VRAM;2461 rc = VINF_SUCCESS;2462 }2463 else2464 {2465 /* pretend disabled */2466 memset(pScreen, 0, sizeof (*pScreen));2467 pScreen->u16Flags = VBVA_SCREEN_F_DISABLED;2468 pScreen->u32ViewIndex = uScreenId;2469 *ppvVram = NULL;2470 rc = VINF_SUCCESS;2471 }2472 }2473 else2474 rc = VERR_INVALID_PARAMETER;2475 2476 PDMCritSectLeave(&pVGAState->CritSect);2477 }2478 return rc;2479 }
Note:
See TracChangeset
for help on using the changeset viewer.