VirtualBox

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


Ignore:
Timestamp:
Jun 24, 2013 2:30:18 PM (12 years ago)
Author:
vboxsync
Message:

wddm/crOpenGL: r0-based visible regions handling, r0-based chromium commands submission debugged, more on new presentation mechanism, cleanup, etc.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_error.h

    r41928 r46757  
    2828
    2929DECLEXPORT(void) crDebug(const char *format, ... ) PRINTF;
     30#ifdef DEBUG_misha
     31typedef void FNCRDEBUG(const char *format, ... ) PRINTF;
     32typedef FNCRDEBUG *PFNCRDEBUG;
     33DECLINLINE(PFNCRDEBUG) crGetDebug() {return crDebug;}
     34# define crWarning (RT_BREAKPOINT(), crDebug)
     35#else
    3036DECLEXPORT(void) crWarning(const char *format, ... ) PRINTF;
     37#endif
    3138DECLEXPORT(void) crInfo(const char *format, ... ) PRINTF;
    3239
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_pack.h

    r43487 r46757  
    145145#undef CR_UNALIGNED_ACCESS_OKAY
    146146#endif
     147#ifndef IN_RING0
    147148extern DECLEXPORT(void) crWriteUnalignedDouble( void *buffer, double d );
    148149extern DECLEXPORT(void) crWriteSwappedDouble( void *buffer, double d );
     150#endif
    149151
    150152extern DECLEXPORT(void) *crPackAlloc( CR_PACKER_CONTEXT_ARGDECL unsigned int len );
     
    309311  WRITE_DATA( offset, GLdouble, data )
    310312#else
    311 #define WRITE_DOUBLE( offset, data ) \
    312   crWriteUnalignedDouble( data_ptr + (offset), (data) )
    313 #endif
    314 
     313# ifndef IN_RING0
     314#  define WRITE_DOUBLE( offset, data ) \
     315        crWriteUnalignedDouble( data_ptr + (offset), (data) )
     316# else
     317#  define WRITE_DOUBLE( offset, data ) \
     318        AssertReleaseFailed()
     319# endif
     320#endif
     321
     322#ifndef IN_RING0
    315323#define WRITE_SWAPPED_DOUBLE( offset, data ) \
    316324    crWriteSwappedDouble( data_ptr + (offset), (data) )
     325#else
     326#define WRITE_SWAPPED_DOUBLE( offset, data ) \
     327        AssertReleaseFailed()
     328#endif
    317329
    318330#define WRITE_OPCODE( pc, opcode )  \
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_vreg.h

    r45251 r46757  
    7272}
    7373
     74DECLINLINE(void) VBoxRectTranslated(const RTRECT * pRect, int32_t x, int32_t y, RTRECT *pResult)
     75{
     76    *pResult = *pRect;
     77    VBoxRectTranslate(pResult, x, y);
     78}
     79
    7480DECLINLINE(void) VBoxRectMove(RTRECT * pRect, int32_t x, int32_t y)
    7581{
     
    8086    pRect->xRight  = w + x;
    8187    pRect->yBottom = h + y;
     88}
     89
     90DECLINLINE(void) VBoxRectMoved(const RTRECT * pRect, int32_t x, int32_t y, RTRECT *pResult)
     91{
     92    *pResult = *pRect;
     93    VBoxRectMove(pResult, x, y);
    8294}
    8395
     
    281293{
    282294    VBOXVR_COMPOSITOR Compositor;
     295#ifndef IN_RING0
    283296    float StretchX;
    284297    float StretchY;
     298#endif
    285299    uint32_t cRects;
    286300    uint32_t cRectsBuffer;
    287301    PRTRECT paSrcRects;
    288302    PRTRECT paDstRects;
     303#ifndef IN_RING0
    289304    RTCRITSECT CritSect;
     305#endif
    290306} VBOXVR_SCR_COMPOSITOR, *PVBOXVR_SCR_COMPOSITOR;
    291307
     
    351367VBOXVREGDECL(int) CrVrScrCompositorInit(PVBOXVR_SCR_COMPOSITOR pCompositor);
    352368VBOXVREGDECL(void) CrVrScrCompositorTerm(PVBOXVR_SCR_COMPOSITOR pCompositor);
     369#ifndef IN_RING0
    353370VBOXVREGDECL(void) CrVrScrCompositorSetStretching(PVBOXVR_SCR_COMPOSITOR pCompositor, float StretchX, float StretchY);
     371#endif
    354372/* regions are valid until the next CrVrScrCompositor call */
    355373VBOXVREGDECL(int) CrVrScrCompositorRegionsGet(PVBOXVR_SCR_COMPOSITOR pCompositor, uint32_t *pcRegions, const RTRECT **ppaSrcRegions, const RTRECT **ppaDstRegions);
     
    378396}
    379397
     398#ifndef IN_RING0
    380399DECLINLINE(int) CrVrScrCompositorLock(PVBOXVR_SCR_COMPOSITOR pCompositor)
    381400{
     
    391410    return rc;
    392411}
    393 
     412#endif
    394413RT_C_DECLS_END
    395414
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_buffer.c

    r43487 r46757  
    243243
    244244#ifdef IN_RING0
    245         if(!num_opcodes)
     245        if(num_opcodes)
     246        {
     247            num_opcodes = (num_opcodes + 0x3) & (~0x3);
     248        }
     249        else
    246250#endif
    247251        {
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_misc.c

    r33475 r46757  
    88#include "cr_error.h"
    99
    10 void PACK_APIENTRY crPackChromiumParametervCR(GLenum target, GLenum type, GLsizei count, const GLvoid *values)
     10void PACK_APIENTRY crPackChromiumParametervCR(CR_PACKER_CONTEXT_ARGDECL GLenum target, GLenum type, GLsizei count, const GLvoid *values)
    1111{
    1212    CR_GET_PACKER_CONTEXT(pc);
     
    3030        params_length = sizeof(GLint) * count;
    3131        break;
     32#ifndef IN_RING0
    3233    case GL_FLOAT:
    3334        params_length = sizeof(GLfloat) * count;
    3435        break;
     36#endif
    3537#if 0
    3638    case GL_DOUBLE:
     
    7577        }
    7678        break;
     79#ifndef IN_RING0
    7780    case GL_FLOAT:
    7881        for (i = 0; i < count; i++, pos += sizeof(GLfloat)) {
     
    8083        }
    8184        break;
     85#endif
    8286#if 0
    8387    case GL_DOUBLE:
     
    96100}
    97101
    98 void PACK_APIENTRY crPackDeleteQueriesARB(GLsizei n, const GLuint * ids)
     102#ifndef IN_RING0
     103void PACK_APIENTRY crPackDeleteQueriesARB(CR_PACKER_CONTEXT_ARGDECL GLsizei n, const GLuint * ids)
    99104{
    100105    unsigned char *data_ptr;
     
    108113    crPackFree(data_ptr);
    109114}
     115#endif
     116
     117void PACK_APIENTRY crPackVBoxTexPresent( CR_PACKER_CONTEXT_ARGDECL GLuint texture, GLuint cfg, GLint xPos, GLint yPos, GLint cRects, const GLint * pRects )
     118{
     119    GLint i, size, cnt;
     120
     121    CR_GET_PACKER_CONTEXT(pc);
     122    unsigned char *data_ptr;
     123    (void) pc;
     124    size = 28 + cRects * 4 * sizeof(GLint);
     125    CR_GET_BUFFERED_POINTER( pc, size );
     126    WRITE_DATA( 0, GLint, size );
     127    WRITE_DATA( 4, GLenum, CR_VBOXTEXPRESENT_EXTEND_OPCODE );
     128    WRITE_DATA( 8, GLint, texture );
     129    WRITE_DATA( 12, GLint, cfg );
     130    WRITE_DATA( 16, GLint, xPos );
     131    WRITE_DATA( 20, GLint, yPos );
     132    WRITE_DATA( 24, GLint, cRects );
     133
     134    cnt = 28;
     135    for (i=0; i<cRects; ++i)
     136    {
     137        WRITE_DATA(cnt, GLint, (GLint) pRects[4*i+0]);
     138        WRITE_DATA(cnt+4, GLint, (GLint) pRects[4*i+1]);
     139        WRITE_DATA(cnt+8, GLint, (GLint) pRects[4*i+2]);
     140        WRITE_DATA(cnt+12, GLint, (GLint) pRects[4*i+3]);
     141        cnt += 16;
     142    }
     143    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
     144    CR_UNLOCK_PACKER_CONTEXT(pc);
     145}
     146
     147void PACK_APIENTRY crPackWindowPosition( CR_PACKER_CONTEXT_ARGDECL GLint window, GLint x, GLint y )
     148{
     149    CR_GET_PACKER_CONTEXT(pc);
     150    unsigned char *data_ptr;
     151    (void) pc;
     152    CR_GET_BUFFERED_POINTER( pc, 20 );
     153    WRITE_DATA( 0, GLint, 20 );
     154    WRITE_DATA( 4, GLenum, CR_WINDOWPOSITION_EXTEND_OPCODE );
     155    WRITE_DATA( 8, GLint, window );
     156    WRITE_DATA( 12, GLint, x );
     157    WRITE_DATA( 16, GLint, y );
     158    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
     159    CR_UNLOCK_PACKER_CONTEXT(pc);
     160}
     161
     162void PACK_APIENTRY crPackWindowShow( CR_PACKER_CONTEXT_ARGDECL GLint window, GLint flag )
     163{
     164    CR_GET_PACKER_CONTEXT(pc);
     165    unsigned char *data_ptr;
     166    (void) pc;
     167    CR_GET_BUFFERED_POINTER( pc, 16 );
     168    WRITE_DATA( 0, GLint, 16 );
     169    WRITE_DATA( 4, GLenum, CR_WINDOWSHOW_EXTEND_OPCODE );
     170    WRITE_DATA( 8, GLint, window );
     171    WRITE_DATA( 12, GLint, flag );
     172    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
     173    CR_UNLOCK_PACKER_CONTEXT(pc);
     174}
     175
     176void PACK_APIENTRY crPackWindowSize( CR_PACKER_CONTEXT_ARGDECL GLint window, GLint w, GLint h )
     177{
     178    CR_GET_PACKER_CONTEXT(pc);
     179    unsigned char *data_ptr;
     180    (void) pc;
     181    CR_GET_BUFFERED_POINTER( pc, 20 );
     182    WRITE_DATA( 0, GLint, 20 );
     183    WRITE_DATA( 4, GLenum, CR_WINDOWSIZE_EXTEND_OPCODE );
     184    WRITE_DATA( 8, GLint, window );
     185    WRITE_DATA( 12, GLint, w );
     186    WRITE_DATA( 16, GLint, h );
     187    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
     188    CR_UNLOCK_PACKER_CONTEXT(pc);
     189}
  • trunk/src/VBox/GuestHost/OpenGL/packer/packer.h

    r15532 r46757  
    1919#include "cr_mem.h"
    2020
     21#ifndef IN_RING0
    2122extern void __PackError( int line, const char *file, GLenum error, const char *info );
     23#else
     24# define __PackError( line, file, error, info) do { AssertReleaseFailed(); } while (0)
     25#endif
    2226
    2327#endif /* CR_PACKER_H */
  • trunk/src/VBox/GuestHost/OpenGL/packer/packer_special

    r27244 r46757  
    177177UniformMatrix3x4fv
    178178UniformMatrix4x3fv
     179VBoxTexPresent
     180WindowPosition
     181WindowShow
     182WindowSize
  • trunk/src/VBox/GuestHost/OpenGL/util/error.c

    r41635 r46757  
    246246}
    247247
     248#ifdef DEBUG_misha
     249# undef crWarning
     250#endif
    248251DECLEXPORT(void) crWarning(const char *format, ... )
    249252{
     
    496499#else
    497500    if (!output
    498 # ifndef DEBUG_misha
    499501            || output==stderr
    500 # endif
    501502            )
    502503    {
     
    505506    else
    506507    {
    507 # ifndef DEBUG_misha
    508508        LogRel(("%s\n", txt));
    509 # endif
    510509        outputChromiumMessage(output, txt);
    511510    }
  • trunk/src/VBox/GuestHost/OpenGL/util/vreg.cpp

    r45627 r46757  
    1717 */
    1818#include <cr_vreg.h>
    19 #include <iprt/memcache.h>
    2019#include <iprt/err.h>
    2120#include <iprt/assert.h>
    2221#include <iprt/asm.h>
    2322
    24 #ifndef IN_RING0
    2523#include <cr_error.h>
    2624#define WARN(_m) do { crWarning _m ; } while (0)
    27 #else
    28 # error port me!
    29 #endif
    30 
    31 #ifdef DEBUG_misha
    32 //# define VBOXVDBG_VR_LAL_DISABLE
    33 #endif
    34 
     25
     26#ifndef IN_RING0
     27#include <iprt/memcache.h>
    3528#ifndef VBOXVDBG_VR_LAL_DISABLE
    36 static volatile int32_t g_cVBoxVrInits = 0;
    3729static RTMEMCACHE g_VBoxVrLookasideList;
    38 #endif
    39 
    40 static PVBOXVR_REG vboxVrRegCreate()
    41 {
    42 #ifndef VBOXVDBG_VR_LAL_DISABLE
    43     PVBOXVR_REG pReg = (PVBOXVR_REG)RTMemCacheAlloc(g_VBoxVrLookasideList);
    44     if (!pReg)
    45     {
    46         WARN(("ExAllocateFromLookasideListEx failed!"));
    47     }
    48     return pReg;
    49 #else
    50     return (PVBOXVR_REG)RTMemAlloc(sizeof (VBOXVR_REG));
    51 #endif
    52 }
    53 
    54 static void vboxVrRegTerm(PVBOXVR_REG pReg)
    55 {
    56 #ifndef VBOXVDBG_VR_LAL_DISABLE
    57     RTMemCacheFree(g_VBoxVrLookasideList, pReg);
    58 #else
    59     RTMemFree(pReg);
    60 #endif
    61 }
    62 
    63 VBOXVREGDECL(void) VBoxVrListClear(PVBOXVR_LIST pList)
    64 {
    65     PVBOXVR_REG pReg, pRegNext;
    66 
    67     RTListForEachSafe(&pList->ListHead, pReg, pRegNext, VBOXVR_REG, ListEntry)
    68     {
    69         vboxVrRegTerm(pReg);
    70     }
    71     VBoxVrListInit(pList);
    72 }
    73 
    74 #define VBOXVR_MEMTAG 'vDBV'
    75 
    76 VBOXVREGDECL(int) VBoxVrInit()
    77 {
    78     int32_t cNewRefs = ASMAtomicIncS32(&g_cVBoxVrInits);
    79     Assert(cNewRefs >= 1);
    80     Assert(cNewRefs == 1); /* <- debugging */
    81     if (cNewRefs > 1)
    82         return VINF_SUCCESS;
    83 
    84 #ifndef VBOXVDBG_VR_LAL_DISABLE
    85     int rc = RTMemCacheCreate(&g_VBoxVrLookasideList, sizeof (VBOXVR_REG),
     30#define vboxVrRegLaAlloc(_c) RTMemCacheAlloc((_c))
     31#define vboxVrRegLaFree(_c, _e) RTMemCacheFree((_c), (_e))
     32DECLINLINE(int) vboxVrLaCreate(RTMEMCACHE *pCache, size_t cbElement)
     33{
     34    int rc = RTMemCacheCreate(pCache, cbElement,
    8635                            0, /* size_t cbAlignment */
    8736                            UINT32_MAX, /* uint32_t cMaxObjects */
     
    9342    if (!RT_SUCCESS(rc))
    9443    {
     44        WARN(("RTMemCacheCreate failed rc %d", rc));
     45        return rc;
     46    }
     47    return VINF_SUCCESS;
     48}
     49#define vboxVrLaDestroy(_c) RTMemCacheDestroy((_c))
     50#endif
     51#else
     52# ifdef RT_OS_WINDOWS
     53#  ifdef PAGE_SIZE
     54#    undef PAGE_SIZE
     55#  endif
     56#  ifdef PAGE_SHIFT
     57#    undef PAGE_SHIFT
     58#  endif
     59#  define VBOX_WITH_WORKAROUND_MISSING_PACK
     60#  if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
     61#    define _InterlockedExchange           _InterlockedExchange_StupidDDKVsCompilerCrap
     62#    define _InterlockedExchangeAdd        _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
     63#    define _InterlockedCompareExchange    _InterlockedCompareExchange_StupidDDKVsCompilerCrap
     64#    define _InterlockedAddLargeStatistic  _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
     65#    define _interlockedbittestandset      _interlockedbittestandset_StupidDDKVsCompilerCrap
     66#    define _interlockedbittestandreset    _interlockedbittestandreset_StupidDDKVsCompilerCrap
     67#    define _interlockedbittestandset64    _interlockedbittestandset64_StupidDDKVsCompilerCrap
     68#    define _interlockedbittestandreset64  _interlockedbittestandreset64_StupidDDKVsCompilerCrap
     69#    pragma warning(disable : 4163)
     70#    ifdef VBOX_WITH_WORKAROUND_MISSING_PACK
     71#      pragma warning(disable : 4103)
     72#    endif
     73#    include <ntddk.h>
     74#    pragma warning(default : 4163)
     75#    ifdef VBOX_WITH_WORKAROUND_MISSING_PACK
     76#      pragma pack()
     77#      pragma warning(default : 4103)
     78#    endif
     79#    undef  _InterlockedExchange
     80#    undef  _InterlockedExchangeAdd
     81#    undef  _InterlockedCompareExchange
     82#    undef  _InterlockedAddLargeStatistic
     83#    undef  _interlockedbittestandset
     84#    undef  _interlockedbittestandreset
     85#    undef  _interlockedbittestandset64
     86#    undef  _interlockedbittestandreset64
     87#  else
     88#    include <ntddk.h>
     89#  endif
     90#ifndef VBOXVDBG_VR_LAL_DISABLE
     91static LOOKASIDE_LIST_EX g_VBoxVrLookasideList;
     92#define vboxVrRegLaAlloc(_c) ExAllocateFromLookasideListEx(&(_c))
     93#define vboxVrRegLaFree(_c, _e) ExFreeToLookasideListEx(&(_c), (_e))
     94#define VBOXWDDMVR_MEMTAG 'vDBV'
     95DECLINLINE(int) vboxVrLaCreate(LOOKASIDE_LIST_EX *pCache, size_t cbElement)
     96{
     97    NTSTATUS Status = ExInitializeLookasideListEx(pCache,
     98                                NULL, /* PALLOCATE_FUNCTION_EX Allocate */
     99                                NULL, /* PFREE_FUNCTION_EX Free */
     100                                NonPagedPool,
     101                                0, /* ULONG Flags */
     102                                cbElement,
     103                                VBOXWDDMVR_MEMTAG,
     104                                0 /* USHORT Depth - reserved, must be null */
     105                                );
     106    if (!NT_SUCCESS(Status))
     107    {
     108        WARN(("ExInitializeLookasideListEx failed, Status (0x%x)", Status));
     109        return VERR_GENERAL_FAILURE;
     110    }
     111
     112    return VINF_SUCCESS;
     113}
     114#define vboxVrLaDestroy(_c) ExDeleteLookasideListEx(&(_c))
     115#endif
     116# else
     117#  error "port me!"
     118# endif
     119#endif
     120
     121#ifdef DEBUG_misha
     122//# define VBOXVDBG_VR_LAL_DISABLE
     123#endif
     124
     125#ifndef VBOXVDBG_VR_LAL_DISABLE
     126static volatile int32_t g_cVBoxVrInits = 0;
     127#endif
     128
     129static PVBOXVR_REG vboxVrRegCreate()
     130{
     131#ifndef VBOXVDBG_VR_LAL_DISABLE
     132    PVBOXVR_REG pReg = (PVBOXVR_REG)vboxVrRegLaAlloc(g_VBoxVrLookasideList);
     133    if (!pReg)
     134    {
     135        WARN(("ExAllocateFromLookasideListEx failed!"));
     136    }
     137    return pReg;
     138#else
     139    return (PVBOXVR_REG)RTMemAlloc(sizeof (VBOXVR_REG));
     140#endif
     141}
     142
     143static void vboxVrRegTerm(PVBOXVR_REG pReg)
     144{
     145#ifndef VBOXVDBG_VR_LAL_DISABLE
     146    vboxVrRegLaFree(g_VBoxVrLookasideList, pReg);
     147#else
     148    RTMemFree(pReg);
     149#endif
     150}
     151
     152VBOXVREGDECL(void) VBoxVrListClear(PVBOXVR_LIST pList)
     153{
     154    PVBOXVR_REG pReg, pRegNext;
     155
     156    RTListForEachSafe(&pList->ListHead, pReg, pRegNext, VBOXVR_REG, ListEntry)
     157    {
     158        vboxVrRegTerm(pReg);
     159    }
     160    VBoxVrListInit(pList);
     161}
     162
     163#define VBOXVR_MEMTAG 'vDBV'
     164
     165VBOXVREGDECL(int) VBoxVrInit()
     166{
     167    int32_t cNewRefs = ASMAtomicIncS32(&g_cVBoxVrInits);
     168    Assert(cNewRefs >= 1);
     169    Assert(cNewRefs == 1); /* <- debugging */
     170    if (cNewRefs > 1)
     171        return VINF_SUCCESS;
     172
     173#ifndef VBOXVDBG_VR_LAL_DISABLE
     174    int rc = vboxVrLaCreate(&g_VBoxVrLookasideList, sizeof (VBOXVR_REG));
     175    if (!RT_SUCCESS(rc))
     176    {
    95177        WARN(("ExInitializeLookasideListEx failed, rc (%d)", rc));
    96178        return rc;
     
    109191
    110192#ifndef VBOXVDBG_VR_LAL_DISABLE
    111     RTMemCacheDestroy(g_VBoxVrLookasideList);
     193    vboxVrLaDestroy(g_VBoxVrLookasideList);
    112194#endif
    113195}
     
    15421624    int rc = VBoxVrListRectsGet(&pCEntry->Vr, cRects, pEntry->paDstRects);
    15431625    AssertRC(rc);
    1544     if (pCompositor->StretchX >= 1. && pCompositor->StretchY >= 1. /* <- stretching can not zero some rects */
    1545             && !pEntry->Pos.x && !pEntry->Pos.y)
     1626    if (
     1627#ifndef IN_RING0
     1628            pCompositor->StretchX >= 1. && pCompositor->StretchY >= 1. /* <- stretching can not zero some rects */
     1629            &&
     1630#endif
     1631            !pEntry->Pos.x && !pEntry->Pos.y
     1632            )
    15461633    {
    15471634        memcpy(pEntry->paSrcRects, pEntry->paDstRects, cRects * sizeof (*pEntry->paSrcRects));
     
    15511638        for (uint32_t i = 0; i < cRects; ++i)
    15521639        {
    1553             pEntry->paSrcRects[i].xLeft = (int32_t)((pEntry->paDstRects[i].xLeft - pEntry->Pos.x) * pCompositor->StretchX);
    1554             pEntry->paSrcRects[i].yTop = (int32_t)((pEntry->paDstRects[i].yTop - pEntry->Pos.y) * pCompositor->StretchY);
    1555             pEntry->paSrcRects[i].xRight = (int32_t)((pEntry->paDstRects[i].xRight - pEntry->Pos.x) * pCompositor->StretchX);
    1556             pEntry->paSrcRects[i].yBottom = (int32_t)((pEntry->paDstRects[i].yBottom - pEntry->Pos.y) * pCompositor->StretchY);
    1557         }
    1558 
    1559         bool canZeroX = (pCompositor->StretchX < 1);
    1560         bool canZeroY = (pCompositor->StretchY < 1);
     1640            pEntry->paSrcRects[i].xLeft = (int32_t)((pEntry->paDstRects[i].xLeft - pEntry->Pos.x));
     1641            pEntry->paSrcRects[i].yTop = (int32_t)((pEntry->paDstRects[i].yTop - pEntry->Pos.y));
     1642            pEntry->paSrcRects[i].xRight = (int32_t)((pEntry->paDstRects[i].xRight - pEntry->Pos.x));
     1643            pEntry->paSrcRects[i].yBottom = (int32_t)((pEntry->paDstRects[i].yBottom - pEntry->Pos.y));
     1644#ifndef IN_RING0
     1645            if (pCompositor->StretchX != 1.)
     1646            {
     1647                pEntry->paSrcRects[i].xLeft = (int32_t)(pEntry->paSrcRects[i].xLeft * pCompositor->StretchX);
     1648                pEntry->paSrcRects[i].xRight = (int32_t)(pEntry->paSrcRects[i].xRight * pCompositor->StretchX);
     1649            }
     1650            if (pCompositor->StretchY != 1.)
     1651            {
     1652                pEntry->paSrcRects[i].yTop = (int32_t)(pEntry->paSrcRects[i].yTop * pCompositor->StretchY);
     1653                pEntry->paSrcRects[i].yBottom = (int32_t)(pEntry->paSrcRects[i].yBottom * pCompositor->StretchY);
     1654            }
     1655#endif
     1656        }
     1657
     1658#ifndef IN_RING0
     1659        bool canZeroX = (pCompositor->StretchX < 1.);
     1660        bool canZeroY = (pCompositor->StretchY < 1.);
    15611661        if (canZeroX && canZeroY)
    15621662        {
     
    15891689            }
    15901690        }
    1591     }
    1592 
     1691#endif
     1692    }
    15931693    pEntry->cRects = cRects;
    15941694    pData->paDstRects += cRects;
     
    19802080{
    19812081    memset(pCompositor, 0, sizeof (*pCompositor));
     2082#ifndef IN_RING0
    19822083    int rc = RTCritSectInit(&pCompositor->CritSect);
    1983     if (RT_SUCCESS(rc))
    1984     {
    1985         VBoxVrCompositorInit(&pCompositor->Compositor, NULL);
    1986         pCompositor->StretchX = 1.0;
    1987         pCompositor->StretchY = 1.0;
    1988         return VINF_SUCCESS;
    1989     }
    1990     else
     2084    if (!RT_SUCCESS(rc))
    19912085    {
    19922086        WARN(("RTCritSectInit failed rc %d", rc));
    1993     }
    1994     return rc;
     2087        return rc;
     2088    }
     2089#endif
     2090    VBoxVrCompositorInit(&pCompositor->Compositor, NULL);
     2091#ifndef IN_RING0
     2092    pCompositor->StretchX = 1.0;
     2093    pCompositor->StretchY = 1.0;
     2094#endif
     2095    return VINF_SUCCESS;
    19952096}
    19962097
     
    20022103    if (pCompositor->paSrcRects)
    20032104        RTMemFree(pCompositor->paSrcRects);
    2004 
     2105#ifndef IN_RING0
    20052106    RTCritSectDelete(&pCompositor->CritSect);
     2107#endif
    20062108}
    20072109
     
    20182120    VBoxVrCompositorVisit(&pCompositor->Compositor, crVrScrCompositorEntrySetAllChangedCb, (void*)fChanged);
    20192121}
    2020 
     2122#ifndef IN_RING0
    20212123VBOXVREGDECL(void) CrVrScrCompositorSetStretching(PVBOXVR_SCR_COMPOSITOR pCompositor, float StretchX, float StretchY)
    20222124{
     
    20262128    CrVrScrCompositorEntrySetAllChanged(pCompositor, true);
    20272129}
    2028 
     2130#endif
    20292131/* regions are valid until the next CrVrScrCompositor call */
    20302132VBOXVREGDECL(int) CrVrScrCompositorRegionsGet(PVBOXVR_SCR_COMPOSITOR pCompositor, uint32_t *pcRegions, const RTRECT **ppaSrcRegions, const RTRECT **ppaDstRegions)
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