Changeset 27891 in vbox for trunk/src/VBox/Devices/VMMDev
- Timestamp:
- Mar 31, 2010 1:02:04 PM (15 years ago)
- Location:
- trunk/src/VBox/Devices/VMMDev
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
r27797 r27891 872 872 VMMDevDisplayChangeRequest *displayChangeRequest = (VMMDevDisplayChangeRequest*)pRequestHeader; 873 873 874 DISPLAYCHANGEREQUEST *pRequest = &pThis->displayChangeData.aRequests[0]; 875 874 876 if (displayChangeRequest->eventAck == VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST) 875 877 { 878 /* Current request has been read at least once. */ 879 pRequest->fPending = false; 880 881 /* Check if there are more pending requests. */ 882 int i; 883 for (i = 1; i < RT_ELEMENTS(pThis->displayChangeData.aRequests); i++) 884 { 885 if (pThis->displayChangeData.aRequests[i].fPending) 886 { 887 VMMDevNotifyGuest (pThis, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST); 888 break; 889 } 890 } 891 876 892 /* Remember which resolution the client has queried, subsequent reads 877 893 * will return the same values. */ 878 p This->lastReadDisplayChangeRequest = pThis->displayChangeRequest;879 pThis-> fGuestSentChangeEventAck = true;880 } 881 882 if (pThis-> fGuestSentChangeEventAck)883 { 884 displayChangeRequest->xres = p This->lastReadDisplayChangeRequest.xres;885 displayChangeRequest->yres = p This->lastReadDisplayChangeRequest.yres;886 displayChangeRequest->bpp = p This->lastReadDisplayChangeRequest.bpp;894 pRequest->lastReadDisplayChangeRequest = pRequest->displayChangeRequest; 895 pThis->displayChangeData.fGuestSentChangeEventAck = true; 896 } 897 898 if (pThis->displayChangeData.fGuestSentChangeEventAck) 899 { 900 displayChangeRequest->xres = pRequest->lastReadDisplayChangeRequest.xres; 901 displayChangeRequest->yres = pRequest->lastReadDisplayChangeRequest.yres; 902 displayChangeRequest->bpp = pRequest->lastReadDisplayChangeRequest.bpp; 887 903 } 888 904 else … … 891 907 * read the last valid video mode hint. This happens when the guest X server 892 908 * determines the initial mode. */ 893 displayChangeRequest->xres = p This->displayChangeRequest.xres;894 displayChangeRequest->yres = p This->displayChangeRequest.yres;895 displayChangeRequest->bpp = p This->displayChangeRequest.bpp;909 displayChangeRequest->xres = pRequest->displayChangeRequest.xres; 910 displayChangeRequest->yres = pRequest->displayChangeRequest.yres; 911 displayChangeRequest->bpp = pRequest->displayChangeRequest.bpp; 896 912 } 897 913 Log(("VMMDev: returning display change request xres = %d, yres = %d, bpp = %d\n", … … 913 929 VMMDevDisplayChangeRequest2 *displayChangeRequest = (VMMDevDisplayChangeRequest2*)pRequestHeader; 914 930 931 DISPLAYCHANGEREQUEST *pRequest = NULL; 932 915 933 if (displayChangeRequest->eventAck == VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST) 916 934 { 917 /* Remember which resolution the client has queried, subsequent reads 918 * will return the same values. */ 919 pThis->lastReadDisplayChangeRequest = pThis->displayChangeRequest; 920 pThis->fGuestSentChangeEventAck = true; 921 } 922 923 if (pThis->fGuestSentChangeEventAck) 924 { 925 displayChangeRequest->xres = pThis->lastReadDisplayChangeRequest.xres; 926 displayChangeRequest->yres = pThis->lastReadDisplayChangeRequest.yres; 927 displayChangeRequest->bpp = pThis->lastReadDisplayChangeRequest.bpp; 928 displayChangeRequest->display = pThis->lastReadDisplayChangeRequest.display; 935 /* Select a pending request to report. */ 936 int i; 937 for (i = 0; i < RT_ELEMENTS(pThis->displayChangeData.aRequests); i++) 938 { 939 pRequest = &pThis->displayChangeData.aRequests[i]; 940 if (pRequest->fPending) 941 { 942 /* Remember which request should be reported. */ 943 pThis->displayChangeData.iCurrentMonitor = i; 944 Log3(("VMMDev: will report pending request for %d\n", 945 i)); 946 break; 947 } 948 } 949 950 /* Check if there are more pending requests. */ 951 i++; 952 for (; i < RT_ELEMENTS(pThis->displayChangeData.aRequests); i++) 953 { 954 if (pThis->displayChangeData.aRequests[i].fPending) 955 { 956 VMMDevNotifyGuest (pThis, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST); 957 Log3(("VMMDev: another pending at %d\n", 958 i)); 959 break; 960 } 961 } 962 963 if (pRequest) 964 { 965 /* Current request has been read at least once. */ 966 pRequest->fPending = false; 967 968 /* Remember which resolution the client has queried, subsequent reads 969 * will return the same values. */ 970 pRequest->lastReadDisplayChangeRequest = pRequest->displayChangeRequest; 971 pThis->displayChangeData.fGuestSentChangeEventAck = true; 972 } 973 else 974 { 975 Log3(("VMMDev: no pending request!!!\n")); 976 } 977 } 978 979 if (!pRequest) 980 { 981 Log3(("VMMDev: default to %d\n", 982 pThis->displayChangeData.iCurrentMonitor)); 983 pRequest = &pThis->displayChangeData.aRequests[pThis->displayChangeData.iCurrentMonitor]; 984 } 985 986 if (pThis->displayChangeData.fGuestSentChangeEventAck) 987 { 988 displayChangeRequest->xres = pRequest->lastReadDisplayChangeRequest.xres; 989 displayChangeRequest->yres = pRequest->lastReadDisplayChangeRequest.yres; 990 displayChangeRequest->bpp = pRequest->lastReadDisplayChangeRequest.bpp; 991 displayChangeRequest->display = pRequest->lastReadDisplayChangeRequest.display; 929 992 } 930 993 else … … 933 996 * read the last valid video mode hint. This happens when the guest X server 934 997 * determines the initial video mode. */ 935 displayChangeRequest->xres = p This->displayChangeRequest.xres;936 displayChangeRequest->yres = p This->displayChangeRequest.yres;937 displayChangeRequest->bpp = p This->displayChangeRequest.bpp;938 displayChangeRequest->display = p This->displayChangeRequest.display;998 displayChangeRequest->xres = pRequest->displayChangeRequest.xres; 999 displayChangeRequest->yres = pRequest->displayChangeRequest.yres; 1000 displayChangeRequest->bpp = pRequest->displayChangeRequest.bpp; 1001 displayChangeRequest->display = pRequest->displayChangeRequest.display; 939 1002 } 940 1003 Log(("VMMDev: returning display change request xres = %d, yres = %d, bpp = %d at %d\n", … … 1970 2033 { 1971 2034 VMMDevState *pThis = IVMMDEVPORT_2_VMMDEVSTATE(pInterface); 2035 2036 if (display >= RT_ELEMENTS(pThis->displayChangeData.aRequests)) 2037 { 2038 return VERR_INVALID_PARAMETER; 2039 } 2040 1972 2041 PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY); 1973 2042 2043 DISPLAYCHANGEREQUEST *pRequest = &pThis->displayChangeData.aRequests[display]; 2044 1974 2045 /* Verify that the new resolution is different and that guest does not yet know about it. */ 1975 bool fSameResolution = (!xres || (p This->lastReadDisplayChangeRequest.xres == xres)) &&1976 (!yres || (p This->lastReadDisplayChangeRequest.yres == yres)) &&1977 (!bpp || (p This->lastReadDisplayChangeRequest.bpp == bpp)) &&1978 p This->lastReadDisplayChangeRequest.display == display;2046 bool fSameResolution = (!xres || (pRequest->lastReadDisplayChangeRequest.xres == xres)) && 2047 (!yres || (pRequest->lastReadDisplayChangeRequest.yres == yres)) && 2048 (!bpp || (pRequest->lastReadDisplayChangeRequest.bpp == bpp)) && 2049 pRequest->lastReadDisplayChangeRequest.display == display; 1979 2050 1980 2051 if (!xres && !yres && !bpp) … … 1985 2056 1986 2057 Log3(("vmmdevRequestDisplayChange: same=%d. new: xres=%d, yres=%d, bpp=%d, display=%d. old: xres=%d, yres=%d, bpp=%d, display=%d.\n", 1987 fSameResolution, xres, yres, bpp, display, p This->lastReadDisplayChangeRequest.xres, pThis->lastReadDisplayChangeRequest.yres, pThis->lastReadDisplayChangeRequest.bpp, pThis->lastReadDisplayChangeRequest.display));2058 fSameResolution, xres, yres, bpp, display, pRequest->lastReadDisplayChangeRequest.xres, pRequest->lastReadDisplayChangeRequest.yres, pRequest->lastReadDisplayChangeRequest.bpp, pRequest->lastReadDisplayChangeRequest.display)); 1988 2059 1989 2060 if (!fSameResolution) … … 1993 2064 1994 2065 /* we could validate the information here but hey, the guest can do that as well! */ 1995 pThis->displayChangeRequest.xres = xres; 1996 pThis->displayChangeRequest.yres = yres; 1997 pThis->displayChangeRequest.bpp = bpp; 1998 pThis->displayChangeRequest.display = display; 2066 pRequest->displayChangeRequest.xres = xres; 2067 pRequest->displayChangeRequest.yres = yres; 2068 pRequest->displayChangeRequest.bpp = bpp; 2069 pRequest->displayChangeRequest.display = display; 2070 pRequest->fPending = true; 1999 2071 2000 2072 /* IRQ so the guest knows what's going on */ … … 2257 2329 SSMR3PutU32(pSSM, pThis->fu32AdditionsOk); 2258 2330 SSMR3PutU32(pSSM, pThis->u32VideoAccelEnabled); 2259 SSMR3PutBool(pSSM, pThis-> fGuestSentChangeEventAck);2331 SSMR3PutBool(pSSM, pThis->displayChangeData.fGuestSentChangeEventAck); 2260 2332 2261 2333 SSMR3PutU32(pSSM, pThis->guestCaps); … … 2328 2400 SSMR3GetU32(pSSM, &pThis->u32VideoAccelEnabled); 2329 2401 if (uVersion > 10) 2330 SSMR3GetBool(pSSM, &pThis-> fGuestSentChangeEventAck);2402 SSMR3GetBool(pSSM, &pThis->displayChangeData.fGuestSentChangeEventAck); 2331 2403 2332 2404 rc = SSMR3GetU32(pSSM, &pThis->guestCaps); … … 2475 2547 2476 2548 /* clear pending display change request. */ 2477 memset (&pThis->lastReadDisplayChangeRequest, 0, sizeof (pThis->lastReadDisplayChangeRequest)); 2478 pThis->fGuestSentChangeEventAck = false; 2549 int i; 2550 for (i = 0; i < RT_ELEMENTS(pThis->displayChangeData.aRequests); i++) 2551 { 2552 DISPLAYCHANGEREQUEST *pRequest = &pThis->displayChangeData.aRequests[i]; 2553 memset (&pRequest->lastReadDisplayChangeRequest, 0, sizeof (pRequest->lastReadDisplayChangeRequest)); 2554 } 2555 pThis->displayChangeData.iCurrentMonitor = 0; 2556 pThis->displayChangeData.fGuestSentChangeEventAck = false; 2479 2557 2480 2558 /* disable seamless mode */ -
trunk/src/VBox/Devices/VMMDev/VMMDevState.h
r27049 r27891 28 28 29 29 #define TIMESYNC_BACKDOOR 30 31 typedef struct DISPLAYCHANGEINFO 32 { 33 uint32_t xres; 34 uint32_t yres; 35 uint32_t bpp; 36 uint32_t display; 37 } DISPLAYCHANGEINFO; 38 39 typedef struct DISPLAYCHANGEREQUEST 40 { 41 bool fPending; 42 DISPLAYCHANGEINFO displayChangeRequest; 43 DISPLAYCHANGEINFO lastReadDisplayChangeRequest; 44 } DISPLAYCHANGEREQUEST; 45 46 typedef struct DISPLAYCHANGEDATA 47 { 48 /* Which monitor is being reported to the guest. */ 49 int iCurrentMonitor; 50 51 /** true if the guest responded to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST at least once */ 52 bool fGuestSentChangeEventAck; 53 54 DISPLAYCHANGEREQUEST aRequests[64]; // @todo maxMonitors 55 } DISPLAYCHANGEDATA; 56 30 57 31 58 /** device structure containing all state information */ … … 117 144 uint32_t u32VideoAccelEnabled; 118 145 119 /** true if the guest responded to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST at least once */ 120 bool fGuestSentChangeEventAck; 121 122 /** resolution change request */ 123 struct 124 { 125 uint32_t xres; 126 uint32_t yres; 127 uint32_t bpp; 128 uint32_t display; 129 } displayChangeRequest, 130 lastReadDisplayChangeRequest; 146 DISPLAYCHANGEDATA displayChangeData; 131 147 132 148 /** credentials for guest logon purposes */
Note:
See TracChangeset
for help on using the changeset viewer.