VirtualBox

Changeset 39288 in vbox for trunk/src/VBox/GuestHost/OpenGL


Ignore:
Timestamp:
Nov 14, 2011 9:58:38 AM (13 years ago)
Author:
vboxsync
Message:

CrOpenGL: avoid blocked client polling & extra memcpy (block hgsmi command until completion)

Location:
trunk/src/VBox/GuestHost/OpenGL
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/Makefile.kmk

    r39252 r39288  
    139139VBoxOGLhostcrutil_LIBS     = $(LIB_RUNTIME)
    140140ifdef VBOX_WITH_CRHGSMI
    141 VBoxOGLhostcrutil_DEFS.win = $(subst VBOX_WITH_CRHGSMI,,$(VBoxOGLcrutil_DEFS.win))
     141VBoxOGLhostcrutil_DEFS    += VBOX_WITH_CRHGSMI
    142142VBoxOGLhostcrutil_LIBS.win = $(subst $(VBOX_PATH_ADDITIONS_LIB)/VBoxCrHgsmi$(VBOX_SUFF_LIB),,$(VBoxOGLcrutil_LIBS.win))
    143143endif
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_net.h

    r33714 r39288  
    106106} CRMultiBuffer;
    107107
    108 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     108#ifdef VBOX_WITH_CRHGSMI
     109# ifdef IN_GUEST
    109110typedef struct CRVBOXHGSMI_CLIENT {
    110111    struct VBOXUHGSMI *pHgsmi;
     
    114115    struct CRBufferPool_t *bufpool;
    115116} CRVBOXHGSMI_CLIENT, *PCRVBOXHGSMI_CLIENT;
    116 #endif
     117#endif /* IN_GUEST */
     118#endif /* #ifdef VBOX_WITH_CRHGSMI */
    117119/**
    118120 * Chromium network connection (bidirectional).
     
    238240#  endif
    239241# endif
     242#else
     243# ifdef VBOX_WITH_CRHGSMI
     244    struct _crclient *pClient; /* back reference, just for simplicity */
     245    CRVBOXHGSMI_CMDDATA CmdData;
     246# endif
    240247#endif
    241248    /* Used on host side to indicate that we are not allowed to store above pointers for later use
     
    277284extern DECLEXPORT(void) crNetReadline( CRConnection *conn, void *buf );
    278285extern DECLEXPORT(int) crNetRecv( void );
     286#define CR_WRITEBACK_WAIT() do { \
     287        while (writeback) { \
     288            crNetRecv();    \
     289        }                   \
     290    } while (0)
    279291extern DECLEXPORT(void) crNetDefaultRecv( CRConnection *conn, CRMessage *msg, unsigned int len );
    280292extern DECLEXPORT(void) crNetDispatchMessage( CRNetReceiveFuncList *rfl, CRConnection *conn, CRMessage *msg, unsigned int len );
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h

    r37775 r39288  
    2222
    2323#include <VBox/vmm/ssm.h>
     24
     25#ifdef VBOX_WITH_CRHGSMI
     26# include <VBox/VBoxVideo.h>
     27#endif
    2428
    2529#ifdef __cplusplus
     
    297301extern DECLEXPORT(int32_t) crVBoxServerOutputRedirectSet(const CROutputRedirect *pCallbacks);
    298302
     303#ifdef VBOX_WITH_CRHGSMI
     304/* We moved all CrHgsmi command processing to crserverlib to keep the logic of dealing with CrHgsmi commands in one place.
     305 *
     306 * For now we need the notion of CrHgdmi commands in the crserver_lib to be able to complete it asynchronously once it is really processed.
     307 * This help avoiding the "blocked-client" issues. The client is blocked if another client is doing begin-end stuff.
     308 * For now we eliminated polling that could occur on block, which caused a higher-priority thread (in guest) polling for the blocked command complition
     309 * to block the lower-priority thread trying to complete the blocking command.
     310 * And removed extra memcpy done on blocked command arrival.
     311 *
     312 * In the future we will extend CrHgsmi functionality to maintain texture data directly in CrHgsmi allocation to avoid extra memcpy-ing with PBO,
     313 * implement command completion and stuff necessary for GPU scheduling to work properly for WDDM Windows guests, etc.
     314 *
     315 * NOTE: it is ALWAYS responsibility of the crVBoxServerCrHgsmiCmd to complete the command!
     316 * */
     317extern DECLEXPORT(int32_t) crVBoxServerCrHgsmiCmd(struct VBOXVDMACMD_CHROMIUM_CMD *pCmd);
     318extern DECLEXPORT(int32_t) crVBoxServerCrHgsmiCtl(struct VBOXVDMACMD_CHROMIUM_CTL *pCtl);
     319#endif
     320
    299321#ifdef __cplusplus
    300322}
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_unpack.h

    r15532 r39288  
    6666    INCR_DATA_PTR( *((int *) cr_unpackData ) )
    6767
    68 #define SET_RETURN_PTR( offset ) \
    69     crMemcpy( return_ptr, cr_unpackData + (offset), sizeof( *return_ptr ) );
     68#define SET_RETURN_PTR( offset ) do { \
     69        CRDBGPTR_CHECKZ(return_ptr); \
     70        crMemcpy( return_ptr, cr_unpackData + (offset), sizeof( *return_ptr ) ); \
     71    } while (0);
    7072
    71 #define SET_WRITEBACK_PTR( offset ) \
    72     crMemcpy( writeback_ptr, cr_unpackData + (offset), sizeof( *writeback_ptr ) );
     73
     74#define SET_WRITEBACK_PTR( offset ) do { \
     75        CRDBGPTR_CHECKZ(writeback_ptr); \
     76        crMemcpy( writeback_ptr, cr_unpackData + (offset), sizeof( *writeback_ptr ) ); \
     77    } while (0);
    7378
    7479#ifdef __cplusplus
  • trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c

    r38314 r39288  
    12701270        msg->header.conn_id = msg->redirptr.pMessage->conn_id;
    12711271
     1272#if defined(VBOX_WITH_CRHGSMI) && !defined(IN_GUEST)
     1273        msg->redirptr.CmdData = conn->CmdData;
     1274        CRVBOXHGSMI_CMDDATA_ASSERT_CONSISTENT(&msg->redirptr.CmdData);
     1275        CRVBOXHGSMI_CMDDATA_CLEANUP(&conn->CmdData);
     1276#endif
     1277
    12721278        cached_type = msg->redirptr.pMessage->type;
    12731279
     
    12781284    else
    12791285    {
     1286        /* we should NEVER have redir_ptr disabled with HGSMI command now */
     1287        CRASSERT(!conn->CmdData.pCmd);
    12801288        if ( len <= conn->buffer_size )
    12811289        {
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