VirtualBox

Changeset 68848 in vbox


Ignore:
Timestamp:
Sep 24, 2017 4:58:46 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
118102
Message:

Additions/linux/drm: lots of formatting changes to match kernel style.
bugref:8524: Additions/linux: play nicely with distribution-installed Additions

This change makes a lot of formatting changes to the Linux Additions drm
driver, with no intended changes to functionality, and much of the
formatting change done using the sed script which installs the driver
sources to the Additions archive. Hans de Goede's clean-up of the driver for
submission to staging is the base for these changes.

Location:
trunk
Files:
1 deleted
10 edited
1 moved

Legend:

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

    r68672 r68848  
    3131
    3232/* HGSMI setup and configuration channel commands and data structures. */
    33 #define HGSMI_CC_HOST_FLAGS_LOCATION 0 /* Tell the host the location of HGSMIHOSTFLAGS structure,
    34                                         * where the host can write information about pending
    35                                         * buffers, etc, and which can be quickly polled by
    36                                         * the guest without a need to port IO.
    37                                         */
     33/*
     34 * Tell the host the location of hgsmi_host_flags structure, where the host
     35 * can write information about pending buffers, etc, and which can be quickly
     36 * polled by the guest without a need to port IO.
     37 */
     38#define HGSMI_CC_HOST_FLAGS_LOCATION 0
    3839
    3940typedef struct HGSMIBUFFERLOCATION
     
    4647/* HGSMI setup and configuration data structures. */
    4748/* host->guest commands pending, should be accessed under FIFO lock only */
    48 #define HGSMIHOSTFLAGS_COMMANDS_PENDING    UINT32_C(0x1)
     49#define HGSMIHOSTFLAGS_COMMANDS_PENDING    UINT32_C(0x01)
    4950/* IRQ is fired, should be accessed under VGAState::lock only  */
    50 #define HGSMIHOSTFLAGS_IRQ                 UINT32_C(0x2)
     51#define HGSMIHOSTFLAGS_IRQ                 UINT32_C(0x02)
    5152#ifdef VBOX_WITH_WDDM
    5253/* one or more guest commands is completed, should be accessed under FIFO lock only */
    53 # define HGSMIHOSTFLAGS_GCOMMAND_COMPLETED UINT32_C(0x4)
     54# define HGSMIHOSTFLAGS_GCOMMAND_COMPLETED UINT32_C(0x04)
    5455/* watchdog timer interrupt flag (used for debugging), should be accessed under VGAState::lock only */
    55 # define HGSMIHOSTFLAGS_WATCHDOG           UINT32_C(0x8)
     56# define HGSMIHOSTFLAGS_WATCHDOG           UINT32_C(0x08)
    5657#endif
    5758/* vsync interrupt flag, should be accessed under VGAState::lock only */
     
    5960/** monitor hotplug flag, should be accessed under VGAState::lock only */
    6061#define HGSMIHOSTFLAGS_HOTPLUG             UINT32_C(0x20)
    61 /** Cursor capability state change flag, should be accessed under
    62  * VGAState::lock only.  @see VBVACONF32. */
     62/**
     63 * Cursor capability state change flag, should be accessed under
     64 * VGAState::lock only.  @see VBVACONF32.
     65 */
    6366#define HGSMIHOSTFLAGS_CURSOR_CAPABILITIES UINT32_C(0x40)
    6467
    6568typedef struct HGSMIHOSTFLAGS
    6669{
    67     /* host flags can be accessed and modified in multiple threads concurrently,
    68      * e.g. CrOpenGL HGCM and GUI threads when to completing HGSMI 3D and Video Accel respectively,
    69      * EMT thread when dealing with HGSMI command processing, etc.
    70      * Besides settings/cleaning flags atomically, some each flag has its own special sync restrictions,
    71      * see commants for flags definitions above */
     70    /*
     71     * Host flags can be accessed and modified in multiple threads
     72     * concurrently, e.g. CrOpenGL HGCM and GUI threads when completing
     73     * HGSMI 3D and Video Accel respectively, EMT thread when dealing with
     74     * HGSMI command processing, etc.
     75     * Besides settings/cleaning flags atomically, some flags have their
     76     * own special sync restrictions, see comments for flags above.
     77     */
    7278    volatile uint32_t u32HostFlags;
    7379    uint32_t au32Reserved[3];
     
    7682
    7783#endif
    78 
  • trunk/include/VBox/Graphics/HGSMIChannels.h

    r66544 r68848  
    3333
    3434
    35 /* Each channel has an 8 bit identifier. There are a number of predefined
     35/*
     36 * Each channel has an 8 bit identifier. There are a number of predefined
    3637 * (hardcoded) channels.
    3738 *
     
    3940 * to a free 16 bit numerical value. values are allocated in range
    4041 * [HGSMI_CH_STRING_FIRST;HGSMI_CH_STRING_LAST].
    41  *
    4242 */
    4343
    4444
    4545/* Predefined channel identifiers. Used internally by VBOX to simplify the channel setup. */
    46 #define HGSMI_CH_RESERVED     (0x00) /* A reserved channel value. */
    47 
    48 #define HGSMI_CH_HGSMI        (0x01) /* HGCMI: setup and configuration channel. */
    49 
    50 #define HGSMI_CH_VBVA         (0x02) /* Graphics: VBVA. */
    51 #define HGSMI_CH_SEAMLESS     (0x03) /* Graphics: Seamless with a single guest region. */
    52 #define HGSMI_CH_SEAMLESS2    (0x04) /* Graphics: Seamless with separate host windows. */
    53 #define HGSMI_CH_OPENGL       (0x05) /* Graphics: OpenGL HW acceleration. */
     46/* A reserved channel value */
     47#define HGSMI_CH_RESERVED     0x00
     48/* HGCMI: setup and configuration */
     49#define HGSMI_CH_HGSMI        0x01
     50/* Graphics: VBVA */
     51#define HGSMI_CH_VBVA         0x02
     52/* Graphics: Seamless with a single guest region */
     53#define HGSMI_CH_SEAMLESS     0x03
     54/* Graphics: Seamless with separate host windows */
     55#define HGSMI_CH_SEAMLESS2    0x04
     56/* Graphics: OpenGL HW acceleration */
     57#define HGSMI_CH_OPENGL       0x05
    5458
    5559
    5660/* Dynamically allocated channel identifiers. */
    57 #define HGSMI_CH_STRING_FIRST (0x20) /* The first channel index to be used for string mappings (inclusive). */
    58 #define HGSMI_CH_STRING_LAST  (0xff) /* The last channel index for string mappings (inclusive). */
     61/* The first channel index to be used for string mappings (inclusive) */
     62#define HGSMI_CH_STRING_FIRST 0x20
     63/* The last channel index for string mappings (inclusive) */
     64#define HGSMI_CH_STRING_LAST  0xff
    5965
    6066
    61 /* Check whether the channel identifier is allocated for a dynamic channel. */
     67/* Check whether the channel identifier is allocated for a dynamic channel */
    6268#define HGSMI_IS_DYNAMIC_CHANNEL(_channel) (((uint8_t)(_channel) & 0xE0) != 0)
    6369
  • trunk/include/VBox/Graphics/VBoxVideoGuest.h

    r68672 r68848  
    2929#define ___VBox_Graphics_VBoxVideoGuest_h___
    3030
     31#include "VBoxVideoIPRT.h"
    3132#include "HGSMIBase.h"
    3233#include "VBoxVideo.h"
    33 #include "VBoxVideoIPRT.h"
    3434
    3535RT_C_DECLS_BEGIN
  • trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp

    r67145 r68848  
    2626 */
    2727
     28#include <HGSMIBase.h>
     29#include <VBoxVideoIPRT.h>
    2830#include <VBoxVideoGuest.h>
    2931#include <VBoxVideoVBE.h>
    30 #include <VBoxVideoIPRT.h>
     32#include <HGSMIChannels.h>
     33#include <HGSMIChSetup.h>
    3134
    3235/** Detect whether HGSMI is supported by the host. */
     
    4548
    4649/**
    47  * Inform the host of the location of the host flags in VRAM via an HGSMI
    48  * command.
     50 * Inform the host of the location of the host flags in VRAM via an HGSMI command.
    4951 * @returns  IPRT status value.
    5052 * @returns  VERR_NOT_IMPLEMENTED  if the host does not support the command.
    5153 * @returns  VERR_NO_MEMORY        if a heap allocation fails.
    5254 * @param    pCtx                  the context of the guest heap to use.
    53  * @param    offLocation           the offset chosen for the flags withing guest
    54  *                                 VRAM.
    55  */
    56 DECLHIDDEN(int) VBoxHGSMIReportFlagsLocation(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    57                                              HGSMIOFFSET offLocation)
     55 * @param    offLocation           the offset chosen for the flags withing guest VRAM.
     56 */
     57DECLHIDDEN(int) VBoxHGSMIReportFlagsLocation(PHGSMIGUESTCOMMANDCONTEXT pCtx, HGSMIOFFSET offLocation)
    5858{
    5959    HGSMIBUFFERLOCATION *p;
    60     int rc = VINF_SUCCESS;
    61 
    62     /* Allocate the IO buffer. */
    63     p = (HGSMIBUFFERLOCATION *)VBoxHGSMIBufferAlloc(pCtx,
    64                                               sizeof(HGSMIBUFFERLOCATION),
    65                                               HGSMI_CH_HGSMI,
    66                                               HGSMI_CC_HOST_FLAGS_LOCATION);
    67     if (p)
    68     {
    69         /* Prepare data to be sent to the host. */
    70         p->offLocation = offLocation;
    71         p->cbLocation  = sizeof(HGSMIHOSTFLAGS);
    72         rc = VBoxHGSMIBufferSubmit(pCtx, p);
    73         /* Free the IO buffer. */
    74         VBoxHGSMIBufferFree(pCtx, p);
    75     }
    76     else
    77         rc = VERR_NO_MEMORY;
    78     return rc;
     60
     61    /* Allocate the IO buffer. */
     62    p = (HGSMIBUFFERLOCATION *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_HGSMI,
     63                                                    HGSMI_CC_HOST_FLAGS_LOCATION);
     64    if (!p)
     65        return VERR_NO_MEMORY;
     66
     67    /* Prepare data to be sent to the host. */
     68    p->offLocation = offLocation;
     69    p->cbLocation  = sizeof(HGSMIHOSTFLAGS);
     70    /* No need to check that the buffer is valid as we have just allocated it. */
     71    VBoxHGSMIBufferSubmit(pCtx, p);
     72    /* Free the IO buffer. */
     73    VBoxHGSMIBufferFree(pCtx, p);
     74
     75    return VINF_SUCCESS;
    7976}
    8077
     
    8885 * @param    fCaps                 the capabilities to report, see VBVACAPS.
    8986 */
    90 DECLHIDDEN(int) VBoxHGSMISendCapsInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    91                                       uint32_t fCaps)
    92 {
    93     VBVACAPS *pCaps;
    94     int rc = VINF_SUCCESS;
    95 
    96     /* Allocate the IO buffer. */
    97     pCaps = (VBVACAPS *)VBoxHGSMIBufferAlloc(pCtx,
    98                                        sizeof(VBVACAPS), HGSMI_CH_VBVA,
    99                                        VBVA_INFO_CAPS);
    100 
    101     if (pCaps)
    102     {
    103         /* Prepare data to be sent to the host. */
    104         pCaps->rc    = VERR_NOT_IMPLEMENTED;
    105         pCaps->fCaps = fCaps;
    106         rc = VBoxHGSMIBufferSubmit(pCtx, pCaps);
    107         if (RT_SUCCESS(rc))
    108         {
    109             AssertRC(pCaps->rc);
    110             rc = pCaps->rc;
    111         }
    112         /* Free the IO buffer. */
    113         VBoxHGSMIBufferFree(pCtx, pCaps);
    114     }
    115     else
    116         rc = VERR_NO_MEMORY;
    117     return rc;
     87DECLHIDDEN(int) VBoxHGSMISendCapsInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx, uint32_t fCaps)
     88{
     89    VBVACAPS *p;
     90
     91    /* Allocate the IO buffer. */
     92    p = (VBVACAPS *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_VBVA, VBVA_INFO_CAPS);
     93
     94    if (!p)
     95        return VERR_NO_MEMORY;
     96
     97    /* Prepare data to be sent to the host. */
     98    p->rc    = VERR_NOT_IMPLEMENTED;
     99    p->fCaps = fCaps;
     100    /* No need to check that the buffer is valid as we have just allocated it. */
     101    VBoxHGSMIBufferSubmit(pCtx, p);
     102
     103    AssertRC(p->rc);
     104    /* Free the IO buffer. */
     105    VBoxHGSMIBufferFree(pCtx, p);
     106    return p->rc;
    118107}
    119108
     
    160149}
    161150
    162 
    163 /** Sanity test on first call.  We do not worry about concurrency issues. */
    164 static int testQueryConf(PHGSMIGUESTCOMMANDCONTEXT pCtx)
    165 {
    166     static bool cOnce = false;
    167     uint32_t ulValue = 0;
    168     int rc;
    169 
    170     if (cOnce)
    171         return VINF_SUCCESS;
    172     cOnce = true;
    173     rc = VBoxQueryConfHGSMI(pCtx, UINT32_MAX, &ulValue);
    174     if (RT_SUCCESS(rc) && ulValue == UINT32_MAX)
    175         return VINF_SUCCESS;
    176     cOnce = false;
    177     if (RT_FAILURE(rc))
    178         return rc;
    179     return VERR_INTERNAL_ERROR;
    180 }
    181 
    182 
    183151/**
    184152 * Query the host for an HGSMI configuration parameter via an HGSMI command.
     
    187155 * @param  u32Index  the index of the parameter to query,
    188156 *                   @see VBVACONF32::u32Index
    189  * @param  u32DefValue defaut value
    190157 * @param  pulValue  where to store the value of the parameter on success
    191158 */
    192 DECLHIDDEN(int) VBoxQueryConfHGSMIDef(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    193                                       uint32_t u32Index, uint32_t u32DefValue, uint32_t *pulValue)
    194 {
    195     int rc = VINF_SUCCESS;
     159DECLHIDDEN(int) VBoxQueryConfHGSMI(PHGSMIGUESTCOMMANDCONTEXT pCtx, uint32_t u32Index, uint32_t *pulValue)
     160{
    196161    VBVACONF32 *p;
    197     // LogFunc(("u32Index = %d\n", u32Index));
    198 
    199     rc = testQueryConf(pCtx);
    200     if (RT_FAILURE(rc))
    201         return rc;
    202     /* Allocate the IO buffer. */
    203     p = (VBVACONF32 *)VBoxHGSMIBufferAlloc(pCtx,
    204                                      sizeof(VBVACONF32), HGSMI_CH_VBVA,
    205                                      VBVA_QUERY_CONF32);
    206     if (p)
    207     {
    208         /* Prepare data to be sent to the host. */
    209         p->u32Index = u32Index;
    210         p->u32Value = u32DefValue;
    211         rc = VBoxHGSMIBufferSubmit(pCtx, p);
    212         if (RT_SUCCESS(rc))
    213         {
    214             *pulValue = p->u32Value;
    215             // LogFunc(("u32Value = %d\n", p->u32Value));
    216         }
    217         /* Free the IO buffer. */
    218         VBoxHGSMIBufferFree(pCtx, p);
    219     }
    220     else
    221         rc = VERR_NO_MEMORY;
    222     // LogFunc(("rc = %d\n", rc));
    223     return rc;
    224 }
    225 
    226 DECLHIDDEN(int) VBoxQueryConfHGSMI(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    227                                    uint32_t u32Index, uint32_t *pulValue)
    228 {
    229     return VBoxQueryConfHGSMIDef(pCtx, u32Index, UINT32_MAX, pulValue);
     162
     163    /* Allocate the IO buffer. */
     164    p = (VBVACONF32 *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_VBVA,
     165                                           VBVA_QUERY_CONF32);
     166    if (!p)
     167        return VERR_NO_MEMORY;
     168
     169    /* Prepare data to be sent to the host. */
     170    p->u32Index = u32Index;
     171    p->u32Value = UINT32_MAX;
     172    /* No need to check that the buffer is valid as we have just allocated it. */
     173    VBoxHGSMIBufferSubmit(pCtx, p);
     174    *pulValue = p->u32Value;
     175    /* Free the IO buffer. */
     176    VBoxHGSMIBufferFree(pCtx, p);
     177    return VINF_SUCCESS;
    230178}
    231179
     
    243191 * @param  cbLength  size in bytes of the pixel data
    244192 */
    245 DECLHIDDEN(int)  VBoxHGSMIUpdatePointerShape(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    246                                              uint32_t fFlags,
    247                                              uint32_t cHotX,
    248                                              uint32_t cHotY,
    249                                              uint32_t cWidth,
    250                                              uint32_t cHeight,
    251                                              uint8_t *pPixels,
    252                                              uint32_t cbLength)
     193DECLHIDDEN(int)  VBoxHGSMIUpdatePointerShape(PHGSMIGUESTCOMMANDCONTEXT pCtx, uint32_t fFlags,
     194                                             uint32_t cHotX, uint32_t cHotY, uint32_t cWidth, uint32_t cHeight,
     195                                             uint8_t *pPixels, uint32_t cbLength)
    253196{
    254197    VBVAMOUSEPOINTERSHAPE *p;
    255     uint32_t cbData = 0;
    256     int rc = VINF_SUCCESS;
     198    uint32_t cbPixels = 0;
     199    int rc;
    257200
    258201    if (fFlags & VBOX_MOUSE_POINTER_SHAPE)
    259202    {
    260         /* Size of the pointer data: sizeof (AND mask) + sizeof (XOR_MASK) */
    261         cbData = ((((cWidth + 7) / 8) * cHeight + 3) & ~3)
     203        /*
     204         * Size of the pointer data:
     205         * sizeof (AND mask) + sizeof (XOR_MASK)
     206         */
     207        cbPixels = ((((cWidth + 7) / 8) * cHeight + 3) & ~3)
    262208                 + cWidth * 4 * cHeight;
    263         /* If shape is supplied, then always create the pointer visible.
     209        if (cbPixels > cbLength)
     210            return VERR_INVALID_PARAMETER;
     211        /*
     212         * If shape is supplied, then always create the pointer visible.
    264213         * See comments in 'vboxUpdatePointerShape'
    265214         */
    266215        fFlags |= VBOX_MOUSE_POINTER_VISIBLE;
    267216    }
    268     // LogFlowFunc(("cbData %d, %dx%d\n", cbData, cWidth, cHeight));
    269     if (cbData > cbLength)
    270     {
    271         // LogFunc(("calculated pointer data size is too big (%d bytes, limit %d)\n",
    272         //          cbData, cbLength));
    273         return VERR_INVALID_PARAMETER;
    274     }
    275     /* Allocate the IO buffer. */
    276     p = (VBVAMOUSEPOINTERSHAPE *)VBoxHGSMIBufferAlloc(pCtx,
    277                                                   sizeof(VBVAMOUSEPOINTERSHAPE)
    278                                                 + cbData,
    279                                                 HGSMI_CH_VBVA,
    280                                                 VBVA_MOUSE_POINTER_SHAPE);
    281     if (p)
    282     {
    283         /* Prepare data to be sent to the host. */
    284         /* Will be updated by the host. */
    285         p->i32Result = VINF_SUCCESS;
    286         /* We have our custom flags in the field */
    287         p->fu32Flags = fFlags;
    288         p->u32HotX   = cHotX;
    289         p->u32HotY   = cHotY;
    290         p->u32Width  = cWidth;
    291         p->u32Height = cHeight;
    292         if (p->fu32Flags & VBOX_MOUSE_POINTER_SHAPE)
    293             /* Copy the actual pointer data. */
    294             memcpy (p->au8Data, pPixels, cbData);
    295         rc = VBoxHGSMIBufferSubmit(pCtx, p);
    296         if (RT_SUCCESS(rc))
    297             rc = p->i32Result;
    298         /* Free the IO buffer. */
    299         VBoxHGSMIBufferFree(pCtx, p);
    300     }
    301     else
    302         rc = VERR_NO_MEMORY;
    303     // LogFlowFunc(("rc %d\n", rc));
     217    /* Allocate the IO buffer. */
     218    p = (VBVAMOUSEPOINTERSHAPE *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p) + cbPixels, HGSMI_CH_VBVA,
     219                                                      VBVA_MOUSE_POINTER_SHAPE);
     220    if (!p)
     221        return VERR_NO_MEMORY;
     222    /* Prepare data to be sent to the host. */
     223    /* Will be updated by the host. */
     224    p->i32Result = VINF_SUCCESS;
     225    /* We have our custom flags in the field */
     226    p->fu32Flags = fFlags;
     227    p->u32HotX   = cHotX;
     228    p->u32HotY   = cHotY;
     229    p->u32Width  = cWidth;
     230    p->u32Height = cHeight;
     231    if (cbPixels)
     232        /* Copy the actual pointer data. */
     233        memcpy (p->au8Data, pPixels, cbPixels);
     234    /* No need to check that the buffer is valid as we have just allocated it. */
     235    VBoxHGSMIBufferSubmit(pCtx, p);
     236    rc = p->i32Result;
     237    /* Free the IO buffer. */
     238    VBoxHGSMIBufferFree(pCtx, p);
    304239    return rc;
    305240}
     
    319254 * @returns  VERR_NO_MEMORY      HGSMI heap allocation failed.
    320255 */
    321 DECLHIDDEN(int) VBoxHGSMICursorPosition(PHGSMIGUESTCOMMANDCONTEXT pCtx, bool fReportPosition, uint32_t x, uint32_t y,
    322                                         uint32_t *pxHost, uint32_t *pyHost)
    323 {
    324     int rc = VINF_SUCCESS;
     256DECLHIDDEN(int) VBoxHGSMICursorPosition(PHGSMIGUESTCOMMANDCONTEXT pCtx, bool fReportPosition,
     257                                        uint32_t x, uint32_t y, uint32_t *pxHost, uint32_t *pyHost)
     258{
    325259    VBVACURSORPOSITION *p;
    326     // Log(("%s: x=%u, y=%u\n", __PRETTY_FUNCTION__, (unsigned)x, (unsigned)y));
    327 
    328     /* Allocate the IO buffer. */
    329     p = (VBVACURSORPOSITION *)VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVACURSORPOSITION), HGSMI_CH_VBVA, VBVA_CURSOR_POSITION);
    330     if (p)
    331     {
    332         /* Prepare data to be sent to the host. */
    333         p->fReportPosition = fReportPosition ? 1 : 0;
    334         p->x = x;
    335         p->y = y;
    336         rc = VBoxHGSMIBufferSubmit(pCtx, p);
    337         if (RT_SUCCESS(rc))
    338         {
    339             if (pxHost)
    340                 *pxHost = p->x;
    341             if (pyHost)
    342                 *pyHost = p->y;
    343             // Log(("%s: return: x=%u, y=%u\n", __PRETTY_FUNCTION__, (unsigned)p->x, (unsigned)p->y));
    344         }
    345         /* Free the IO buffer. */
    346         VBoxHGSMIBufferFree(pCtx, p);
    347     }
    348     else
    349         rc = VERR_NO_MEMORY;
    350     // LogFunc(("rc = %d\n", rc));
    351     return rc;
    352 }
    353 
    354 
    355 /** @todo Mouse pointer position to be read from VMMDev memory, address of the memory region
    356  * can be queried from VMMDev via an IOCTL. This VMMDev memory region will contain
    357  * host information which is needed by the guest.
     260
     261    /* Allocate the IO buffer. */
     262    p = (VBVACURSORPOSITION *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_VBVA,
     263                                                   VBVA_CURSOR_POSITION);
     264    if (!p)
     265        return VERR_NO_MEMORY;
     266    /* Prepare data to be sent to the host. */
     267    p->fReportPosition = fReportPosition;
     268    p->x = x;
     269    p->y = y;
     270    /* No need to check that the buffer is valid as we have just allocated it. */
     271    VBoxHGSMIBufferSubmit(pCtx, p);
     272    if (pxHost)
     273        *pxHost = p->x;
     274    if (pyHost)
     275        *pyHost = p->y;
     276    /* Free the IO buffer. */
     277    VBoxHGSMIBufferFree(pCtx, p);
     278    return VINF_SUCCESS;
     279}
     280
     281
     282/**
     283 * @todo Mouse pointer position to be read from VMMDev memory, address of the
     284 * memory region can be queried from VMMDev via an IOCTL. This VMMDev memory
     285 * region will contain host information which is needed by the guest.
    358286 *
    359287 * Reading will not cause a switch to the host.
     
    366294 *    the page readonly for the guest.
    367295 *  * the information should be available only for additions drivers.
    368  *  * VMMDev additions driver will inform the host which version of the info it expects,
    369  *    host must support all versions.
    370  *
    371  */
     296 *  * VMMDev additions driver will inform the host which version of the info
     297 *    it expects, host must support all versions.
     298 */
  • trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp

    r67268 r68848  
    2929#include <VBoxVideoGuest.h>
    3030#include <VBoxVideoVBE.h>
     31#include <HGSMIChannels.h>
    3132
    3233#ifndef VBOX_GUESTR3XF86MOD
     
    384385{
    385386    uint32_t u32Flags = 0;
    386     int rc = VBoxQueryConfHGSMIDef(pCtx, VBOX_VBVA_CONF32_SCREEN_FLAGS, 0, &u32Flags);
     387    int rc = VBoxQueryConfHGSMI(pCtx, VBOX_VBVA_CONF32_SCREEN_FLAGS, &u32Flags);
    387388    // LogFunc(("u32Flags = 0x%x rc %Rrc\n", u32Flags, rc));
    388     if (RT_FAILURE(rc))
     389    if (RT_FAILURE(rc) || u32Flags > UINT16_MAX)
    389390        u32Flags = 0;
    390391    return (uint16_t)u32Flags;
  • trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp

    r66544 r68848  
    2929#include <VBoxVideoGuest.h>
    3030#include <VBoxVideoIPRT.h>
     31#include <HGSMIChannels.h>
    3132
    3233/*
  • trunk/src/VBox/Additions/linux/drm/files_vboxvideo_drv

    r68769 r68848  
    3131    ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp=>modesetting.c \
    3232    ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp=>vbva_base.c \
    33     ${PATH_ROOT}/src/VBox/Additions/linux/drm/HGSMIBase.h=>hgsmi_base.h \
    34     ${PATH_ROOT}/src/VBox/Additions/linux/drm/VBoxVideoIPRT.h=>vboxvideo_iprt.h \
    3533    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_drv.c=>vbox_drv.c \
    3634    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_drv.h=>vbox_drv.h \
     35    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_err.h=>vbox_err.h \
    3736    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_fb.c=>vbox_fb.c \
    3837    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_irq.c=>vbox_irq.c \
  • trunk/src/VBox/Additions/linux/drm/indent.sed

    r68769 r68848  
    2323
    2424# Replace up to six leading groups of four spaces with tabs.
    25 s/^                        /\t\t\t\t\t\t/g
     25s/^                         */\t\t\t\t\t\t/g
    2626s/^                    /\t\t\t\t\t/g
    2727s/^                /\t\t\t\t/g
     
    2929s/^        /\t\t/g
    3030s/^    /\t/g
    31 # Remove any spaces left after the tabs.  This also limits maximum indentation.
    32 s/^\(\t\t*\) */\1/g
    3331
    3432# Change various symbols and file names to fit kernel conventions.
    3533
     34# Miscellaneous:
     35# Remove @file headers.
     36\|/\*\* @file| {
     37:start
     38  N
     39  s|\*/|\*/|g
     40  T start
     41  N
     42  d
     43}
     44/^\/\* \$Id:.*\*\/$/d
     45/^typedef .* HGSMIOFFSET;$/d
     46s/^#\( *\)include <\([^/]*\)>$/#\1include "\2"/g
     47
    3648# File names:
    37 s/\bHGSMIBase\.h\b/hgsmi_base.h/g
     49s/\bHGSMIBase\.h\b/vbox_drv.h/g
    3850s/\bHGSMIChannels\.h\b/hgsmi_channels.h/g
    3951s/\bHGSMIChSetup\.h\b/hgsmi_ch_setup.h/g
     
    4254s/\bVBoxVideoGuest\.h\b/vboxvideo_guest.h/g
    4355s/\bVBoxVideo\.h\b/vboxvideo.h/g
    44 s/\bVBoxVideoIPRT\.h\b/vboxvideo_iprt.h/g
     56s/\bVBoxVideoIPRT\.h\b/vbox_err.h/g
    4557s/\bVBoxVideoVBE\.h\b/vboxvideo_vbe.h/g
    4658
     
    6981s/\bvboxVBVAInformHost\b/vbva_inform_host/g
    7082s/\bvboxVBVASetupBufferContext\b/vbva_setup_buffer_context/g
     83s/\bVBVO_PORT_READ_U8\b/inb/g
     84s/\bVBVO_PORT_READ_U16\b/inw/g
     85s/\bVBVO_PORT_READ_U32\b/inl/g
     86s/\bVBVO_PORT_WRITE_U8\b/outb/g
     87s/\bVBVO_PORT_WRITE_U16\b/outw/g
     88s/\bVBVO_PORT_WRITE_U32\b/outl/g
    7189
    7290# Macros:
     91s/\b_1K\b/1024/g
     92s/\b_4M\b/4*1024*1024/g
     93s/\bAssert\b\([^;]*\);$/WARN_ON_ONCE(!(\1));/g
     94s/\bAssertCompile\b/assert_compile/g
     95s/\bAssertCompileSize\b/assert_compile_size/g
     96s/\bAssertPtr\b\([^;]*\);$/WARN_ON_ONCE(!(\1));/g
     97/AssertPtrNullReturnVoid/d
     98s/\bAssertRC\b\([^;]*\);$/WARN_ON_ONCE(RT_FAILURE\1);/g
     99s/\bDECLCALLBACK\b(\([^)]*\))/\1/g
     100s/\bDECLCALLBACKMEMBER\b(\([^,)]*\), *\([^,)]*\))/\1 (*\2)/g
     101s/^\bDECLHIDDEN\b(\([^)]*\))/\1/g
     102s/\bDECLINLINE\b(\([^)]*\))/static inline \1/g
     103s/\bRT_BIT\b/BIT/g
     104s/\bRT_BOOL\b(\([^)]*\))/(!!(\1))/g
     105/RT_C_DECLS/d
     106s/\bUINT16_MAX\b/U16_MAX/g
     107s/\bUINT32_MAX\b/U32_MAX/g
     108s/\bUINT32_C\b(\(.*\))/\1u/g
    73109s/!VALID_PTR(/WARN_ON(!/g
    74110
    75111# Type names:
    76112s/\bint32_t\b/s32/g
     113s/\buint8_t\b/u8/g
    77114s/\buint16_t\b/u16/g
    78115s/\buint32_t\b/u32/g
     116s/(HGSMIBUFFERLOCATION \*)//g  # Remove C++ casts from void.
     117s/typedef struct HGSMIBUFFERLOCATION/struct hgsmi_buffer_location/g
    79118s/struct HGSMIBUFFERLOCATION/struct hgsmi_buffer_location/g
    80 s/} HGSMIBUFFERLOCATION/} hgsmi_buffer_location/g
     119s/} HGSMIBUFFERLOCATION/}/g
    81120s/\bHGSMIBUFFERLOCATION\b/struct hgsmi_buffer_location/g
     121s/\([^*] *\)\bPHGSMIGUESTCOMMANDCONTEXT\b/\1struct gen_pool */g
     122s/(HGSMIHOSTFLAGS \*)//g  # Remove C++ casts from void.
     123s/typedef struct HGSMIHOSTFLAGS/struct hgsmi_host_flags/g
     124s/struct HGSMIHOSTFLAGS/struct hgsmi_host_flags/g
     125s/} HGSMIHOSTFLAGS/}/g
     126s/\bHGSMIHOSTFLAGS\b/struct hgsmi_host_flags/g
     127s/\bHGSMIOFFSET\b/u32/g
     128s/\bHGSMISIZE\b/u32/g
     129s/\bRTRECT\b/void/g
     130s/(VBVABUFFERCONTEXT \*)//g  # Remove C++ casts from void.
    82131s/struct VBVABUFFERCONTEXT/struct vbva_buf_context/g
    83132s/} VBVABUFFERCONTEXT/} vbva_buf_context/g
    84133s/\bVBVABUFFERCONTEXT\b/struct vbva_buf_context/g
    85134s/\([^*] *\)\bPVBVABUFFERCONTEXT\b/\1struct vbva_buf_context */g
     135s/(VBVACAPS \*)//g  # Remove C++ casts from void.
     136s/struct VBVACAPS/struct vbva_caps/g
     137s/} VBVACAPS/} vbva_caps/g
     138s/\bVBVACAPS\b/struct vbva_caps/g
     139s/(VBVACONF32 \*)//g  # Remove C++ casts from void.
    86140s/struct VBVACONF32/struct vbva_conf32/g
    87141s/} VBVACONF32/} vbva_conf32/g
    88142s/\bVBVACONF32\b/struct vbva_conf32/g
     143s/(VBVACURSORPOSITION \*)//g  # Remove C++ casts from void.
    89144s/struct VBVACURSORPOSITION/struct vbva_cursor_position/g
    90145s/} VBVACURSORPOSITION/} vbva_cursor_position/g
    91146s/\bVBVACURSORPOSITION\b/struct vbva_cursor_position/g
     147s/(VBVAENABLE_EX \*)//g  # Remove C++ casts from void.
    92148s/struct VBVAENABLE_EX/struct vbva_enable_ex/g
    93149s/} VBVAENABLE_EX/} vbva_enable_ex/g
    94150s/\bVBVAENABLE_EX\b/struct vbva_enable_ex/g
     151s/(VBVAMOUSEPOINTERSHAPE \*)//g  # Remove C++ casts from void.
    95152s/struct VBVAMOUSEPOINTERSHAPE/struct vbva_mouse_pointer_shape/g
    96153s/} VBVAMOUSEPOINTERSHAPE/} vbva_mouse_pointer_shape/g
    97154s/\bVBVAMOUSEPOINTERSHAPE\b/struct vbva_mouse_pointer_shape/g
     155s/(VBVAMODEHINT \*)//g  # Remove C++ casts from void.
    98156s/struct VBVAMODEHINT/struct vbva_modehint/g
    99157s/} VBVAMODEHINT/} vbva_modehint/g
    100158s/\bVBVAMODEHINT\b/struct vbva_modehint/g
     159s/(VBVAQUERYMODEHINTS \*)//g  # Remove C++ casts from void.
    101160s/struct VBVAQUERYMODEHINTS/struct vbva_query_mode_hints/g
    102161s/} VBVAQUERYMODEHINTS/} vbva_query_mode_hints/g
    103162s/\bVBVAQUERYMODEHINTS\b/struct vbva_query_mode_hints/g
     163s/(VBVAREPORTINPUTMAPPING \*)//g  # Remove C++ casts from void.
    104164s/struct VBVAREPORTINPUTMAPPING/struct vbva_report_input_mapping/g
    105165s/} VBVAREPORTINPUTMAPPING/} vbva_report_input_mapping/g
     
    109169s/\baRecords\b/records/g
    110170s/\bau8Data\b/data/g
     171s/\bau32Reserved\b/reserved/g
    111172s/\bBase\b/base/g
    112173s/\bbEnable\b/enable/g
     
    119180s/\bcbHwBufferAvail\b/available/g
    120181s/\bcbLength\b/len/g
     182s/\bcbLocation\b/buf_len/g
    121183s/\bcbPartialWriteThreshold\b/partial_write_tresh/g  ## @todo fix this?
    122184s/\bcbPitch\b/pitch/g
     185s/\bcbPixels\b/pixel_len/g
    123186s/\bcBPP\b/bpp/g
    124187s/\bcbRecord\b/len_and_flags/g  ## @todo fix this?
     
    165228s/\bu32Height\b/height/g
    166229s/\bu32HostEvents\b/host_events/g
     230s/\bu32HostFlags\b/host_flags/g
    167231s/\bu32HotX\b/hot_x/g
    168232s/\bu32HotY\b/hot_y/g
     
    179243s/\bulValue\b/value/g
    180244
     245# Header file guard:
     246s/__HGSMIChannels_h__/__HGSMI_CHANNELS_H__/g
     247s/___VBox_Graphics_HGSMIChSetup_h/__HGSMI_CH_SETUP_H__/g
     248
    181249# And move braces.  This must be the last expression as it jumps to the next
    182250# line.
     
    190258:try_brace
    191259  s/^\([\t ].*\)\n[\t ][\t ]*{/\1 {/g
     260  s/^\([^#()]*\)\n[\t ]*{/\1 {/g
    192261  t done_brace
    193262  P
  • trunk/src/VBox/Additions/linux/drm/vbox_drv.h

    r68337 r68848  
    3838#define LOG_GROUP LOG_GROUP_DEV_VGA
    3939
    40 #include <VBoxVideoGuest.h>
    41 
    42 #include <drm/drmP.h>
    43 #include <drm/drm_fb_helper.h>
    44 
    45 #include <drm/ttm/ttm_bo_api.h>
    46 #include <drm/ttm/ttm_bo_driver.h>
    47 #include <drm/ttm/ttm_placement.h>
    48 #include <drm/ttm/ttm_memory.h>
    49 #include <drm/ttm/ttm_module.h>
     40#include <linux/version.h>
     41
     42#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
     43# include <linux/types.h>
     44# include <linux/spinlock_types.h>
     45#endif
     46
     47#include <linux/genalloc.h>
     48#include <linux/io.h>
     49#include <linux/string.h>
    5050
    5151#if defined(RHEL_MAJOR) && defined(RHEL_MINOR)
     
    5858#endif
    5959
     60#include <drm/drmP.h>
    6061#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_73)
    6162#include <drm/drm_gem.h>
    6263#endif
     64#include <drm/drm_fb_helper.h>
    6365#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
    6466#include <drm/drm_encoder.h>
    6567#endif
     68
     69#include <drm/ttm/ttm_bo_api.h>
     70#include <drm/ttm/ttm_bo_driver.h>
     71#include <drm/ttm/ttm_placement.h>
     72#include <drm/ttm/ttm_memory.h>
     73#include <drm/ttm/ttm_module.h>
     74
     75#include "vboxvideo_guest.h"
     76#include "vboxvideo_vbe.h"
     77#include "hgsmi_ch_setup.h"
    6678
    6779#include "product-generated.h"
     
    341353irqreturn_t vbox_irq_handler(int irq, void *arg);
    342354
    343 #endif
     355/* vbox_hgsmi.c */
     356void *hgsmi_buffer_alloc(struct gen_pool *guest_pool, size_t size,
     357                         u8 channel, u16 channel_info);
     358void hgsmi_buffer_free(struct gen_pool *guest_pool, void *buf);
     359int hgsmi_buffer_submit(struct gen_pool *guest_pool, void *buf);
     360
     361static inline void vbox_write_ioport(u16 index, u16 data)
     362{
     363        outw(index, VBE_DISPI_IOPORT_INDEX);
     364        outw(data, VBE_DISPI_IOPORT_DATA);
     365}
     366
     367#endif
  • trunk/src/VBox/Additions/linux/drm/vbox_err.h

    r68847 r68848  
    2626 */
    2727
    28 #ifndef ___VBox_Graphic_VBoxVideoIPRT_h
    29 #define ___VBox_Graphic_VBoxVideoIPRT_h
    30 
    31 #include <asm/io.h>
    32 #include <linux/string.h>
    33 #include <linux/version.h>
     28#ifndef __VBOX_ERR_H__
     29#define __VBOX_ERR_H__
    3430
    3531/** @name VirtualBox error macros
     
    5551/** @}  */
    5652
    57 /** @name VirtualBox helper functions
     53/** @name VirtualBox assertions
    5854 * @{ */
    5955
    60 #define ASMCompilerBarrier() mb()
     56/* Unlike BUILD_BUG_ON(), these can be used outside of functions. */
     57extern int vbox_assert_var[1];
     58#define assert_compile(expr) \
     59    extern int vbox_assert_var[1] __attribute__((__unused__)), \
     60    vbox_assert_var[(expr) ? 1 : 0] __attribute__((__unused__))
     61#define assert_compile_size(type, size) \
     62    assert_compile(sizeof(type) == (size))
    6163
    6264/** @}  */
    6365
    64 /** @name VirtualBox assertions
    65  * @{ */
    66 
    67 #define Assert(a) WARN_ON_ONCE(!(a))
    68 #define AssertPtr(a) WARN_ON_ONCE(!(a))
    69 #define AssertReturnVoid(a) do { if (WARN_ON_ONCE(!(a))) return; } while(0)
    70 #define AssertRC(a) WARN_ON_ONCE(RT_FAILURE(a))
    71 #define AssertPtrNullReturnVoid(a) do {} while(0)
    72 #define AssertPtrReturnVoid(a) do { if (WARN_ON_ONCE(!(a))) return; } while(0)
    73 
    74 extern int RTASSERTVAR[1];
    75 #define AssertCompile(expr) \
    76     extern int RTASSERTVAR[1] __attribute__((__unused__)), \
    77     RTASSERTVAR[(expr) ? 1 : 0] __attribute__((__unused__))
    78 #define AssertCompileSize(type, size) \
    79     AssertCompile(sizeof(type) == (size))
    80 
    81 #define VALID_PTR(p) ((p) != NULL)
    82 
    83 /** @}  */
    84 
    85 /** @name Port I/O helpers
    86  * @{ */
    87 /** Write an 8-bit value to an I/O port. */
    88 #define VBVO_PORT_WRITE_U8(Port, Value) \
    89     outb(Value, Port)
    90 /** Write a 16-bit value to an I/O port. */
    91 #define VBVO_PORT_WRITE_U16(Port, Value) \
    92     outw(Value, Port)
    93 /** Write a 32-bit value to an I/O port. */
    94 #define VBVO_PORT_WRITE_U32(Port, Value) \
    95     outl(Value, Port)
    96 /** Read an 8-bit value from an I/O port. */
    97 #define VBVO_PORT_READ_U8(Port) \
    98     inb(Port)
    99 /** Read a 16-bit value from an I/O port. */
    100 #define VBVO_PORT_READ_U16(Port) \
    101     inw(Port)
    102 /** Read a 32-bit value from an I/O port. */
    103 #define VBVO_PORT_READ_U32(Port) \
    104     inl(Port)
    105 
    106 /** @}  */
    107 
    108 /** @name types for VirtualBox OS-independent code
    109  * @{ */
    110 
    111 typedef void RTRECT;
    112 
    113 #define UINT32_C(val)           (val ## U)
    114 #define UINT32_MAX              UINT32_C(0xffffffff)
    115 
    116 /** @}  */
    117 
    118 /** @name iprt/desc.h replacement macros
    119  * @{ */
    120 
    121 #define RT_C_DECLS_BEGIN
    122 #define RT_C_DECLS_END
    123 #define DECLCALLBACK(type) type
    124 #define DECLCALLBACKMEMBER(type, name) type (*name)
    125 #define DECLHIDDEN(type) __attribute__((visibility("hidden"))) type
    126 #define DECLINLINE(type) static __inline__ type
    127 #define RT_BOOL(val) (!!(val))
    128 #define RT_BIT BIT
    129 #define _1K 0x00000400
    130 
    131 /** @}  */
    132 
    133 #endif /* !___VBox_Graphic_VBoxVideoIPRT_h */
    134 
     66#endif
  • trunk/src/VBox/Additions/linux/drm/vbox_mode.c

    r68334 r68848  
    3838 */
    3939#include "vbox_drv.h"
    40 
    41 #include <VBoxVideo.h>
    42 
    4340#include <linux/export.h>
    4441#include <drm/drm_crtc_helper.h>
     
    4643#include <drm/drm_plane_helper.h>
    4744#endif
     45
     46#include "VBoxVideo.h"
     47#include "hgsmi_channels.h"
    4848
    4949static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette