VirtualBox

Changeset 66506 in vbox for trunk


Ignore:
Timestamp:
Apr 11, 2017 9:59:29 AM (7 years ago)
Author:
vboxsync
Message:

bugref:8524: Additions/linux: play nicely with distribution-installed Additions
Based on a patch series by Hans de Goede/Red Hat with minor adjustments by Oracle.
Graphics: Add VBoxVideoIPRT.h header
Add a VBoxVideoIPRT.h header, this adds 2 versions of this file:
1) Generic include/VBox/Graphics/VBoxVideoIPRT.h which includes all the header

files needed by files shared with the linux drm driver

2) src/VBox/Additions/linux/drm/VBoxVideoIPRT.h, which replaces the generic

gfx-common.h when building the linux drm driver


The purpose of this is to eventually redefines various iprt and HGSMI bits
in the linux drm driver version to use more linux kernel infrastructure.

Location:
trunk
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/Graphics/HGSMI.h

    r65381 r66506  
    3030#define ___VBox_Graphics_HGSMI_h
    3131
    32 #include <iprt/assert.h>
    33 #include <iprt/types.h>
     32#include <VBoxVideoIPRT.h>
    3433
    3534#include <HGSMIDefs.h>
  • trunk/include/VBox/Graphics/HGSMIDefs.h

    r65381 r66506  
    3030#define ___VBox_Graphics_HGSMIDefs_h
    3131
    32 #include <iprt/assert.h>
    33 #include <iprt/types.h>
     32#include <VBoxVideoIPRT.h>
    3433
    3534/* HGSMI uses 32 bit offsets and sizes. */
  • trunk/include/VBox/Graphics/HGSMIMemAlloc.h

    r65381 r66506  
    3131
    3232#include <HGSMIDefs.h>
    33 #include <iprt/list.h>
     33#include <VBoxVideoIPRT.h>
    3434
    3535
  • trunk/include/VBox/Graphics/VBoxVideo.h

    r65381 r66506  
    2727#define ___VBox_Graphics_VBoxVideo_h
    2828
    29 #include <iprt/cdefs.h>
    30 #include <iprt/types.h>
    31 #include <iprt/assert.h>
     29#include <VBoxVideoIPRT.h>
    3230
    3331/* this should be in sync with monitorCount <xsd:maxInclusive value="64"/> in src/VBox/Main/xml/VirtualBox-settings-common.xsd */
  • trunk/include/VBox/Graphics/VBoxVideoGuest.h

    r65381 r66506  
    3232#include <HGSMIChSetup.h>
    3333#include <VBoxVideo.h>
    34 
    35 #include <iprt/err.h>  /* The functions in here return IPRT errors. */
    36 
    37 #ifdef VBOX_XPDM_MINIPORT
    38 # include <iprt/nt/miniport.h>
    39 # include <ntddvdeo.h> /* sdk, clean */
    40 # include <iprt/nt/Video.h>
    41 #elif defined VBOX_GUESTR3XORGMOD
    42 # include <compiler.h>
    43 #else
    44 # include <iprt/asm-amd64-x86.h>
    45 #endif
     34#include <VBoxVideoIPRT.h>
    4635
    4736#ifdef VBOX_WDDM_MINIPORT
     
    5241 typedef HGSMIHEAP HGSMIGUESTCMDHEAP;
    5342# define HGSMIGUESTCMDHEAP_GET(_p) (_p)
    54 #endif
    55 
    56 #if defined(IN_RING0) && defined(RT_OS_LINUX)
    57 # define VBVOAssert(a) do {} while(0)
    58 # define VBVOAssertPtr(a) do {} while(0)
    59 # define VBVOAssertReturnVoid(a) if (!(a)) return
    60 # define VBVOAssertRC(a) do {} while(0)
    61 # define VBVOAssertPtrNullReturnVoid(a) do {} while(0)
    62 # define VBVOAssertPtrReturnVoid(a) if (!(a)) return
    63 #else
    64 # define VBVOAssert Assert
    65 # define VBVOAssertPtr AssertPtr
    66 # define VBVOAssertReturnVoid AssertReturnVoid
    67 # define VBVOAssertRC AssertRC
    68 # define VBVOAssertPtrNullReturnVoid AssertPtrNullReturnVoid
    69 # define VBVOAssertPtrReturnVoid AssertPtrReturnVoid
    7043#endif
    7144
     
    134107    struct VBVABUFFER *pVBVA;
    135108} VBVABUFFERCONTEXT, *PVBVABUFFERCONTEXT;
    136 
    137 /** @name Helper functions
    138  * @{ */
    139 /** Write an 8-bit value to an I/O port. */
    140 DECLINLINE(void) VBoxVideoCmnPortWriteUchar(RTIOPORT Port, uint8_t Value)
    141 {
    142 #ifdef VBOX_XPDM_MINIPORT
    143     VideoPortWritePortUchar((PUCHAR)Port, Value);
    144 #elif defined VBOX_GUESTR3XORGMOD
    145     outb(Port, Value);
    146 #else  /** @todo make these explicit */
    147     ASMOutU8(Port, Value);
    148 #endif
    149 }
    150 
    151 /** Write a 16-bit value to an I/O port. */
    152 DECLINLINE(void) VBoxVideoCmnPortWriteUshort(RTIOPORT Port, uint16_t Value)
    153 {
    154 #ifdef VBOX_XPDM_MINIPORT
    155     VideoPortWritePortUshort((PUSHORT)Port,Value);
    156 #elif defined VBOX_GUESTR3XORGMOD
    157     outw(Port, Value);
    158 #else
    159     ASMOutU16(Port, Value);
    160 #endif
    161 }
    162 
    163 /** Write a 32-bit value to an I/O port. */
    164 DECLINLINE(void) VBoxVideoCmnPortWriteUlong(RTIOPORT Port, uint32_t Value)
    165 {
    166 #ifdef VBOX_XPDM_MINIPORT
    167     VideoPortWritePortUlong((PULONG)Port,Value);
    168 #elif defined VBOX_GUESTR3XORGMOD
    169     outl(Port, Value);
    170 #else
    171     ASMOutU32(Port, Value);
    172 #endif
    173 }
    174 
    175 /** Read an 8-bit value from an I/O port. */
    176 DECLINLINE(uint8_t) VBoxVideoCmnPortReadUchar(RTIOPORT Port)
    177 {
    178 #ifdef VBOX_XPDM_MINIPORT
    179     return VideoPortReadPortUchar((PUCHAR)Port);
    180 #elif defined VBOX_GUESTR3XORGMOD
    181     return inb(Port);
    182 #else
    183     return ASMInU8(Port);
    184 #endif
    185 }
    186 
    187 /** Read a 16-bit value from an I/O port. */
    188 DECLINLINE(uint16_t) VBoxVideoCmnPortReadUshort(RTIOPORT Port)
    189 {
    190 #ifdef VBOX_XPDM_MINIPORT
    191     return VideoPortReadPortUshort((PUSHORT)Port);
    192 #elif defined VBOX_GUESTR3XORGMOD
    193     return inw(Port);
    194 #else
    195     return ASMInU16(Port);
    196 #endif
    197 }
    198 
    199 /** Read a 32-bit value from an I/O port. */
    200 DECLINLINE(uint32_t) VBoxVideoCmnPortReadUlong(RTIOPORT Port)
    201 {
    202 #ifdef VBOX_XPDM_MINIPORT
    203     return VideoPortReadPortUlong((PULONG)Port);
    204 #elif defined VBOX_GUESTR3XORGMOD
    205     return inl(Port);
    206 #else
    207     return ASMInU32(Port);
    208 #endif
    209 }
    210 
    211 /** @}  */
    212109
    213110/** @name Base HGSMI APIs
  • trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp

    r65381 r66506  
    1919#include <VBoxVideoGuest.h>
    2020#include <VBoxVideoVBE.h>
    21 
    22 #include <iprt/asm.h>
    23 #include <iprt/string.h>
     21#include <VBoxVideoIPRT.h>
    2422
    2523/** Send completion notification to the host for the command located at offset
     
    4341    HGSMIBUFFERHEADER *pHdr = HGSMIBufferHeaderFromData(pvMem);
    4442    HGSMIOFFSET offMem = HGSMIPointerToOffset(&pCtx->areaCtx, pHdr);
    45     VBVOAssert(offMem != HGSMIOFFSET_VOID);
     43    Assert(offMem != HGSMIOFFSET_VOID);
    4644    if(offMem != HGSMIOFFSET_VOID)
    4745    {
     
    5654{
    5755    int rc = HGSMIBufferProcess(&pCtx->areaCtx, &pCtx->channels, offBuffer);
    58     VBVOAssert(!RT_FAILURE(rc));
     56    Assert(!RT_FAILURE(rc));
    5957    if(RT_FAILURE(rc))
    6058    {
     
    7775{
    7876    HGSMIOFFSET offset = hgsmiGetHostBuffer(pCtx);
    79     VBVOAssertReturnVoid(offset != HGSMIOFFSET_VOID);
     77    AssertReturnVoid(offset != HGSMIOFFSET_VOID);
    8078    hgsmiHostCmdProcess(pCtx, offset);
    8179}
     
    161159    HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (HGSMIGUESTCMDHEAP_GET(&pCtx->heapCtx), pvBuffer);
    162160
    163     VBVOAssert(offBuffer != HGSMIOFFSET_VOID);
     161    Assert(offBuffer != HGSMIOFFSET_VOID);
    164162    if (offBuffer != HGSMIOFFSET_VOID)
    165163    {
     
    241239        if (RT_SUCCESS(rc))
    242240        {
    243             VBVOAssertRC(pCaps->rc);
     241            AssertRC(pCaps->rc);
    244242            rc = pCaps->rc;
    245243        }
     
    317315                                             uint32_t *poffHostFlags)
    318316{
    319     VBVOAssertPtrNullReturnVoid(poffVRAMBaseMapping);
    320     VBVOAssertPtrNullReturnVoid(pcbMapping);
    321     VBVOAssertPtrNullReturnVoid(poffGuestHeapMemory);
    322     VBVOAssertPtrNullReturnVoid(pcbGuestHeapMemory);
    323     VBVOAssertPtrNullReturnVoid(poffHostFlags);
     317    AssertPtrNullReturnVoid(poffVRAMBaseMapping);
     318    AssertPtrNullReturnVoid(pcbMapping);
     319    AssertPtrNullReturnVoid(poffGuestHeapMemory);
     320    AssertPtrNullReturnVoid(pcbGuestHeapMemory);
     321    AssertPtrNullReturnVoid(poffHostFlags);
    324322    if (poffVRAMBaseMapping)
    325323        *poffVRAMBaseMapping = cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE;
     
    386384    uint32_t offVRAMHostArea = offVRAMBaseMapping, cbHostArea = 0;
    387385
    388     VBVOAssertPtrReturnVoid(poffVRAMHostArea);
    389     VBVOAssertPtrReturnVoid(pcbHostArea);
     386    AssertPtrReturnVoid(poffVRAMHostArea);
     387    AssertPtrReturnVoid(pcbHostArea);
    390388    VBoxQueryConfHGSMI(pCtx, VBOX_VBVA_CONF32_HOST_HEAP_SIZE, &cbHostArea);
    391389    if (cbHostArea != 0)
     
    464462     * host heap is ready */
    465463    int rc = vboxHGSMIReportFlagsLocation(pCtx, offVRAMFlagsLocation);
    466     VBVOAssertRC(rc);
     464    AssertRC(rc);
    467465    if (RT_SUCCESS(rc) && fCaps)
    468466    {
    469467        /* Inform about caps */
    470468        rc = vboxHGSMISendCapsInfo(pCtx, fCaps);
    471         VBVOAssertRC(rc);
     469        AssertRC(rc);
    472470    }
    473471    if (RT_SUCCESS (rc))
     
    475473        /* Report the host heap location. */
    476474        rc = vboxHGSMIReportHostArea(pCtx, offVRAMHostArea, cbHostArea);
    477         VBVOAssertRC(rc);
     475        AssertRC(rc);
    478476    }
    479477    // Log(("VBoxVideo::vboxSetupAdapterInfo finished rc = %d\n", rc));
  • trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp

    r65381 r66506  
    2121
    2222#ifndef VBOX_GUESTR3XF86MOD
    23 # include <iprt/string.h>
     23# include <VBoxVideoIPRT.h>
    2424#endif
    2525
     
    331331{
    332332    int rc;
    333     VBVOAssertPtr(paHints);
     333    AssertPtr(paHints);
    334334    if (!VALID_PTR(paHints))
    335335        return VERR_INVALID_POINTER;
  • trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp

    r65381 r66506  
    1818
    1919#include <VBoxVideoGuest.h>
    20 #include <VBox/err.h>
    21 // #include <VBox/log.h>
    22 #include <iprt/string.h>
     20#include <VBoxVideoIPRT.h>
    2321
    2422/*
     
    162160        uint32_t indexRecordNext;
    163161
    164         VBVOAssert(!pCtx->fHwBufferOverflow);
    165         VBVOAssert(pCtx->pRecord == NULL);
     162        Assert(!pCtx->fHwBufferOverflow);
     163        Assert(pCtx->pRecord == NULL);
    166164
    167165        indexRecordNext = (pCtx->pVBVA->indexRecordFree + 1) % VBVA_MAX_RECORDS;
     
    206204    // LogFunc(("\n"));
    207205
    208     VBVOAssert(pCtx->pVBVA);
     206    Assert(pCtx->pVBVA);
    209207
    210208    pRecord = pCtx->pRecord;
    211     VBVOAssert(pRecord && (pRecord->cbRecord & VBVA_F_RECORD_PARTIAL));
     209    Assert(pRecord && (pRecord->cbRecord & VBVA_F_RECORD_PARTIAL));
    212210
    213211    /* Mark the record completed. */
     
    288286
    289287    VBVABUFFER *pVBVA = pCtx->pVBVA;
    290     VBVOAssert(pVBVA);
     288    Assert(pVBVA);
    291289
    292290    if (!pVBVA || pCtx->fHwBufferOverflow)
     
    295293    }
    296294
    297     VBVOAssert(pVBVA->indexRecordFirst != pVBVA->indexRecordFree);
     295    Assert(pVBVA->indexRecordFirst != pVBVA->indexRecordFree);
    298296
    299297    pRecord = pCtx->pRecord;
    300     VBVOAssert(pRecord && (pRecord->cbRecord & VBVA_F_RECORD_PARTIAL));
     298    Assert(pRecord && (pRecord->cbRecord & VBVA_F_RECORD_PARTIAL));
    301299
    302300    // LogFunc(("%d\n", cb));
     
    328326                    // LogFunc(("Buffer overflow!!!\n"));
    329327                    pCtx->fHwBufferOverflow = true;
    330                     VBVOAssert(false);
     328                    Assert(false);
    331329                    return false;
    332330                }
     
    336334        }
    337335
    338         VBVOAssert(cbChunk <= cb);
    339         VBVOAssert(cbChunk <= vboxHwBufferAvail (pVBVA));
     336        Assert(cbChunk <= cb);
     337        Assert(cbChunk <= vboxHwBufferAvail (pVBVA));
    340338
    341339        vboxHwBufferPlaceDataAt (pCtx, (uint8_t *)p + cbWritten, cbChunk, pVBVA->off32Free);
  • trunk/src/VBox/Additions/linux/drm/files_vboxvideo_drv

    r66189 r66506  
    2121    ${PATH_OUT}/revision-generated.h=>revision-generated.h \
    2222    ${PATH_OUT}/product-generated.h=>product-generated.h \
    23     ${PATH_ROOT}/include/iprt/asm.h=>include/iprt/asm.h \
    24     ${PATH_ROOT}/include/iprt/asm-amd64-x86.h=>include/iprt/asm-amd64-x86.h \
    25     ${PATH_ROOT}/include/iprt/assert.h=>include/iprt/assert.h \
    2623    ${PATH_ROOT}/include/iprt/cdefs.h=>include/iprt/cdefs.h \
    27     ${PATH_ROOT}/include/iprt/err.h=>include/iprt/err.h \
    28     ${PATH_ROOT}/include/iprt/latin1.h=>include/iprt/latin1.h \
    2924    ${PATH_ROOT}/include/iprt/list.h=>include/iprt/list.h \
    3025    ${PATH_ROOT}/include/iprt/stdarg.h=>include/iprt/stdarg.h \
    3126    ${PATH_ROOT}/include/iprt/stdint.h=>include/iprt/stdint.h \
    32     ${PATH_ROOT}/include/iprt/string.h=>include/iprt/string.h \
    3327    ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \
    34     ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \
    35     ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \
    36     ${PATH_ROOT}/include/VBox/err.h=>include/VBox/err.h \
    37     ${PATH_ROOT}/include/VBox/types.h=>include/VBox/types.h \
    3828    ${PATH_ROOT}/include/VBox/Graphics/VBoxVideo.h=>include/VBoxVideo.h \
    3929    ${PATH_ROOT}/include/VBox/Graphics/VBoxVideoGuest.h=>include/VBoxVideoGuest.h \
     
    4737    ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp=>Modesetting.c \
    4838    ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp=>VBVABase.c \
     39    ${PATH_ROOT}/src/VBox/Additions/linux/drm/VBoxVideoIPRT.h=>include/VBoxVideoIPRT.h \
    4940    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_drv.c=>vbox_drv.c \
    5041    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_drv.h=>vbox_drv.h \
  • trunk/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp

    r65381 r66506  
    2323#define LOG_GROUP LOG_GROUP_HGSMI
    2424
    25 #include <iprt/string.h>
     25#include <VBoxVideoIPRT.h>
    2626
    2727#include <HGSMI.h>
  • trunk/src/VBox/GuestHost/HGSMI/HGSMIMemAlloc.cpp

    r65381 r66506  
    5656#include <HGSMI.h>
    5757
    58 #include <iprt/err.h>
    59 #include <iprt/string.h>
     58#include <VBoxVideoIPRT.h>
    6059
    6160/*
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