VirtualBox

Ignore:
Timestamp:
Jun 19, 2009 8:49:25 AM (16 years ago)
Author:
vboxsync
Message:

video hw accel: DdBlt fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h

    r20699 r20701  
    489489};
    490490
    491 typedef enum
    492 {
    493     VBOXQGL_OP_PAINT = 1,
    494     VBOXQGL_OP_RESIZE,
    495     VBOXQGL_OP_VHWACMD,
    496 } VBOXQGL_OP_TYPE;
    497 
    498491class VBoxGLWidget : public QGLWidget
    499492{
     
    502495        : QGLWidget (aParent),
    503496        pDisplay(NULL),
    504         mRe(NULL),
    505         mpIntersectionRect(NULL),
    506497        mBitsPerPixel(0),
    507498        mPixelFormat(0),
     
    516507
    517508    uchar *vboxAddress() { return pDisplay ? pDisplay->address() : NULL; }
     509    uchar *vboxVRAMAddressFromOffset(uint64_t offset);
    518510    ulong vboxBitsPerPixel() { return mBitsPerPixel; }
    519511    ulong vboxBytesPerLine() { return pDisplay ? pDisplay->bytesPerLine() : NULL; }
    520512
    521     void vboxPaintEvent (QPaintEvent *pe);
    522     void vboxResizeEvent (VBoxResizeEvent *re);
     513typedef void (VBoxGLWidget::*PFNVBOXQGLOP)(void* );
     514//typedef FNVBOXQGLOP *PFNVBOXQGLOP;
     515
     516    void vboxPaintEvent (QPaintEvent *pe) {vboxPerformGLOp(&VBoxGLWidget::vboxDoPaint, pe);}
     517    void vboxResizeEvent (VBoxResizeEvent *re) {vboxPerformGLOp(&VBoxGLWidget::vboxDoResize, re);}
     518#ifdef VBOX_WITH_VIDEOHWACCEL
     519    void vboxVHWACmd (struct _VBOXVHWACMD * pCmd) {vboxPerformGLOp(&VBoxGLWidget::vboxDoVHWACmd, pCmd);}
     520#endif
    523521
    524522    VBoxVHWASurfacePrimary * vboxGetSurface() { return pDisplay; }
     
    526524//    void resizeGL (int height, int width);
    527525
    528     void paintGL();
     526    void paintGL() { (this->*mpfnOp)(mOpContext);}
    529527
    530528    void initializeGL();
     
    534532//    void vboxDoDeleteDisplay();
    535533//    void vboxDoPerformDisplay() { Assert(mDisplayInitialized); glCallList(mDisplay); }
    536 
    537     void vboxDoResize(VBoxResizeEvent *re);
    538     void vboxDoPaint(const QRect *rec);
    539     VBoxVHWASurfacePrimary * pDisplay;
    540 
    541     VBoxResizeEvent *mRe;
    542     const QRect *mpIntersectionRect;
    543     ulong  mBitsPerPixel;
    544     ulong  mPixelFormat;
    545     bool   mUsesGuestVRAM;
    546 };
    547 
    548 
    549 class VBoxQGLFrameBuffer : public VBoxFrameBuffer
    550 {
    551 public:
    552 
    553     VBoxQGLFrameBuffer (VBoxConsoleView *aView);
    554 
    555     STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
    556                              ULONG aW, ULONG aH);
    557 
     534    void vboxDoResize(void *re);
     535    void vboxDoPaint(void *rec);
    558536#ifdef VBOX_WITH_VIDEOHWACCEL
    559     STDMETHOD(ProcessVHWACommand)(BYTE *pCommand);
    560 #endif
    561 
    562     ulong pixelFormat() { return vboxWidget()->vboxPixelFormat(); }
    563     bool usesGuestVRAM() { return vboxWidget()->vboxUsesGuestVRAM(); }
    564 
    565     uchar *address() { return vboxWidget()->vboxAddress(); }
    566     ulong bitsPerPixel() { return vboxWidget()->vboxBitsPerPixel(); }
    567     ulong bytesPerLine() { return vboxWidget()->vboxBytesPerLine(); }
    568 
    569     uchar *vramAddressFromOffset(uint64_t offset);
    570 
    571     void paintEvent (QPaintEvent *pe);
    572     void resizeEvent (VBoxResizeEvent *re);
    573 #ifdef VBOX_WITH_VIDEOHWACCEL
    574     void doProcessVHWACommand(struct _VBOXVHWACMD * pCommand);
    575 #endif
    576 
    577 private:
    578 #ifdef VBOX_WITH_VIDEOHWACCEL
    579     void checkUpdateAddress (VBoxVHWASurfaceBase * pSurface, uint64_t offset)
     537    void vboxDoVHWACmd(void *cmd);
     538    void vboxCheckUpdateAddress (VBoxVHWASurfaceBase * pSurface, uint64_t offset)
    580539    {
    581540        if (pSurface->addressAlocated())
    582541        {
    583             uchar * addr = vramAddressFromOffset(offset);
     542            uchar * addr = vboxVRAMAddressFromOffset(offset);
    584543            if(addr)
    585544            {
     
    597556    int vhwaQueryInfo2(struct _VBOXVHWACMD_QUERYINFO2 *pCmd);
    598557#endif
     558
     559    VBoxVHWASurfacePrimary * pDisplay;
     560    /* we need to do all opengl stuff in the paintGL context,
     561     * submit the operation to be performed */
     562    void vboxPerformGLOp(PFNVBOXQGLOP pfn, void* pContext) {mpfnOp = pfn; mOpContext = pContext; updateGL();}
     563
     564    PFNVBOXQGLOP mpfnOp;
     565    void *mOpContext;
     566
     567    ulong  mBitsPerPixel;
     568    ulong  mPixelFormat;
     569    bool   mUsesGuestVRAM;
     570};
     571
     572
     573class VBoxQGLFrameBuffer : public VBoxFrameBuffer
     574{
     575public:
     576
     577    VBoxQGLFrameBuffer (VBoxConsoleView *aView);
     578
     579    STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
     580                             ULONG aW, ULONG aH);
     581
     582#ifdef VBOX_WITH_VIDEOHWACCEL
     583    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand);
     584#endif
     585
     586    ulong pixelFormat() { return vboxWidget()->vboxPixelFormat(); }
     587    bool usesGuestVRAM() { return vboxWidget()->vboxUsesGuestVRAM(); }
     588
     589    uchar *address() { return vboxWidget()->vboxAddress(); }
     590    ulong bitsPerPixel() { return vboxWidget()->vboxBitsPerPixel(); }
     591    ulong bytesPerLine() { return vboxWidget()->vboxBytesPerLine(); }
     592
     593    void paintEvent (QPaintEvent *pe);
     594    void resizeEvent (VBoxResizeEvent *re);
     595#ifdef VBOX_WITH_VIDEOHWACCEL
     596    void doProcessVHWACommand(struct _VBOXVHWACMD * pCommand);
     597#endif
     598
     599private:
    599600    void vboxMakeCurrent();
    600601    VBoxGLWidget * vboxWidget();
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