renderspu.c revision f67af59f039fe962080af93e1f7dd5065250b2cf
2N/A * See the file LICENSE.txt for information on redistributing this software.
2N/A#include "cr_environment.h"
2N/A#include "cr_string.h"
2N/A#include "cr_error.h"
2N/A#include "cr_environment.h"
2N/A#include "renderspu.h"
2N/A#include "cr_extstring.h"
if (!displayName)
return NULL;
return NULL;
static ContextInfo * renderspuCreateContextInternal(const char *dpyName, GLint visBits, GLint idCtx, ContextInfo * sharedContext)
if (idCtx <= 0)
if (idCtx <= 0)
return NULL;
return NULL;
if (!visual)
return NULL;
if (!context)
return NULL;
return NULL;
if (sharedContext)
return context;
if (shareCtx) {
if (context)
if (!cRefs)
return cRefs;
* this is why we keep a context refference counting the base (shared) context will be destroyed as soon as*/
static void RENDER_APIENTRY
if (!context)
void RENDER_APIENTRY
#ifdef CHROMIUM_THREADSAFE
if (!window)
if (!context)
#ifdef CHROMIUM_THREADSAFE
return GL_FALSE;
return GL_TRUE;
if (id <= 0)
if (id <= 0)
if (!visual)
if (!window)
|| ((render_spu.render_to_app_window || render_spu.render_to_crut_window) && !crGetenv("CRNEWSERVER")))
showIt = 0;
(void) key;
renderspuMakeCurrent(pOldCtx&&pOldCtx->currentWindow ? pOldCtx->currentWindow->BltInfo.Base.id:CR_RENDER_DEFAULT_WINDOW_ID, 0,
if (window) {
static void RENDER_APIENTRY
if (window) {
* and that no redraw is started until new Present request comes containing a valid presentation data */
static void RENDER_APIENTRY
if (window) {
window->x = x;
window->y = y;
static void RENDER_APIENTRY
if (window) {
static void RENDER_APIENTRY
if (window) {
flag = 0;
static void RENDER_APIENTRY
renderspuVBoxPresentComposition( GLint win, struct VBOXVR_SCR_COMPOSITOR * pCompositor, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry )
if (window) {
if (pCompositor)
if (pCompositor)
void renderspuVBoxCompositorBlitStretched ( struct VBOXVR_SCR_COMPOSITOR * pCompositor, PCR_BLITTER pBlitter, GLfloat scaleX, GLfloat scaleY)
int rc = CrVrScrCompositorEntryRegionsGet(pCompositor, pEntry, &cRegions, &paSrcRegions, &paDstRegions);
uint32_t i;
for (i = 0; i < cRegions; ++i)
CrBltBlitTexMural(pBlitter, &pEntry->Tex, &paSrcRegions[i], &DstRect, 1, CRBLT_F_LINEAR | CRBLT_F_INVERT_YCOORDS);
void renderspuVBoxCompositorBlit ( struct VBOXVR_SCR_COMPOSITOR * pCompositor, PCR_BLITTER pBlitter)
int rc = CrVrScrCompositorEntryRegionsGet(pCompositor, pEntry, &cRegions, &paSrcRegions, &paDstRegions);
CrBltBlitTexMural(pBlitter, &pEntry->Tex, paSrcRegions, paDstRegions, cRegions, CRBLT_F_LINEAR | CRBLT_F_INVERT_YCOORDS);
if (!pBlitter)
if (!pBlitter)
int rc;
if (!pBlitter)
return NULL;
return NULL;
return pBlitter;
int rc;
if (pCtx)
return rc;
return VINF_SUCCESS;
PCR_BLITTER renderspuVBoxPresentBlitterGetAndEnter( WindowInfo *window, int32_t i32MakeCurrentUserData )
if (pBlitter)
return pBlitter;
return NULL;
PCR_BLITTER renderspuVBoxPresentBlitterEnsureCreated( WindowInfo *window, int32_t i32MakeCurrentUserData )
if (pTmpCompositor)
if (pBlitter)
void renderspuVBoxPresentCompositionGeneric( WindowInfo *window, struct VBOXVR_SCR_COMPOSITOR * pCompositor, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry, int32_t i32MakeCurrentUserData )
if (!pBlitter)
int rc;
* since the lock order used in presentation thread is compositor lock() -> hash table lock (aquired for id->window resolution)
* this is why, to prevent potential deadlocks, we use crHashtableWalkUnlocked that does not hold the table lock
* we are can be sure noone will modify the table here since renderspuVBoxCompositorClearAll can be called in the command (hgcm) thread only,
if (pCompositor)
return pCompositor;
return NULL;
return rc;
return rc;
int renderspuVBoxCompositorTryAcquire(WindowInfo *window, struct VBOXVR_SCR_COMPOSITOR **ppCompositor)
if (*ppCompositor)
return VINF_SUCCESS;
return rc;
int rc;
if (CrVrScrCompositorIsEmpty(window->pCompositor) && RTCritSectGetRecursion(&window->CompositorLock) == 1)
if (firstCall) {
GLint i, j;
for (i = 0; i < POINTER_HEIGHT; i++) {
for (j = 0; j < POINTER_WIDTH; j++) {
SetRasterPos(x, y);
if (lighting)
if (depthTest)
if (scissorTest)
DoSync();
Barrier *b;
Barrier *b;
(void) name;
(void) count;
(void) name;
(void) name;
(void) name;
switch (target)
static void RENDER_APIENTRY
(void) target;
(void) value;
switch (target) {
static void RENDER_APIENTRY
int client_num;
unsigned short port;
switch (target) {
case GL_GATHER_CONNECT_CR:
case CR_TCPIP:
case CR_GM:
case GL_GATHER_DRAWPIXELS_CR:
DoSync();
sizeof(CRMessageHeader));
case GL_CURSOR_POSITION_CR:
case GL_WINDOW_SIZE_CR:
GLint w, h;
if (window)
static void RENDER_APIENTRY
switch (target) {
case GL_WINDOW_SIZE_CR:
if (window)
size[0] = w;
case GL_WINDOW_POSITION_CR:
GLint x, y, w, h;
if (window)
case GL_MAX_WINDOW_SIZE_CR:
if (window)
case GL_WINDOW_VISIBILITY_CR:
if (window)
static void RENDER_APIENTRY
(void) bounds;
(void) payload;
(void) len;
(void) num_opcodes;
GLint x, y, w, h;
static void RENDER_APIENTRY
(void) writeback;
remove_trailing_space(char *s)
int k = crStrlen(s);
const char *nativeExt;
return NULL;
if (!nativeExt) {
return NULL;
#ifdef VBOX
snprintf(tempStr, sizeof(tempStr), "Chromium (%s)", (char *) render_spu.ws.glGetString(GL_RENDERER));
#ifdef CR_OPENGL_VERSION_2_0
#ifdef GL_CR_real_vendor_strings
return NULL;
if (!pWindow)