VirtualBox

Ignore:
Timestamp:
Sep 22, 2012 4:53:18 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
80894
Message:

Additions/haiku: 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

    r43364 r43408  
    4545 */
    4646
     47/*******************************************************************************
     48*   Header Files                                                               *
     49*******************************************************************************/
    4750#include <Accelerant.h>
    4851#include "accelerant.h"
     
    5154#include <errno.h>
    5255
    53 #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)
     56/*******************************************************************************
     57*   Global Variables                                                           *
     58*******************************************************************************/
     59AccelerantInfo gInfo;
     60static engine_token sEngineToken = { 1, 0 /*B_2D_ACCELERATION*/, NULL };
     61
     62/** @todo r=ramshankar: get rid of this and replace with IPRT logging. */
     63#define TRACE(x...) do { \
     64    FILE* logfile = fopen("/var/log/vboxvideo.accelerant.log", "a"); \
     65    fprintf(logfile, x); \
     66    fflush(logfile); \
     67    fsync(fileno(logfile)); \
     68    fclose(logfile); \
     69    sync(); \
     70     } while(0)
    5471
    5572class AreaCloner
    5673{
    5774    public:
    58         AreaCloner() : fArea(-1) { }
     75        AreaCloner()
     76            : fArea(-1)
     77        {
     78        }
     79
    5980        ~AreaCloner()
    6081        {
     
    6990        }
    7091
    71         status_t InitCheck() { return fArea < B_OK ? (status_t)fArea : B_OK; }
    72         void Keep() { fArea = -1; }
     92        status_t InitCheck()
     93        {
     94            return fArea < B_OK ? (status_t)fArea : B_OK;
     95        }
     96
     97        void Keep()
     98        {
     99            fArea = -1;
     100        }
    73101
    74102    private:
    75         area_id    fArea;
     103        area_id fArea;
    76104};
    77 
    78 AccelerantInfo gInfo;
    79 
    80 static engine_token sEngineToken = { 1, 0 /*B_2D_ACCELERATION*/, NULL };
    81105
    82106extern "C"
     
    86110    switch (feature)
    87111    {
    88         /* general */
     112        /* General */
    89113        case B_INIT_ACCELERANT:
    90114            return (void *)vboxvideo_init_accelerant;
     
    102126            return (void *)vboxvideo_accelerant_retrace_semaphore;
    103127
    104             /* mode configuration */
     128        /* Mode configuration */
    105129        case B_ACCELERANT_MODE_COUNT:
    106130            return (void *)vboxvideo_accelerant_mode_count;
     
    118142            return (void *)vboxvideo_get_pixel_clock_limits;
    119143
     144#if 0
    120145            /* cursor managment */
    121             /*case B_SET_CURSOR_SHAPE:
     146            case B_SET_CURSOR_SHAPE:
    122147                return (void*)vboxvideo_set_cursor_shape;
    123148            case B_MOVE_CURSOR:
    124149                return (void*)vboxvideo_move_cursor;
    125150            case B_SHOW_CURSOR:
    126                 return (void*)vboxvideo_show_cursor;*/
    127 
    128             /* engine/synchronization */
     151                return (void*)vboxvideo_show_cursor;
     152#endif
     153
     154        /* Engine/synchronization */
    129155        case B_ACCELERANT_ENGINE_COUNT:
    130156            return (void *)vboxvideo_accelerant_engine_count;
     
    162188
    163189    AreaCloner sharedCloner;
    164     gInfo.sharedInfoArea = sharedCloner.Clone("vboxvideo shared info",
    165                                               (void **)&gInfo.sharedInfo, B_ANY_ADDRESS,
     190    gInfo.sharedInfoArea = sharedCloner.Clone("vboxvideo shared info", (void **)&gInfo.sharedInfo, B_ANY_ADDRESS,
    166191                                              B_READ_AREA | B_WRITE_AREA, sharedArea);
    167192    status_t status = sharedCloner.InitCheck();
     
    176201}
    177202
     203
    178204status_t vboxvideo_init_accelerant(int fd)
    179205{
     
    181207}
    182208
     209
    183210ssize_t vboxvideo_accelerant_clone_info_size(void)
    184211{
     
    187214}
    188215
     216
    189217void vboxvideo_get_accelerant_clone_info(void *data)
    190218{
     
    193221}
    194222
     223
    195224status_t vboxvideo_clone_accelerant(void *data)
    196225{
    197226    TRACE("%s\n", __FUNCTION__);
    198227
    199     // create full device name
     228    /* Create full device name */
    200229    char path[MAXPATHLEN];
    201230    strcpy(path, "/dev/");
     
    209238}
    210239
     240
    211241void vboxvideo_uninit_accelerant(void)
    212242{
     
    220250    TRACE("%s\n", __FUNCTION__);
    221251}
     252
    222253
    223254status_t vboxvideo_get_accelerant_device_info(accelerant_device_info *adi)
     
    231262}
    232263
     264
    233265sem_id vboxvideo_accelerant_retrace_semaphore(void)
    234266{
     
    236268    return -1;
    237269}
     270
    238271
    239272// modes & constraints
     
    244277}
    245278
     279
    246280status_t vboxvideo_get_mode_list(display_mode *dm)
    247281{
     
    250284    return vboxvideo_get_display_mode(dm);
    251285}
     286
    252287
    253288status_t vboxvideo_set_display_mode(display_mode *modeToSet)
     
    258293}
    259294
     295
    260296status_t vboxvideo_get_display_mode(display_mode *currentMode)
    261297{
     
    266302}
    267303
     304
    268305status_t vboxvideo_get_edid_info(void *info, size_t size, uint32 *_version)
    269306{
    270307    TRACE("%s\n", __FUNCTION__);
    271308
    272     // copied from the X11 implementation:
     309    /* Copied from the X11 implementation: */
    273310    static const uint8 edid_data[128] = {
    274311        0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, /* header */
     
    307344        return B_BUFFER_OVERFLOW;
    308345
    309     *_version = 1; /*EDID_VERSION_1*/
     346    *_version = 1; /* EDID_VERSION_1 */
    310347    memcpy(info, edid_data, 128);
    311348    return B_OK;
    312349}
     350
    313351
    314352status_t vboxvideo_get_frame_buffer_config(frame_buffer_config *config)
     
    322360}
    323361
     362
    324363status_t vboxvideo_get_pixel_clock_limits(display_mode *dm, uint32 *low, uint32 *high)
    325364{
     
    331370}
    332371
    333 // cursor
     372
     373/* Cursor */
    334374status_t vboxvideo_set_cursor_shape(uint16 width, uint16 height, uint16 hotX, uint16 hotY, uint8 *andMask, uint8 *xorMask)
    335375{
     
    339379}
    340380
     381
    341382void vboxvideo_move_cursor(uint16 x, uint16 y)
    342383{
     
    344385}
    345386
     387
    346388void vboxvideo_show_cursor(bool is_visible)
    347389{
     
    349391}
    350392
    351 // accelerant engine
     393
     394/* Accelerant engine */
    352395uint32 vboxvideo_accelerant_engine_count(void)
    353396{
     
    362405    return B_OK;
    363406}
     407
    364408
    365409status_t vboxvideo_release_engine(engine_token *et, sync_token *st)
     
    372416}
    373417
     418
    374419void vboxvideo_wait_engine_idle(void)
    375420{
     
    377422}
    378423
     424
    379425status_t vboxvideo_get_sync_token(engine_token *et, sync_token *st)
    380426{
     
    383429}
    384430
     431
    385432status_t vboxvideo_sync_to_token(sync_token *st)
    386433{
     
    389436}
    390437
    391 // 2D acceleration
     438
     439/* 2D acceleration */
    392440void vboxvideo_screen_to_screen_blit(engine_token *et, blit_params *list, uint32 count)
    393441{
     
    395443}
    396444
     445
    397446void vboxvideo_fill_rectangle(engine_token *et, uint32 color, fill_rect_params *list, uint32 count)
    398447{
     
    400449}
    401450
     451
    402452void vboxvideo_invert_rectangle(engine_token *et, fill_rect_params *list, uint32 count)
    403453{
     
    405455}
    406456
     457
    407458void vboxvideo_fill_span(engine_token *et, uint32 color, uint16 *list, uint32 count)
    408459{
  • trunk/src/VBox/Additions/haiku/VBoxVideo/accelerant/accelerant.h

    r43364 r43408  
    4545 */
    4646
    47 #ifndef _ACCELERANT_H
    48 #define _ACCELERANT_H
     47#ifndef ___VBOX_ACCELERANT_H
     48#define ___VBOX_ACCELERANT_H
    4949
    5050#include <Accelerant.h>
     
    5353struct AccelerantInfo
    5454{
    55         int deviceFD;
    56         bool isClone;
     55    /** @todo doxygen document these fields  */
     56    int deviceFD;
     57    bool isClone;
    5758
    58         SharedInfo *sharedInfo;
    59         area_id sharedInfoArea;
     59    SharedInfo *sharedInfo;
     60    area_id sharedInfoArea;
    6061};
    6162extern AccelerantInfo gInfo;
    6263
    63 // general
     64/* General */
    6465status_t vboxvideo_init_accelerant(int fd);
    6566ssize_t vboxvideo_accelerant_clone_info_size(void);
     
    7071sem_id vboxvideo_accelerant_retrace_semaphore(void);
    7172
    72 // modes & constraints
     73/* Modes & constraints */
    7374uint32 vboxvideo_accelerant_mode_count(void);
    7475status_t vboxvideo_get_mode_list(display_mode *dm);
     
    7980status_t vboxvideo_get_pixel_clock_limits(display_mode *dm, uint32 *low, uint32 *high);
    8081
    81 // cursor
     82/* Cursor */
    8283status_t vboxvideo_set_cursor_shape(uint16 width, uint16 height, uint16 hotX, uint16 hotY, uint8 *andMask, uint8 *xorMask);
    8384void vboxvideo_move_cursor(uint16 x, uint16 y);
    8485void vboxvideo_show_cursor(bool is_visible);
    8586
    86 // accelerant engine
     87/* Accelerant engine */
    8788uint32 vboxvideo_accelerant_engine_count(void);
    8889status_t vboxvideo_acquire_engine(uint32 capabilities, uint32 maxWait, sync_token *st, engine_token **et);
     
    9293status_t vboxvideo_sync_to_token(sync_token *st);
    9394
    94 // 2D acceleration
     95/* 2D acceleration */
    9596void vboxvideo_screen_to_screen_blit(engine_token *et, blit_params *list, uint32 count);
    9697void vboxvideo_fill_rectangle(engine_token *et, uint32 color, fill_rect_params *list, uint32 count);
     
    9899void vboxvideo_fill_span(engine_token *et, uint32 color, uint16 *list, uint32 count);
    99100
    100 #endif    /* _ACCELERANT_PROTOS_H */
     101#endif /* ___VBOX_ACCELERANT_H */
     102
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