VirtualBox

Changeset 51330 in vbox


Ignore:
Timestamp:
May 21, 2014 7:46:25 PM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: more extended flexible caps info, backwards compatibility fixes

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/HostServices/VBoxCrOpenGLSvc.h

    r50754 r51330  
    6060#define SHCRGL_GUEST_FN_WRITE_BUFFER        (13)
    6161#define SHCRGL_GUEST_FN_WRITE_READ_BUFFERED (14)
    62 #define SHCRGL_GUEST_FN_GET_CAPS            (15)
     62#define SHCRGL_GUEST_FN_GET_CAPS_LEGACY     (15)
     63#define SHCRGL_GUEST_FN_GET_CAPS_NEW     (16)
    6364
    6465/* Parameters count */
     
    8081#define SHCRGL_CPARMS_VIEWPORT_CHANGED (5)
    8182#define SHCRGL_CPARMS_VIEWPORT_CHANGED2 (1)
    82 #define SHCRGL_CPARMS_GET_CAPS (1)
     83#define SHCRGL_CPARMS_GET_CAPS_LEGACY (1)
     84#define SHCRGL_CPARMS_GET_CAPS_NEW (1)
    8385
    8486/* @todo Move to H3DOR.h begin */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.cpp

    r51080 r51330  
    2525#include <cr_protocol.h>
    2626
    27 static uint32_t g_VBoxMpCrHostCaps = 0;
     27CR_CAPS_INFO g_VBoxMpCrHostCapsInfo;
    2828static uint32_t g_VBoxMpCr3DSupported = 0;
    2929
    3030uint32_t VBoxMpCrGetHostCaps()
    3131{
    32     return g_VBoxMpCrHostCaps;
     32    return g_VBoxMpCrHostCapsInfo.u32Caps;
    3333}
    3434
     
    815815}
    816816
    817 static int vboxMpCrCtlConGetCaps(PVBOXMP_CRCTLCON pCrCtlCon, uint32_t u32ClientID, uint32_t *pu32Caps)
     817static int vboxMpCrCtlConGetCapsLegacy(PVBOXMP_CRCTLCON pCrCtlCon, uint32_t u32ClientID, uint32_t *pu32Caps)
    818818{
    819819    CRVBOXHGCMGETCAPS parms;
     
    822822    parms.hdr.result      = VERR_WRONG_ORDER;
    823823    parms.hdr.u32ClientID = u32ClientID;
    824     parms.hdr.u32Function = SHCRGL_GUEST_FN_GET_CAPS;
    825     parms.hdr.cParms      = SHCRGL_CPARMS_GET_CAPS;
     824    parms.hdr.u32Function = SHCRGL_GUEST_FN_GET_CAPS_LEGACY;
     825    parms.hdr.cParms      = SHCRGL_CPARMS_GET_CAPS_LEGACY;
    826826
    827827    parms.Caps.type      = VMMDevHGCMParmType_32bit;
     
    839839    if (RT_FAILURE(parms.hdr.result))
    840840    {
    841         WARN(("SHCRGL_GUEST_FN_GET_CAPS failed, rc (%d)", parms.hdr.result));
     841        WARN(("SHCRGL_GUEST_FN_GET_CAPS_LEGACY failed, rc (%d)", parms.hdr.result));
    842842        return parms.hdr.result;
    843843    }
    844844
     845    /* if host reports it supports CR_VBOX_CAP_CMDVBVA, clean it up,
     846     * we only support CR_VBOX_CAP_CMDVBVA of the proper version reported by SHCRGL_GUEST_FN_GET_CAPS_NEW */
     847    parms.Caps.u.value32 &= ~CR_VBOX_CAP_CMDVBVA;
     848
    845849    *pu32Caps = parms.Caps.u.value32;
     850
     851    return VINF_SUCCESS;
     852}
     853
     854static int vboxMpCrCtlConGetCapsNew(PVBOXMP_CRCTLCON pCrCtlCon, uint32_t u32ClientID, CR_CAPS_INFO *pCapsInfo)
     855{
     856    pCapsInfo->u32Caps = CR_VBOX_CAPS_ALL;
     857    pCapsInfo->u32CmdVbvaVersion = CR_CMDVBVA_VERSION;
     858
     859    CRVBOXHGCMGETCAPS parms;
     860    int rc;
     861
     862    parms.hdr.result      = VERR_WRONG_ORDER;
     863    parms.hdr.u32ClientID = u32ClientID;
     864    parms.hdr.u32Function = SHCRGL_GUEST_FN_GET_CAPS_NEW;
     865    parms.hdr.cParms      = SHCRGL_CPARMS_GET_CAPS_NEW;
     866
     867    parms.Caps.type      = VMMDevHGCMParmType_LinAddr;
     868    parms.Caps.u.Pointer.u.linearAddr = (uintptr_t)pCapsInfo;
     869    parms.Caps.u.Pointer.size = sizeof (*pCapsInfo);
     870
     871    rc = vboxCrCtlConCall(pCrCtlCon->hCrCtl, &parms.hdr, sizeof (parms));
     872    if (RT_FAILURE(rc))
     873    {
     874        WARN(("vboxCrCtlConCall failed, rc (%d)", rc));
     875        return rc;
     876    }
     877
     878    if (RT_FAILURE(parms.hdr.result))
     879    {
     880        WARN(("SHCRGL_GUEST_FN_GET_CAPS_NEW failed, rc (%d)", parms.hdr.result));
     881        return parms.hdr.result;
     882    }
     883
     884    if (pCapsInfo->u32CmdVbvaVersion != CR_CMDVBVA_VERSION)
     885    {
     886        WARN(("CmdVbva version mismatch (%d), expected(%d)", pCapsInfo->u32CmdVbvaVersion, CR_CMDVBVA_VERSION));
     887        pCapsInfo->u32Caps &= ~CR_VBOX_CAP_CMDVBVA;
     888    }
     889
     890    pCapsInfo->u32Caps &= CR_VBOX_CAPS_ALL;
    846891
    847892    return VINF_SUCCESS;
     
    10081053{
    10091054    g_VBoxMpCr3DSupported = 0;
    1010     g_VBoxMpCrHostCaps = 0;
     1055    memset(&g_VBoxMpCrHostCapsInfo, 0, sizeof (g_VBoxMpCrHostCapsInfo));
    10111056
    10121057    VBOXMP_CRCTLCON CrCtlCon = {0};
     
    10211066    g_VBoxMpCr3DSupported = 1;
    10221067
    1023     rc = vboxMpCrCtlConGetCaps(&CrCtlCon, u32ClientID, &g_VBoxMpCrHostCaps);
     1068    rc = vboxMpCrCtlConGetCapsNew(&CrCtlCon, u32ClientID, &g_VBoxMpCrHostCapsInfo);
    10241069    if (RT_FAILURE(rc))
    10251070    {
    1026         WARN(("vboxMpCrCtlConGetCaps failed rc (%d), ignoring..", rc));
    1027         g_VBoxMpCrHostCaps = 0;
     1071        WARN(("vboxMpCrCtlConGetCapsNew failed rc (%d), ignoring..", rc));
     1072        g_VBoxMpCrHostCapsInfo.u32CmdVbvaVersion = 0;
     1073        rc = vboxMpCrCtlConGetCapsLegacy(&CrCtlCon, u32ClientID, &g_VBoxMpCrHostCapsInfo.u32Caps);
     1074        if (RT_FAILURE(rc))
     1075        {
     1076            WARN(("vboxMpCrCtlConGetCapsLegacy failed rc (%d), ignoring..", rc));
     1077            g_VBoxMpCrHostCapsInfo.u32Caps = 0;
     1078        }
    10281079    }
    10291080
    10301081#if 0 //ndef DEBUG_misha
    1031     g_VBoxMpCrHostCaps &= ~CR_VBOX_CAP_CMDVBVA;
     1082    g_VBoxMpCrHostCapsInfo.u32Caps &= ~CR_VBOX_CAP_CMDVBVA;
     1083    g_VBoxMpCrHostCapsInfo.u32CmdVbvaVersion = 0;
    10321084#endif
    10331085
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp

    r51260 r51330  
    11611161    }
    11621162
    1163     NTSTATUS Status = STATUS_UNSUCCESSFUL;
     1163    NTSTATUS Status = STATUS_SUCCESS;
    11641164    uint32_t hostID = pSrcAllocData->hostID;
    11651165    int rc;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVidPn.cpp

    r51328 r51330  
    18931893NTSTATUS VBoxVidPnCheckTopology(PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface, BOOLEAN *pfSupported)
    18941894{
    1895     UINT i;
    18961895    VBOXVIDPNGETPATHSINFO CbContext = {0};
    18971896    CbContext.pDevExt = pDevExt;
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_protocol.h

    r51200 r51330  
    1717extern "C" {
    1818#endif
     19
     20#define CR_CMDVBVA_VERSION              1
     21
     22#pragma pack(1)
     23typedef struct CR_CAPS_INFO
     24{
     25    uint32_t u32Caps;
     26    uint32_t u32CmdVbvaVersion;
     27} CR_CAPS_INFO;
     28#pragma pack()
     29
    1930
    2031/*For now guest is allowed to connect host opengl service if protocol version matches exactly*/
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h

    r50913 r51330  
    520520extern DECLEXPORT(int32_t) crVBoxServerClientRead(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t *pcbBuffer);
    521521extern DECLEXPORT(int32_t) crVBoxServerClientSetVersion(uint32_t u32ClientID, uint32_t vMajor, uint32_t vMinor);
    522 extern DECLEXPORT(int32_t) crVBoxServerClientGetCaps(uint32_t u32ClientID, uint32_t *pu32Caps);
     522extern DECLEXPORT(int32_t) crVBoxServerClientGetCapsLegacy(uint32_t u32ClientID, uint32_t *pu32Caps);
     523extern DECLEXPORT(int32_t) crVBoxServerClientGetCapsNew(uint32_t u32ClientID, CR_CAPS_INFO *pInfo);
    523524extern DECLEXPORT(int32_t) crVBoxServerClientSetPID(uint32_t u32ClientID, uint64_t pid);
    524525
  • trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c

    r51160 r51330  
    12871287}
    12881288
    1289 static int crVBoxHGCMGetHostCaps(CRConnection *conn, uint32_t *pu32HostCaps)
     1289static int crVBoxHGCMGetHostCapsLegacy(CRConnection *conn, uint32_t *pu32HostCaps)
    12901290{
    12911291    CRVBOXHGCMGETCAPS caps;
     
    12941294    caps.hdr.result      = VERR_WRONG_ORDER;
    12951295    caps.hdr.u32ClientID = conn->u32ClientID;
    1296     caps.hdr.u32Function = SHCRGL_GUEST_FN_GET_CAPS;
    1297     caps.hdr.cParms      = SHCRGL_CPARMS_GET_CAPS;
     1296    caps.hdr.u32Function = SHCRGL_GUEST_FN_GET_CAPS_LEGACY;
     1297    caps.hdr.cParms      = SHCRGL_CPARMS_GET_CAPS_LEGACY;
    12981298
    12991299    caps.Caps.type       = VMMDevHGCMParmType_32bit;
     
    13211321    return rc;
    13221322}
    1323 
    13241323
    13251324static int crVBoxHGCMSetPID(CRConnection *conn, unsigned long long pid)
     
    14451444            if (!g_crvboxhgcm.fHostCapsInitialized)
    14461445            {
    1447                 rc = crVBoxHGCMGetHostCaps(conn, &g_crvboxhgcm.u32HostCaps);
     1446                rc = crVBoxHGCMGetHostCapsLegacy(conn, &g_crvboxhgcm.u32HostCaps);
    14481447                if (RT_FAILURE(rc))
    14491448                {
  • trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp

    r50921 r51330  
    904904        }
    905905
    906         case SHCRGL_GUEST_FN_GET_CAPS:
    907         {
    908             Log(("svcCall: SHCRGL_GUEST_FN_GET_CAPS\n"));
    909 
    910             /* Verify parameter count and types. */
    911             if (cParms != SHCRGL_CPARMS_GET_CAPS)
    912             {
    913                 rc = VERR_INVALID_PARAMETER;
    914             }
    915             else
    916             if (paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT)
     906        case SHCRGL_GUEST_FN_GET_CAPS_NEW:
     907        {
     908            Log(("svcCall: SHCRGL_GUEST_FN_GET_CAPS_NEW\n"));
     909
     910            /* Verify parameter count and types. */
     911            if (cParms != SHCRGL_CPARMS_GET_CAPS_NEW)
     912            {
     913                WARN(("invalid parameter count"));
     914                rc = VERR_INVALID_PARAMETER;
     915                break;
     916            }
     917
     918            if (paParms[0].type != VBOX_HGCM_SVC_PARM_PTR)
     919            {
     920                WARN(("invalid parameter"));
     921                rc = VERR_INVALID_PARAMETER;
     922                break;
     923            }
     924
     925            if (paParms[0].u.pointer.size < sizeof (CR_CAPS_INFO))
     926            {
     927                WARN(("invalid buffer size"));
     928                rc = VERR_INVALID_PARAMETER;
     929                break;
     930            }
     931
     932            CR_CAPS_INFO *pInfo = (CR_CAPS_INFO*)paParms[0].u.pointer.addr;
     933            rc = crVBoxServerClientGetCapsNew(u32ClientID, pInfo);
     934            AssertRC(rc);
     935
     936            break;
     937        }
     938
     939        case SHCRGL_GUEST_FN_GET_CAPS_LEGACY:
     940        {
     941            Log(("svcCall: SHCRGL_GUEST_FN_GET_CAPS_LEGACY\n"));
     942
     943            /* Verify parameter count and types. */
     944            if (cParms != SHCRGL_CPARMS_GET_CAPS_LEGACY)
     945            {
     946                rc = VERR_INVALID_PARAMETER;
     947            }
     948            else if (paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT)
    917949            {
    918950                rc = VERR_INVALID_PARAMETER;
     
    921953            {
    922954                /* Execute the function. */
    923                 rc = crVBoxServerClientGetCaps(u32ClientID, &paParms[0].u.uint32);
     955                rc = crVBoxServerClientGetCapsLegacy(u32ClientID, &paParms[0].u.uint32);
    924956                AssertRC(rc);
    925957            }
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r51320 r51330  
    840840}
    841841
    842 extern DECLEXPORT(int32_t) crVBoxServerClientGetCaps(uint32_t u32ClientID, uint32_t *pu32Caps)
    843 {
    844     *pu32Caps = cr_server.u32Caps;
     842extern DECLEXPORT(int32_t) crVBoxServerClientGetCapsLegacy(uint32_t u32ClientID, uint32_t *pu32Caps)
     843{
     844    uint32_t u32Caps = cr_server.u32Caps;
     845    u32Caps &= ~CR_VBOX_CAP_CMDVBVA;
     846    *pu32Caps = u32Caps;
     847    return VINF_SUCCESS;
     848}
     849
     850extern DECLEXPORT(int32_t) crVBoxServerClientGetCapsNew(uint32_t u32ClientID, CR_CAPS_INFO *pInfo)
     851{
     852    pInfo->u32Caps = cr_server.u32Caps;
     853    pInfo->u32CmdVbvaVersion = CR_CMDVBVA_VERSION;
    845854    return VINF_SUCCESS;
    846855}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette