VirtualBox

Ignore:
Timestamp:
Sep 20, 2012 12:12:09 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
80828
Message:

Haiku Additions: cleanup.

Location:
trunk/src/VBox/Additions/haiku/VBoxVideo/accelerant
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/haiku/VBoxVideo/accelerant/accelerant.cpp

    r43363 r43364  
    5353#define TRACE(x...) do { FILE* logfile = fopen("/var/log/vboxvideo.accelerant.log", "a"); fprintf(logfile, x); fflush(logfile); fsync(fileno(logfile)); fclose(logfile); sync(); } while(0)
    5454
    55 class AreaCloner {
    56         public:
    57                 AreaCloner() : fArea(-1) {}
    58                 ~AreaCloner() {
    59                         if (fArea >= B_OK)
    60                                 delete_area(fArea);
    61                 }
    62 
    63                 area_id Clone(const char *name, void **_address, uint32 spec, uint32 protection, area_id sourceArea) {
    64                         fArea = clone_area(name, _address, spec, protection, sourceArea);
    65                         return fArea;
    66                 }
    67 
    68                 status_t InitCheck() { return fArea < B_OK ? (status_t)fArea : B_OK; }
    69                 void Keep() { fArea = -1; }
    70 
    71         private:
    72                 area_id fArea;
     55class AreaCloner
     56{
     57    public:
     58        AreaCloner() : fArea(-1) { }
     59        ~AreaCloner()
     60        {
     61            if (fArea >= B_OK)
     62                delete_area(fArea);
     63        }
     64
     65        area_id Clone(const char *name, void **_address, uint32 spec, uint32 protection, area_id sourceArea)
     66        {
     67            fArea = clone_area(name, _address, spec, protection, sourceArea);
     68            return fArea;
     69        }
     70
     71        status_t InitCheck() { return fArea < B_OK ? (status_t)fArea : B_OK; }
     72        void Keep() { fArea = -1; }
     73
     74    private:
     75        area_id    fArea;
    7376};
    7477
    7578AccelerantInfo gInfo;
    7679
    77 static engine_token sEngineToken = {1, 0 /*B_2D_ACCELERATION*/, NULL};
    78 
    79 extern "C" void* get_accelerant_hook(uint32 feature, void* data) {
    80         TRACE("%s\n", __FUNCTION__);
    81         switch (feature) {
    82                 /* general */
    83                 case B_INIT_ACCELERANT:
    84                         return (void*)vboxvideo_init_accelerant;
    85                 case B_UNINIT_ACCELERANT:
    86                         return (void*)vboxvideo_uninit_accelerant;
    87                 case B_CLONE_ACCELERANT:
    88                         return (void*)vboxvideo_clone_accelerant;
    89                 case B_ACCELERANT_CLONE_INFO_SIZE:
    90                         return (void*)vboxvideo_accelerant_clone_info_size;
    91                 case B_GET_ACCELERANT_CLONE_INFO:
    92                         return (void*)vboxvideo_get_accelerant_clone_info;
    93                 case B_GET_ACCELERANT_DEVICE_INFO:
    94                         return (void*)vboxvideo_get_accelerant_device_info;
    95                 case B_ACCELERANT_RETRACE_SEMAPHORE:
    96                         return (void*)vboxvideo_accelerant_retrace_semaphore;
    97 
    98                 /* mode configuration */
    99                 case B_ACCELERANT_MODE_COUNT:
    100                         return (void*)vboxvideo_accelerant_mode_count;
    101                 case B_GET_MODE_LIST:
    102                         return (void*)vboxvideo_get_mode_list;
    103                 case B_SET_DISPLAY_MODE:
    104                         return (void*)vboxvideo_set_display_mode;
    105                 case B_GET_DISPLAY_MODE:
    106                         return (void*)vboxvideo_get_display_mode;
    107                 case B_GET_EDID_INFO:
    108                         return (void*)vboxvideo_get_edid_info;
    109                 case B_GET_FRAME_BUFFER_CONFIG:
    110                         return (void*)vboxvideo_get_frame_buffer_config;
    111                 case B_GET_PIXEL_CLOCK_LIMITS:
    112                         return (void*)vboxvideo_get_pixel_clock_limits;
    113 
    114                 /* cursor managment */
    115                 /*case B_SET_CURSOR_SHAPE:
    116                         return (void*)vboxvideo_set_cursor_shape;
    117                 case B_MOVE_CURSOR:
    118                         return (void*)vboxvideo_move_cursor;
    119                 case B_SHOW_CURSOR:
    120                         return (void*)vboxvideo_show_cursor;*/
    121 
    122                 /* engine/synchronization */
    123                 case B_ACCELERANT_ENGINE_COUNT:
    124                         return (void*)vboxvideo_accelerant_engine_count;
    125                 case B_ACQUIRE_ENGINE:
    126                         return (void*)vboxvideo_acquire_engine;
    127                 case B_RELEASE_ENGINE:
    128                         return (void*)vboxvideo_release_engine;
    129                 case B_WAIT_ENGINE_IDLE:
    130                         return (void*)vboxvideo_wait_engine_idle;
    131                 case B_GET_SYNC_TOKEN:
    132                         return (void*)vboxvideo_get_sync_token;
    133                 case B_SYNC_TO_TOKEN:
    134                         return (void*)vboxvideo_sync_to_token;
    135         }
    136 
    137         return NULL;
    138 }
    139 
    140 status_t vboxvideo_init_common(int fd, bool cloned) {
    141         unlink("/var/log/vboxvideo.accelerant.log"); // clear old log - next TRACE() will recreate it
    142         TRACE("%s\n", __FUNCTION__);
    143 
    144         gInfo.deviceFD = fd;
    145         gInfo.isClone = cloned;
    146         gInfo.sharedInfo = NULL;
    147         gInfo.sharedInfoArea = -1;
    148 
    149         area_id sharedArea;
    150         if (ioctl(gInfo.deviceFD, VBOXVIDEO_GET_PRIVATE_DATA, &sharedArea, sizeof(area_id)) != 0) {
    151                 TRACE("ioctl failed\n");
    152                 return B_ERROR;
    153         }
    154 
    155         AreaCloner sharedCloner;
    156         gInfo.sharedInfoArea = sharedCloner.Clone("vboxvideo shared info",
    157                 (void **)&gInfo.sharedInfo, B_ANY_ADDRESS,
    158                 B_READ_AREA | B_WRITE_AREA, sharedArea);
    159         status_t status = sharedCloner.InitCheck();
    160         if (status < B_OK) {
    161                 TRACE("InitCheck failed (%s)\n", strerror(status));
    162                 return status;
    163         }
    164         sharedCloner.Keep();
    165 
    166         return B_OK;
    167 }
    168 
    169 status_t vboxvideo_init_accelerant(int fd) {
    170         return vboxvideo_init_common(fd, false);
    171 }
    172 
    173 ssize_t vboxvideo_accelerant_clone_info_size(void) {
    174         TRACE("%s\n", __FUNCTION__);
    175         return B_PATH_NAME_LENGTH;
    176 }
    177 
    178 void vboxvideo_get_accelerant_clone_info(void *data) {
    179         TRACE("%s\n", __FUNCTION__);
    180         ioctl(gInfo.deviceFD, VBOXVIDEO_GET_DEVICE_NAME, data, B_PATH_NAME_LENGTH);
    181 }
    182 
    183 status_t vboxvideo_clone_accelerant(void *data) {
    184         TRACE("%s\n", __FUNCTION__);
    185 
    186         // create full device name
    187         char path[MAXPATHLEN];
    188         strcpy(path, "/dev/");
    189         strcat(path, (const char *)data);
    190 
    191         int fd = open(path, B_READ_WRITE);
    192         if (fd < 0)
    193                 return errno;
    194 
    195         return vboxvideo_init_common(fd, true);
    196 }
    197 
    198 void vboxvideo_uninit_accelerant(void) {
    199         delete_area(gInfo.sharedInfoArea);
    200         gInfo.sharedInfo = NULL;
    201         gInfo.sharedInfoArea = -1;
    202 
    203         if (gInfo.isClone)
    204                 close(gInfo.deviceFD);
    205 
    206         TRACE("%s\n", __FUNCTION__);
    207 }
    208 
    209 status_t vboxvideo_get_accelerant_device_info(accelerant_device_info *adi) {
    210         TRACE("%s\n", __FUNCTION__);
    211         adi->version = B_ACCELERANT_VERSION;
    212         strcpy(adi->name, "Virtual display");
    213         strcpy(adi->chipset, "VirtualBox Graphics Adapter");
    214         strcpy(adi->serial_no, "9001");
    215         return B_OK;
    216 }
    217 
    218 sem_id vboxvideo_accelerant_retrace_semaphore(void) {
    219         TRACE("%s\n", __FUNCTION__);
    220         return -1;
     80static engine_token sEngineToken = { 1, 0 /*B_2D_ACCELERATION*/, NULL };
     81
     82extern "C"
     83void* get_accelerant_hook(uint32 feature, void *data)
     84{
     85    TRACE("%s\n", __FUNCTION__);
     86    switch (feature)
     87    {
     88        /* general */
     89        case B_INIT_ACCELERANT:
     90            return (void *)vboxvideo_init_accelerant;
     91        case B_UNINIT_ACCELERANT:
     92            return (void *)vboxvideo_uninit_accelerant;
     93        case B_CLONE_ACCELERANT:
     94            return (void *)vboxvideo_clone_accelerant;
     95        case B_ACCELERANT_CLONE_INFO_SIZE:
     96            return (void *)vboxvideo_accelerant_clone_info_size;
     97        case B_GET_ACCELERANT_CLONE_INFO:
     98            return (void *)vboxvideo_get_accelerant_clone_info;
     99        case B_GET_ACCELERANT_DEVICE_INFO:
     100            return (void *)vboxvideo_get_accelerant_device_info;
     101        case B_ACCELERANT_RETRACE_SEMAPHORE:
     102            return (void *)vboxvideo_accelerant_retrace_semaphore;
     103
     104            /* mode configuration */
     105        case B_ACCELERANT_MODE_COUNT:
     106            return (void *)vboxvideo_accelerant_mode_count;
     107        case B_GET_MODE_LIST:
     108            return (void *)vboxvideo_get_mode_list;
     109        case B_SET_DISPLAY_MODE:
     110            return (void *)vboxvideo_set_display_mode;
     111        case B_GET_DISPLAY_MODE:
     112            return (void *)vboxvideo_get_display_mode;
     113        case B_GET_EDID_INFO:
     114            return (void *)vboxvideo_get_edid_info;
     115        case B_GET_FRAME_BUFFER_CONFIG:
     116            return (void *)vboxvideo_get_frame_buffer_config;
     117        case B_GET_PIXEL_CLOCK_LIMITS:
     118            return (void *)vboxvideo_get_pixel_clock_limits;
     119
     120            /* cursor managment */
     121            /*case B_SET_CURSOR_SHAPE:
     122                return (void*)vboxvideo_set_cursor_shape;
     123            case B_MOVE_CURSOR:
     124                return (void*)vboxvideo_move_cursor;
     125            case B_SHOW_CURSOR:
     126                return (void*)vboxvideo_show_cursor;*/
     127
     128            /* engine/synchronization */
     129        case B_ACCELERANT_ENGINE_COUNT:
     130            return (void *)vboxvideo_accelerant_engine_count;
     131        case B_ACQUIRE_ENGINE:
     132            return (void *)vboxvideo_acquire_engine;
     133        case B_RELEASE_ENGINE:
     134            return (void *)vboxvideo_release_engine;
     135        case B_WAIT_ENGINE_IDLE:
     136            return (void *)vboxvideo_wait_engine_idle;
     137        case B_GET_SYNC_TOKEN:
     138            return (void *)vboxvideo_get_sync_token;
     139        case B_SYNC_TO_TOKEN:
     140            return (void *)vboxvideo_sync_to_token;
     141    }
     142
     143    return NULL;
     144}
     145
     146status_t vboxvideo_init_common(int fd, bool cloned)
     147{
     148    unlink("/var/log/vboxvideo.accelerant.log"); // clear old log - next TRACE() will recreate it
     149    TRACE("%s\n", __FUNCTION__);
     150
     151    gInfo.deviceFD = fd;
     152    gInfo.isClone = cloned;
     153    gInfo.sharedInfo = NULL;
     154    gInfo.sharedInfoArea = -1;
     155
     156    area_id sharedArea;
     157    if (ioctl(gInfo.deviceFD, VBOXVIDEO_GET_PRIVATE_DATA, &sharedArea, sizeof(area_id)) != 0)
     158    {
     159        TRACE("ioctl failed\n");
     160        return B_ERROR;
     161    }
     162
     163    AreaCloner sharedCloner;
     164    gInfo.sharedInfoArea = sharedCloner.Clone("vboxvideo shared info",
     165                                              (void **)&gInfo.sharedInfo, B_ANY_ADDRESS,
     166                                              B_READ_AREA | B_WRITE_AREA, sharedArea);
     167    status_t status = sharedCloner.InitCheck();
     168    if (status < B_OK)
     169    {
     170        TRACE("InitCheck failed (%s)\n", strerror(status));
     171        return status;
     172    }
     173    sharedCloner.Keep();
     174
     175    return B_OK;
     176}
     177
     178status_t vboxvideo_init_accelerant(int fd)
     179{
     180    return vboxvideo_init_common(fd, false);
     181}
     182
     183ssize_t vboxvideo_accelerant_clone_info_size(void)
     184{
     185    TRACE("%s\n", __FUNCTION__);
     186    return B_PATH_NAME_LENGTH;
     187}
     188
     189void vboxvideo_get_accelerant_clone_info(void *data)
     190{
     191    TRACE("%s\n", __FUNCTION__);
     192    ioctl(gInfo.deviceFD, VBOXVIDEO_GET_DEVICE_NAME, data, B_PATH_NAME_LENGTH);
     193}
     194
     195status_t vboxvideo_clone_accelerant(void *data)
     196{
     197    TRACE("%s\n", __FUNCTION__);
     198
     199    // create full device name
     200    char path[MAXPATHLEN];
     201    strcpy(path, "/dev/");
     202    strcat(path, (const char *)data);
     203
     204    int fd = open(path, B_READ_WRITE);
     205    if (fd < 0)
     206        return errno;
     207
     208    return vboxvideo_init_common(fd, true);
     209}
     210
     211void vboxvideo_uninit_accelerant(void)
     212{
     213    delete_area(gInfo.sharedInfoArea);
     214    gInfo.sharedInfo = NULL;
     215    gInfo.sharedInfoArea = -1;
     216
     217    if (gInfo.isClone)
     218        close(gInfo.deviceFD);
     219
     220    TRACE("%s\n", __FUNCTION__);
     221}
     222
     223status_t vboxvideo_get_accelerant_device_info(accelerant_device_info *adi)
     224{
     225    TRACE("%s\n", __FUNCTION__);
     226    adi->version = B_ACCELERANT_VERSION;
     227    strcpy(adi->name, "Virtual display");
     228    strcpy(adi->chipset, "VirtualBox Graphics Adapter");
     229    strcpy(adi->serial_no, "9001");
     230    return B_OK;
     231}
     232
     233sem_id vboxvideo_accelerant_retrace_semaphore(void)
     234{
     235    TRACE("%s\n", __FUNCTION__);
     236    return -1;
    221237}
    222238
    223239// modes & constraints
    224 uint32 vboxvideo_accelerant_mode_count(void) {
    225         TRACE("%s\n", __FUNCTION__);
    226         return 1;
    227 }
    228 
    229 status_t vboxvideo_get_mode_list(display_mode *dm) {
    230         // TODO return some standard modes here
    231         TRACE("%s\n", __FUNCTION__);
    232         return vboxvideo_get_display_mode(dm);
    233 }
    234 
    235 status_t vboxvideo_set_display_mode(display_mode *modeToSet) {
    236         TRACE("%s\n", __FUNCTION__);
    237         TRACE("trying to set mode %dx%d\n", modeToSet->timing.h_display, modeToSet->timing.v_display);
    238         return ioctl(gInfo.deviceFD, VBOXVIDEO_SET_DISPLAY_MODE, modeToSet, sizeof(display_mode));
    239 }
    240 
    241 status_t vboxvideo_get_display_mode(display_mode *currentMode) {
    242         TRACE("%s\n", __FUNCTION__);
    243         *currentMode = gInfo.sharedInfo->currentMode;
    244         TRACE("current mode is %dx%d\n", currentMode->timing.h_display, currentMode->timing.v_display);
    245         return B_OK;
    246 }
    247 
    248 status_t vboxvideo_get_edid_info(void *info, size_t size, uint32 *_version) {
    249         TRACE("%s\n", __FUNCTION__);
    250 
    251         // copied from the X11 implementation:
    252         static const uint8 edid_data[128] = {
    253                 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, /* header */
    254                 0x58, 0x58, /* manufacturer (VBX) */
    255                 0x00, 0x00, /* product code */
    256                 0x00, 0x00, 0x00, 0x00, /* serial number goes here */
    257                 0x01, /* week of manufacture */
    258                 0x00, /* year of manufacture */
    259                 0x01, 0x03, /* EDID version */
    260                 0x80, /* capabilities - digital */
    261                 0x00, /* horiz. res in cm, zero for projectors */
    262                 0x00, /* vert. res in cm */
    263                 0x78, /* display gamma (120 == 2.2).  Should we ask the host for this? */
    264                 0xEE, /* features (standby, suspend, off, RGB, standard colour space,
    265                                 * preferred timing mode) */
    266                 0xEE, 0x91, 0xA3, 0x54, 0x4C, 0x99, 0x26, 0x0F, 0x50, 0x54,
    267                         /* chromaticity for standard colour space - should we ask the host? */
    268                 0x00, 0x00, 0x00, /* no default timings */
    269                 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
    270                 0x01, 0x01, 0x01, 0x01, /* no standard timings */
    271                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    272                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* descriptor block 1 goes here */
    273                 0x00, 0x00, 0x00, 0xFD, 0x00, /* descriptor block 2, monitor ranges */
    274                 0x00, 0xC8, 0x00, 0xC8, 0x64, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20,
    275                 0x20, /* 0-200Hz vertical, 0-200KHz horizontal, 1000MHz pixel clock */
    276                 0x00, 0x00, 0x00, 0xFC, 0x00, /* descriptor block 3, monitor name */
    277                 'V', 'B', 'O', 'X', ' ', 'm', 'o', 'n', 'i', 't', 'o', 'r', '\n',
    278                 0x00, 0x00, 0x00, 0x10, 0x00, /* descriptor block 4: dummy data */
    279                 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
    280                 0x20,
    281                 0x00, /* number of extensions */
    282                 0x00 /* checksum goes here */
    283         };
    284 
    285         if (size < 128)
    286                 return B_BUFFER_OVERFLOW;
    287 
    288         *_version = 1; /*EDID_VERSION_1*/
    289         memcpy(info, edid_data, 128);
    290         return B_OK;
    291 }
    292 
    293 status_t vboxvideo_get_frame_buffer_config(frame_buffer_config *config) {
    294         TRACE("%s\n", __FUNCTION__);
    295         config->frame_buffer = gInfo.sharedInfo->framebuffer;
    296         config->frame_buffer_dma = NULL;
    297         config->bytes_per_row = get_depth_for_color_space(gInfo.sharedInfo->currentMode.space)
    298                 * gInfo.sharedInfo->currentMode.timing.h_display / 8;
    299         return B_OK;
    300 }
    301 
    302 status_t vboxvideo_get_pixel_clock_limits(display_mode *dm, uint32 *low, uint32 *high) {
    303         TRACE("%s\n", __FUNCTION__);
    304         // irrelevant for virtual monitors
    305         *low = 0;
    306         *high = 9001;
    307         return B_OK;
     240uint32 vboxvideo_accelerant_mode_count(void)
     241{
     242    TRACE("%s\n", __FUNCTION__);
     243    return 1;
     244}
     245
     246status_t vboxvideo_get_mode_list(display_mode *dm)
     247{
     248    // TODO return some standard modes here
     249    TRACE("%s\n", __FUNCTION__);
     250    return vboxvideo_get_display_mode(dm);
     251}
     252
     253status_t vboxvideo_set_display_mode(display_mode *modeToSet)
     254{
     255    TRACE("%s\n", __FUNCTION__);
     256    TRACE("trying to set mode %dx%d\n", modeToSet->timing.h_display, modeToSet->timing.v_display);
     257    return ioctl(gInfo.deviceFD, VBOXVIDEO_SET_DISPLAY_MODE, modeToSet, sizeof(display_mode));
     258}
     259
     260status_t vboxvideo_get_display_mode(display_mode *currentMode)
     261{
     262    TRACE("%s\n", __FUNCTION__);
     263    *currentMode = gInfo.sharedInfo->currentMode;
     264    TRACE("current mode is %dx%d\n", currentMode->timing.h_display, currentMode->timing.v_display);
     265    return B_OK;
     266}
     267
     268status_t vboxvideo_get_edid_info(void *info, size_t size, uint32 *_version)
     269{
     270    TRACE("%s\n", __FUNCTION__);
     271
     272    // copied from the X11 implementation:
     273    static const uint8 edid_data[128] = {
     274        0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, /* header */
     275        0x58, 0x58, /* manufacturer (VBX) */
     276        0x00, 0x00, /* product code */
     277        0x00, 0x00, 0x00, 0x00, /* serial number goes here */
     278        0x01, /* week of manufacture */
     279        0x00, /* year of manufacture */
     280        0x01, 0x03, /* EDID version */
     281        0x80, /* capabilities - digital */
     282        0x00, /* horiz. res in cm, zero for projectors */
     283        0x00, /* vert. res in cm */
     284        0x78, /* display gamma (120 == 2.2).  Should we ask the host for this? */
     285        0xEE, /* features (standby, suspend, off, RGB, standard colour space,
     286                * preferred timing mode) */
     287        0xEE, 0x91, 0xA3, 0x54, 0x4C, 0x99, 0x26, 0x0F, 0x50, 0x54,
     288        /* chromaticity for standard colour space - should we ask the host? */
     289        0x00, 0x00, 0x00, /* no default timings */
     290        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
     291        0x01, 0x01, 0x01, 0x01, /* no standard timings */
     292        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     293        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* descriptor block 1 goes here */
     294        0x00, 0x00, 0x00, 0xFD, 0x00, /* descriptor block 2, monitor ranges */
     295        0x00, 0xC8, 0x00, 0xC8, 0x64, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20,
     296        0x20, /* 0-200Hz vertical, 0-200KHz horizontal, 1000MHz pixel clock */
     297        0x00, 0x00, 0x00, 0xFC, 0x00, /* descriptor block 3, monitor name */
     298        'V', 'B', 'O', 'X', ' ', 'm', 'o', 'n', 'i', 't', 'o', 'r', '\n',
     299        0x00, 0x00, 0x00, 0x10, 0x00, /* descriptor block 4: dummy data */
     300        0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
     301        0x20,
     302        0x00, /* number of extensions */
     303        0x00 /* checksum goes here */
     304    };
     305
     306    if (size < 128)
     307        return B_BUFFER_OVERFLOW;
     308
     309    *_version = 1; /*EDID_VERSION_1*/
     310    memcpy(info, edid_data, 128);
     311    return B_OK;
     312}
     313
     314status_t vboxvideo_get_frame_buffer_config(frame_buffer_config *config)
     315{
     316    TRACE("%s\n", __FUNCTION__);
     317    config->frame_buffer = gInfo.sharedInfo->framebuffer;
     318    config->frame_buffer_dma = NULL;
     319    config->bytes_per_row = get_depth_for_color_space(gInfo.sharedInfo->currentMode.space)
     320                            * gInfo.sharedInfo->currentMode.timing.h_display / 8;
     321    return B_OK;
     322}
     323
     324status_t vboxvideo_get_pixel_clock_limits(display_mode *dm, uint32 *low, uint32 *high)
     325{
     326    TRACE("%s\n", __FUNCTION__);
     327    // irrelevant for virtual monitors
     328    *low = 0;
     329    *high = 9001;
     330    return B_OK;
    308331}
    309332
    310333// cursor
    311 status_t vboxvideo_set_cursor_shape(uint16 width, uint16 height, uint16 hotX, uint16 hotY, uint8 *andMask, uint8 *xorMask) {
    312         TRACE("%s\n", __FUNCTION__);
    313         // VBoxHGSMIUpdatePointerShape
    314         return B_UNSUPPORTED;
    315 }
    316 
    317 void vboxvideo_move_cursor(uint16 x, uint16 y) {
    318         TRACE("%s\n", __FUNCTION__);
    319 }
    320 
    321 void vboxvideo_show_cursor(bool is_visible) {
    322         TRACE("%s\n", __FUNCTION__);
     334status_t vboxvideo_set_cursor_shape(uint16 width, uint16 height, uint16 hotX, uint16 hotY, uint8 *andMask, uint8 *xorMask)
     335{
     336    TRACE("%s\n", __FUNCTION__);
     337    // VBoxHGSMIUpdatePointerShape
     338    return B_UNSUPPORTED;
     339}
     340
     341void vboxvideo_move_cursor(uint16 x, uint16 y)
     342{
     343    TRACE("%s\n", __FUNCTION__);
     344}
     345
     346void vboxvideo_show_cursor(bool is_visible)
     347{
     348    TRACE("%s\n", __FUNCTION__);
    323349}
    324350
    325351// accelerant engine
    326 uint32 vboxvideo_accelerant_engine_count(void) {
    327         TRACE("%s\n", __FUNCTION__);
    328         return 1;
    329 }
    330 
    331 status_t vboxvideo_acquire_engine(uint32 capabilities, uint32 maxWait, sync_token *st, engine_token **et) {
    332         TRACE("%s\n", __FUNCTION__);
    333         *et = &sEngineToken;
    334         return B_OK;
    335 }
    336 
    337 status_t vboxvideo_release_engine(engine_token *et, sync_token *st) {
    338         TRACE("%s\n", __FUNCTION__);
    339         if (st != NULL)
    340                 st->engine_id = et->engine_id;
    341 
    342         return B_OK;
    343 }
    344 
    345 void vboxvideo_wait_engine_idle(void) {
    346         TRACE("%s\n", __FUNCTION__);
    347 }
    348 
    349 status_t vboxvideo_get_sync_token(engine_token *et, sync_token *st) {
    350         TRACE("%s\n", __FUNCTION__);
    351         return B_OK;
    352 }
    353 
    354 status_t vboxvideo_sync_to_token(sync_token *st) {
    355         TRACE("%s\n", __FUNCTION__);
    356         return B_OK;
     352uint32 vboxvideo_accelerant_engine_count(void)
     353{
     354    TRACE("%s\n", __FUNCTION__);
     355    return 1;
     356}
     357
     358status_t vboxvideo_acquire_engine(uint32 capabilities, uint32 maxWait, sync_token *st, engine_token **et)
     359{
     360    TRACE("%s\n", __FUNCTION__);
     361    *et = &sEngineToken;
     362    return B_OK;
     363}
     364
     365status_t vboxvideo_release_engine(engine_token *et, sync_token *st)
     366{
     367    TRACE("%s\n", __FUNCTION__);
     368    if (st != NULL)
     369        st->engine_id = et->engine_id;
     370
     371    return B_OK;
     372}
     373
     374void vboxvideo_wait_engine_idle(void)
     375{
     376    TRACE("%s\n", __FUNCTION__);
     377}
     378
     379status_t vboxvideo_get_sync_token(engine_token *et, sync_token *st)
     380{
     381    TRACE("%s\n", __FUNCTION__);
     382    return B_OK;
     383}
     384
     385status_t vboxvideo_sync_to_token(sync_token *st)
     386{
     387    TRACE("%s\n", __FUNCTION__);
     388    return B_OK;
    357389}
    358390
    359391// 2D acceleration
    360 void vboxvideo_screen_to_screen_blit(engine_token *et, blit_params *list, uint32 count) {
    361         TRACE("%s\n", __FUNCTION__);
    362 }
    363 
    364 void vboxvideo_fill_rectangle(engine_token *et, uint32 color, fill_rect_params *list, uint32 count) {
    365         TRACE("%s\n", __FUNCTION__);
    366 }
    367 
    368 void vboxvideo_invert_rectangle(engine_token *et, fill_rect_params *list, uint32 count) {
    369         TRACE("%s\n", __FUNCTION__);
    370 }
    371 
    372 void vboxvideo_fill_span(engine_token *et, uint32 color, uint16 *list, uint32 count) {
    373         TRACE("%s\n", __FUNCTION__);
    374 }
     392void vboxvideo_screen_to_screen_blit(engine_token *et, blit_params *list, uint32 count)
     393{
     394    TRACE("%s\n", __FUNCTION__);
     395}
     396
     397void vboxvideo_fill_rectangle(engine_token *et, uint32 color, fill_rect_params *list, uint32 count)
     398{
     399    TRACE("%s\n", __FUNCTION__);
     400}
     401
     402void vboxvideo_invert_rectangle(engine_token *et, fill_rect_params *list, uint32 count)
     403{
     404    TRACE("%s\n", __FUNCTION__);
     405}
     406
     407void vboxvideo_fill_span(engine_token *et, uint32 color, uint16 *list, uint32 count)
     408{
     409    TRACE("%s\n", __FUNCTION__);
     410}
  • trunk/src/VBox/Additions/haiku/VBoxVideo/accelerant/accelerant.h

    r43363 r43364  
    5151#include "../common/VBoxVideo_common.h"
    5252
    53 struct AccelerantInfo {
    54         int deviceFD;
    55         bool isClone;
     53struct AccelerantInfo
     54{
     55        int deviceFD;
     56        bool isClone;
    5657
    57         SharedInfo* sharedInfo;
    58         area_id sharedInfoArea;
     58        SharedInfo *sharedInfo;
     59        area_id sharedInfoArea;
    5960};
    6061extern AccelerantInfo gInfo;
     
    9798void vboxvideo_fill_span(engine_token *et, uint32 color, uint16 *list, uint32 count);
    9899
    99 #endif  /* _ACCELERANT_PROTOS_H */
     100#endif    /* _ACCELERANT_PROTOS_H */
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