cr_server.h revision 8238dbee2b0c21592e6af0fafcdb2e56cf3a791c
/* Copyright (c) 2001, Stanford University
* All rights reserved.
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#ifndef INCLUDE_CR_SERVER_H
#define INCLUDE_CR_SERVER_H
#include "cr_spu.h"
#include "cr_net.h"
#include "cr_hash.h"
#include "cr_protocol.h"
#include "cr_glstate.h"
#include "spu_dispatch_table.h"
#include "state/cr_currentpointers.h"
#ifdef VBOX_WITH_CRHGSMI
# include <VBox/VBoxVideo.h>
#endif
#include "cr_vreg.h"
#ifdef __cplusplus
extern "C" {
#endif
#define CR_MAX_WINDOWS 100
#define CR_MAX_CLIENTS 64
/*@todo must match MaxGuestMonitors from SchemaDefs.h*/
typedef DECLCALLBACKPTR(void, PFNCRSERVERPRESENTFBO) (void *data, int32_t screenId, int32_t x, int32_t y, uint32_t w, uint32_t h);
/* Callbacks for output of the rendered frames.
*
* This allows to pass rendered frames to an external component rather than draw them on screen.
*
* An external component registers the redirection callbacks using crVBoxServerOutputRedirectSet.
*
* The list of formats supported by the caller is obtained using CRORContextProperty.
* The actual format choosed by the service is passed as a CRORBegin parameter.
*/
typedef struct {
const void *pvContext; /* Supplied by crVBoxServerOutputRedirectSet. */
const char *pszFormat));
typedef struct {
} CRExtent;
struct BucketingInfo;
/**
* Mural info
*/
typedef struct {
int spuWindow; /*the SPU's corresponding window ID */
int screenId;
void *pvOutputRedirectInstance;
} CRMuralInfo;
typedef struct {
char *pszDpyName;
typedef struct {
int SpuContext;
/**
* A client is basically an upstream Cr Node (connected via mothership)
*/
typedef struct _crclient {
int spu_id; /**< id of the last SPU in the client's SPU chain */
int number; /**< a unique number for each client */
#ifdef VBOXCR_LOGFPS
#endif
} CRClient;
typedef struct _crclientnode {
} CRClientNode;
typedef struct CRPoly_t {
int npoints;
double *points;
} CRPoly;
/**
* There's one of these run queue entries per client
* The run queue is a circular, doubly-linked list of these objects.
*/
typedef struct RunQueue_t {
int blocked;
struct RunQueue_t *next;
struct RunQueue_t *prev;
} RunQueue;
typedef struct {
typedef struct {
int32_t x, y;
uint32_t w, h;
} CRScreenInfo;
typedef struct {
int32_t x, y;
uint32_t w, h;
/* BLITTER */
typedef struct CR_BLITTER_BUFFER
{
typedef struct CR_BLITTER_TEXTURE
{
typedef union CR_BLITTER_FLAGS
{
struct
{
};
typedef DECLCALLBACK(int) FNCRBLT_BLITTER(struct CR_BLITTER *pBlitter, CR_BLITTER_TEXTURE *pSrc, const RTRECT *paSrcRect, const PRTRECTSIZE pDstSize, const RTRECT *paDstRect, uint32_t cRects, uint32_t fFlags);
typedef FNCRBLT_BLITTER *PFNCRBLT_BLITTER;
#define CRBLT_F_LINEAR 0x00000001
typedef struct CR_BLITTER
{
} CR_BLITTER, *PCR_BLITTER;
{
}
{
return !!pBlitter->pRestoreCtxInfo;
}
void CrBltBlitTexMural(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects, uint32_t fFlags);
void CrBltBlitTexTex(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, const RTRECT *pSrcRect, CR_BLITTER_TEXTURE *pDst, const RTRECT *pDstRect, uint32_t cRects, uint32_t fFlags);
/* */
/* PRESENTER */
struct CR_PRESENTER;
struct CR_PRESENTER_ENTRY;
typedef DECLCALLBACK(int) FNCRDISPLAY_DRAW_ENTRY(struct CR_PRESENTER *pPresenter, struct CR_PRESENTER_ENTRY *pEntry, PCR_BLITTER pBlitter);
typedef DECLCALLBACK(int) FNCRDISPLAY_DRAW_TEXTURE(struct CR_PRESENTER *pPresenter, PCR_BLITTER pBlitter,
typedef struct CR_PRESENTER_ENTRY
{
typedef struct CR_PRESENTER
{
float StretchX;
float StretchY;
DECLCALLBACK(int) CrPtCbDrawEntrySingle(struct CR_PRESENTER *pPresenter, struct CR_PRESENTER_ENTRY *pEntry, PCR_BLITTER pBlitter);
DECLCALLBACK(int) CrPtCbDrawEntryAll(struct CR_PRESENTER *pPresenter, struct CR_PRESENTER_ENTRY *pEntry, PCR_BLITTER pBlitter);
{
}
{
}
int CrPtEntryPresent(PCR_PRESENTER pPresenter, PCR_PRESENTER_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, PCR_BLITTER pBlitter);
int CrPtInit(PCR_PRESENTER pPresenter, PFNCRDISPLAY_REGIONS_CHANGED pfnRegionsChanged, PFNCRDISPLAY_DRAW_ENTRY pfnDrawEntry, PFNCRDISPLAY_DRAW_TEXTURE pfnDrawTexture);
/* regions are valid until the next CrPt call */
/* */
/* DISPLAY */
typedef struct CR_DISPLAY_ENTRY
{
typedef struct CR_DISPLAY
{
} CR_DISPLAY, *PCR_DISPLAY;
{
}
int CrDpPresentTexture(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions);
{
}
{
}
{
return &pDisplay->MuralCreateInfo;
}
typedef struct CR_DISPLAY_ENTRY_MAP
{
PCR_DISPLAY_ENTRY CrDemEntryGetCreate(PCR_DISPLAY_ENTRY_MAP pMap, GLuint idTexture, CRContextInfo *pCtxInfo);
/* */
typedef struct {
unsigned short tcpip_port;
int screenCount;
int numClients;
int client_spu_id;
int mtu;
int buffer_size;
char protocol[1024];
/** configuration options */
/*@{*/
int useL2;
int ignore_papi;
unsigned int maxBarrierCount;
unsigned int clearCount;
int optimizeBucket;
int only_swap_once;
int debug_barriers;
int sharedDisplayLists;
int sharedTextureObjects;
int sharedPrograms;
int sharedWindows;
int uniqueWindows;
int localTileSpec;
int useDMX;
int overlapBlending;
const char *vpProjectionMatrixVariable;
int stereoView;
int vncMode; /* cmd line option */
/*@}*/
/** view_matrix config */
/*@{*/
/*@}*/
/** projection_matrix config */
/*@{*/
int currentEye;
/*@}*/
/** for warped tiles */
/*@{*/
/*@}*/
/*@{*/
float *overlap_intens;
int num_overlap_intens;
int num_overlap_levels;
/*@}*/
*using callback above to update vbox framebuffers*/
} CRServer;
extern DECLEXPORT(void) crServerServiceClients(void);
extern DECLEXPORT(void) crServerAddNewClient(void);
extern DECLEXPORT(void) crVBoxServerTearDown(void);
extern DECLEXPORT(int32_t) crVBoxServerClientWrite(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t cbBuffer);
extern DECLEXPORT(int32_t) crVBoxServerClientRead(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t *pcbBuffer);
extern DECLEXPORT(int32_t) crVBoxServerClientSetVersion(uint32_t u32ClientID, uint32_t vMajor, uint32_t vMinor);
extern DECLEXPORT(int32_t) crVBoxServerMapScreen(int sIndex, int32_t x, int32_t y, uint32_t w, uint32_t h, uint64_t winID);
extern DECLEXPORT(int32_t) crVBoxServerSetScreenViewport(int sIndex, int32_t x, int32_t y, uint32_t w, uint32_t h);
#ifdef VBOX_WITH_CRHGSMI
/* We moved all CrHgsmi command processing to crserverlib to keep the logic of dealing with CrHgsmi commands in one place.
*
* 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.
* This help avoiding the "blocked-client" issues. The client is blocked if another client is doing begin-end stuff.
* For now we eliminated polling that could occur on block, which caused a higher-priority thread (in guest) polling for the blocked command complition
* to block the lower-priority thread trying to complete the blocking command.
* And removed extra memcpy done on blocked command arrival.
*
* In the future we will extend CrHgsmi functionality to maintain texture data directly in CrHgsmi allocation to avoid extra memcpy-ing with PBO,
* implement command completion and stuff necessary for GPU scheduling to work properly for WDDM Windows guests, etc.
*
* NOTE: it is ALWAYS responsibility of the crVBoxServerCrHgsmiCmd to complete the command!
* */
extern DECLEXPORT(int32_t) crVBoxServerCrHgsmiCmd(struct VBOXVDMACMD_CHROMIUM_CMD *pCmd, uint32_t cbCmd);
extern DECLEXPORT(int32_t) crVBoxServerCrHgsmiCtl(struct VBOXVDMACMD_CHROMIUM_CTL *pCtl, uint32_t cbCtl);
#endif
#ifdef __cplusplus
}
#endif
#endif