VirtualBox

Ignore:
Timestamp:
Aug 1, 2012 10:26:43 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
79662
Message:

crOgl/wddm: per-context connections

Location:
trunk/src/VBox/GuestHost/OpenGL/util
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/util/net.c

    r40124 r42499  
    7373 */
    7474static void
    75 InitConnection(CRConnection *conn, const char *protocol, unsigned int mtu)
     75InitConnection(CRConnection *conn, const char *protocol, unsigned int mtu
     76#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     77                , struct VBOXUHGSMI *pHgsmi
     78#endif
     79        )
    7680{
    7781    if (!crStrcmp(protocol, "devnull"))
     
    111115        cr_net.use_hgcm++;
    112116        crVBoxHGCMInit(cr_net.recv_list, cr_net.close_list, mtu);
    113         crVBoxHGCMConnection(conn);
     117        crVBoxHGCMConnection(conn
     118#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     119                    , pHgsmi
     120#endif
     121                );
    114122    }
    115123#endif
     
    184192 *                the mothership
    185193 */
    186 CRConnection *
    187 crNetConnectToServer( const char *server, unsigned short default_port,
    188                       int mtu, int broker )
     194CRConnection * crNetConnectToServer( const char *server, unsigned short default_port, int mtu, int broker
     195#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     196                , struct VBOXUHGSMI *pHgsmi
     197#endif
     198)
    189199{
    190200    char hostname[4096], protocol[4096];
     
    270280
    271281    /* now, just dispatch to the appropriate protocol's initialization functions. */
    272     InitConnection(conn, protocol, mtu);
     282    InitConnection(conn, protocol, mtu
     283#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     284                , pHgsmi
     285#endif
     286            );
    273287
    274288    if (!crNetConnect( conn ))
     
    287301}
    288302
    289 
    290303/**
    291304 * Send a message to the receiver that another connection is needed.
    292305 * We send a CR_MESSAGE_NEWCLIENT packet, then call crNetServerConnect.
    293306 */
    294 void crNetNewClient( CRConnection *conn, CRNetServer *ns )
     307void crNetNewClient( CRConnection *conn, CRNetServer *ns
     308#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     309                , struct VBOXUHGSMI *pHgsmi
     310#endif
     311)
    295312{
    296313    /*
     
    308325    */
    309326
    310     crNetServerConnect( ns );
     327    crNetServerConnect( ns
     328#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     329                , pHgsmi
     330#endif
     331);
    311332}
    312333
     
    368389
    369390    /* call the protocol-specific init routines */  // ktd (add)
    370     InitConnection(conn, protocol_only, mtu);       // ktd (add)
     391    InitConnection(conn, protocol_only, mtu
     392#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     393                , NULL
     394#endif
     395            );       // ktd (add)
    371396    }
    372397    else {
    373398    /* call the protocol-specific init routines */
    374       InitConnection(conn, protocol, mtu);
     399      InitConnection(conn, protocol, mtu
     400#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     401                , NULL
     402#endif
     403              );
    375404    }
    376405
     
    834863 * When done, the CrNetServer's conn field will be initialized.
    835864 */
    836 void crNetServerConnect( CRNetServer *ns )
     865void crNetServerConnect( CRNetServer *ns
     866#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     867                , struct VBOXUHGSMI *pHgsmi
     868#endif
     869)
    837870{
    838871    ns->conn = crNetConnectToServer( ns->name, DEFAULT_SERVER_PORT,
    839                                      ns->buffer_size, 0 );
    840 }
    841 
     872                                     ns->buffer_size, 0
     873#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     874                , pHgsmi
     875#endif
     876            );
     877}
    842878
    843879/**
     
    11861222        if (len)
    11871223            return len;
    1188         crNetRecv();
     1224        crNetRecv(
     1225#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     1226                conn
     1227#endif
     1228                );
    11891229    }
    11901230
     
    12341274 * is assumed to be placed on queues for processing by the handler.
    12351275 */
    1236 int crNetRecv( void )
     1276int crNetRecv(
     1277#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     1278        CRConnection *conn
     1279#endif
     1280        )
    12371281{
    12381282    int found_work = 0;
     
    12421286#ifdef VBOX_WITH_HGCM
    12431287    if ( cr_net.use_hgcm )
    1244         found_work += crVBoxHGCMRecv();
     1288        found_work += crVBoxHGCMRecv(
     1289#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     1290                    conn
     1291#endif
     1292                );
    12451293#endif
    12461294#ifdef SDP_SUPPORT
  • trunk/src/VBox/GuestHost/OpenGL/util/net_internals.h

    r33561 r42499  
    9292#ifdef VBOX_WITH_HGCM
    9393extern void crVBoxHGCMInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
    94 extern void crVBoxHGCMConnection( CRConnection *conn );
    95 extern int crVBoxHGCMRecv( void );
     94extern void crVBoxHGCMConnection( CRConnection *conn
     95#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     96        , struct VBOXUHGSMI *pHgsmi
     97#endif
     98        );
     99extern int crVBoxHGCMRecv(
     100#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     101        CRConnection *conn
     102#endif
     103        );
    96104extern CRConnection** crVBoxHGCMDump( int *num );
    97105extern void crVBoxHGCMTearDown(void);
  • trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c

    r41912 r42499  
    345345        return &conn->HgsmiClient;
    346346    {
    347         PVBOXUHGSMI pHgsmi = VBoxCrHgsmiCreate();
     347        PVBOXUHGSMI pHgsmi = conn->pExternalHgsmi ? conn->pExternalHgsmi : VBoxCrHgsmiCreate();
    348348        if (pHgsmi)
    349349        {
     
    356356            else
    357357                crWarning("_crVBoxHGSMIClientGet: _crVBoxHGSMIClientInit failed rc %d", rc);
    358             VBoxCrHgsmiDestroy(pHgsmi);
     358            if (!conn->pExternalHgsmi)
     359                VBoxCrHgsmiDestroy(pHgsmi);
    359360        }
    360361        else
     
    23332334        _crVBoxHGSMIClientTerm(&conn->HgsmiClient, &pHgsmi);
    23342335        CRASSERT(pHgsmi);
    2335         VBoxCrHgsmiDestroy(pHgsmi);
     2336        if (!conn->pExternalHgsmi)
     2337            VBoxCrHgsmiDestroy(pHgsmi);
    23362338    }
    23372339#else
     
    24982500}
    24992501
    2500 void crVBoxHGCMConnection(CRConnection *conn)
     2502void crVBoxHGCMConnection(CRConnection *conn
     2503#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     2504        , struct VBOXUHGSMI *pHgsmi
     2505#endif
     2506        )
    25012507{
    25022508    int i, found = 0;
     
    25202526        conn->InstantReclaim = crVBoxHGSMIInstantReclaim;
    25212527        conn->HandleNewMessage = crVBoxHGSMIHandleNewMessage;
     2528        conn->pExternalHgsmi = pHgsmi;
    25222529    }
    25232530    else
     
    25772584}
    25782585
    2579 int crVBoxHGCMRecv(void)
     2586#if defined(IN_GUEST)
     2587void _crVBoxHGCMPerformPollHost(CRConnection *conn)
     2588{
     2589    if (conn->type == CR_NO_CONNECTION )
     2590        return;
     2591
     2592    if (!conn->pBuffer)
     2593    {
     2594#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     2595        PCRVBOXHGSMI_CLIENT pClient;
     2596        if (g_crvboxhgcm.bHgsmiOn && !!(pClient = _crVBoxHGSMIClientGet(conn)))
     2597        {
     2598            _crVBoxHGSMIPollHost(conn, pClient);
     2599        }
     2600        else
     2601#endif
     2602        {
     2603            crVBoxHGCMPollHost(conn);
     2604        }
     2605    }
     2606}
     2607#endif
     2608
     2609void _crVBoxHGCMPerformReceiveMessage(CRConnection *conn)
     2610{
     2611    if ( conn->type == CR_NO_CONNECTION )
     2612        return;
     2613
     2614    if (conn->cbBuffer>0)
     2615    {
     2616        _crVBoxHGCMReceiveMessage(conn);
     2617    }
     2618}
     2619
     2620int crVBoxHGCMRecv(
     2621#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     2622        CRConnection *conn
     2623#endif
     2624        )
    25802625{
    25812626    int32_t i;
     
    25882633
    25892634#ifdef IN_GUEST
     2635# if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     2636    CRASSERT(!g_crvboxhgcm.bHgsmiOn == !conn);
     2637    if (conn && g_crvboxhgcm.bHgsmiOn)
     2638    {
     2639        _crVBoxHGCMPerformPollHost(conn);
     2640        _crVBoxHGCMPerformReceiveMessage(conn);
     2641        VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
     2642        return 0;
     2643    }
     2644# endif
    25902645    /* we're on guest side, poll host if it got something for us */
    25912646    for (i=0; i<g_crvboxhgcm.num_conns; i++)
     
    25932648        CRConnection *conn = g_crvboxhgcm.conns[i];
    25942649
    2595         if ( !conn || conn->type == CR_NO_CONNECTION )
     2650        if ( !conn )
    25962651            continue;
    25972652
    2598         if (!conn->pBuffer)
    2599         {
    2600 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
    2601             PCRVBOXHGSMI_CLIENT pClient;
    2602             if (g_crvboxhgcm.bHgsmiOn && !!(pClient = _crVBoxHGSMIClientGet(conn)))
    2603             {
    2604                 _crVBoxHGSMIPollHost(conn, pClient);
    2605             }
    2606             else
    2607 #endif
    2608             {
    2609                 crVBoxHGCMPollHost(conn);
    2610             }
    2611         }
     2653        _crVBoxHGCMPerformPollHost(conn);
    26122654    }
    26132655#endif
     
    26172659        CRConnection *conn = g_crvboxhgcm.conns[i];
    26182660
    2619         if ( !conn || conn->type == CR_NO_CONNECTION )
     2661        if ( !conn )
    26202662            continue;
    26212663
    2622         if (conn->cbBuffer>0)
    2623         {
    2624             _crVBoxHGCMReceiveMessage(conn);
    2625         }
     2664        _crVBoxHGCMPerformReceiveMessage(conn);
    26262665    }
    26272666
Note: See TracChangeset for help on using the changeset viewer.

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