diff options
| author | Michael Lauer <mickey@vanille-media.de> | 2005-06-30 19:30:36 +0000 |
|---|---|---|
| committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2005-06-30 19:30:36 +0000 |
| commit | 0cfb22e016c01a84573531cb445f0085613df024 (patch) | |
| tree | 961fc85ea21056e5f3cddadad6927cc85014c018 /packages | |
| parent | 77fd2654d8081ec58ae8dc9a83ec9467734edfaf (diff) | |
Qt/Embedded 2.3.10:
- Fix linuxfb overflow with offscreen pixmaps
- Fix qte calling ::sync() instead of QScreen::sync()
- Fix rotation in W100 accellerated driver
All patches courtesy QtE Uberhacker Manuel Teira - thanks a lot, Manuel.
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/qte/qte-2.3.10/c7x0-w100-accel.patch | 2890 | ||||
| -rw-r--r-- | packages/qte/qte-2.3.10/fix-linuxfb-offscreenoverflow.patch | 22 | ||||
| -rw-r--r-- | packages/qte/qte-2.3.10/fix-qscreen-sync.patch | 17 | ||||
| -rw-r--r-- | packages/qte/qte_2.3.10.bb | 6 |
4 files changed, 1901 insertions, 1034 deletions
diff --git a/packages/qte/qte-2.3.10/c7x0-w100-accel.patch b/packages/qte/qte-2.3.10/c7x0-w100-accel.patch index 5cff74623a..f2e07bdd3d 100644 --- a/packages/qte/qte-2.3.10/c7x0-w100-accel.patch +++ b/packages/qte/qte-2.3.10/c7x0-w100-accel.patch @@ -67,6 +67,15 @@ Manuel Teira <manuel.teira@telefonica.net> #if !defined(QT_NO_QWS_TRANSFORMED) { "Transformed", qt_get_screen_transformed, 0 }, #endif +@@ -6039,6 +6046,8 @@ + qt_screen = driverTable[i].qt_get_screen( display_id ); + if ( qt_screen ) { + if ( qt_screen->connect( spec ) ) { ++ printf( "[%d]:Connected to screen '%s'\n", ++ getpid(), driverTable[i].name ); + return qt_screen; + } else { + delete qt_screen; --- /dev/null +++ qt-2.3.10/src/3rdparty/kernel/aticore/aticore.h @@ -0,0 +1,567 @@ @@ -639,7 +648,8 @@ Manuel Teira <manuel.teira@telefonica.net> +#endif --- /dev/null +++ qt-2.3.10/src/kernel/qgfxw100_qws.cpp -@@ -0,0 +1,1466 @@ +@@ -0,0 +1,2283 @@ ++ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil -*- */ +/*************************************************************************** + +** Imageon driver for qte using libAticore @@ -673,1431 +683,2247 @@ Manuel Teira <manuel.teira@telefonica.net> +class W100Control { +public: + -+ typedef enum Loglevel { -+ ERROR = 0, -+ WARNING, -+ INFO -+ }; -+ -+ typedef enum Opcodes { -+ DRAWLINE = 1, -+ DRAWPOINT, -+ DRAWPOINTS, -+ FILLRECT, -+ SCROLL, -+ BITBLT, -+ POLYLINE, -+ EOO -+ }; -+ -+ typedef struct Opcode { -+ QString str; -+ int index; -+ bool accelerated; -+ int hits; -+ int misses; -+ }; -+ -+ static Opcode lOpcodes[]; -+ -+ static QString level2str( int level ) -+ { -+ switch( level ) { -+ case ERROR: -+ return QString( "ERROR" ); -+ break; -+ case WARNING: -+ return QString( "WARNING" ); -+ break; -+ case INFO: -+ return QString( "INFO" ); -+ break; -+ default: -+ return QString( "UNKNOWN" ); -+ break; -+ } -+ } -+ -+ W100Control(): -+ m_loglevel( 0 ), -+ m_enabled( 0 ) -+ { -+ m_loglevel = 0; -+ char *var; -+ if ( var = getenv( "W100_DEBUG" ) ) { -+ if ( strtol( var, 0, 0 ) == 1 ) { -+ m_enabled = 1; -+ } -+ } -+ -+ if ( m_enabled ) { -+ if ( var = getenv( "W100_DEBUGLEVEL" ) ) { -+ if ( ( m_loglevel = strtol( var, 0, 0 ) ) < 0 ) { -+ m_loglevel = 0; -+ } -+ } -+ -+ QString path( "/mnt/card/w100/w100debug.log" ); -+ if ( var = getenv( "W100_DEBUGPATH" ) ) { -+ path = QString( var ) + "/w100debug.log"; -+ } -+ m_logfile = fopen( path.latin1(), "w" ); -+ if ( m_logfile == NULL ) m_enabled = 0; -+ } -+ -+ Opcode *opcodePtr = lOpcodes; -+ int i = 1; -+ while ( opcodePtr->index != EOO ) { -+ if ( opcodePtr->index != i ) { -+ fprintf( stderr, "Opcode list is not ordered!!\n" ); -+ abort(); -+ } -+ -+ QString varName = "W100_ACCEL_" + opcodePtr->str; -+ char *varPtr; -+ if ( ( varPtr = getenv( varName.latin1() ) ) ) { -+ if ( ( strtol( varPtr, NULL, 0 ) == 0 ) || -+ ( strcmp( varPtr, "false" ) == 0 ) ) { -+ opcodePtr->accelerated = false; -+ } -+ } -+ opcodePtr++; -+ i++; -+ } -+ } -+ -+ ~W100Control() -+ { -+ //Dump statistics about any opcode -+ Opcode *opcodePtr = lOpcodes; -+ while ( opcodePtr->index != EOO ) { -+ log( WARNING, "Opcode %s. Accelerated=%s. Hits=%d. Misses=%d", -+ opcodePtr->str.latin1(), -+ opcodePtr->accelerated ? "true" : "false", -+ opcodePtr->hits, -+ opcodePtr->misses ); -+ opcodePtr++; -+ } -+ if ( m_enabled && m_logfile ) { -+ fclose( m_logfile ); -+ } -+ } -+ -+ bool accelerated( int opcode ) -+ { -+ if ( opcode < EOO ) { -+ return lOpcodes[opcode].accelerated; ++ typedef enum Loglevel { ++ ERROR = 0, ++ WARNING, ++ INFO ++ }; ++ ++ typedef enum Opcodes { ++ DRAWLINE = 0, ++ DRAWPOINT, ++ DRAWPOINTS, ++ FILLRECT, ++ SCROLL, ++ BITBLT, ++ POLYLINE, ++ EOO ++ }; ++ ++ typedef struct Opcode { ++ QString str; ++ int index; ++ bool accelerated; ++ int hits; ++ int misses; ++ }; ++ ++ static Opcode lOpcodes[]; ++ ++ static QString level2str( int level ) ++ { ++ switch( level ) { ++ case ERROR: ++ return QString( "ERROR" ); ++ break; ++ case WARNING: ++ return QString( "WARNING" ); ++ break; ++ case INFO: ++ return QString( "INFO" ); ++ break; ++ default: ++ return QString( "UNKNOWN" ); ++ break; ++ } ++ } ++ ++ W100Control(): ++ m_loglevel( 0 ), ++ m_enabled( 0 ) ++ { ++ m_loglevel = 0; ++ char *var; ++ if ( var = getenv( "W100_DEBUG" ) ) { ++ if ( strtol( var, 0, 0 ) == 1 ) { ++ m_enabled = 1; ++ } ++ } ++ ++ if ( m_enabled ) { ++ if ( var = getenv( "W100_DEBUGLEVEL" ) ) { ++ if ( ( m_loglevel = strtol( var, 0, 0 ) ) < 0 ) { ++ m_loglevel = 0; ++ } ++ } ++ ++ QString path( "/mnt/card/w100/w100debug.log" ); ++ if ( var = getenv( "W100_DEBUGPATH" ) ) { ++ path = QString( var ) + "/w100debug.log"; ++ } ++ m_logfile = fopen( path.latin1(), "a" ); ++ if ( m_logfile == NULL ) m_enabled = 0; ++ } ++ ++ Opcode *opcodePtr = lOpcodes; ++ while ( opcodePtr->index != EOO ) { ++ QString varName = "W100_ACCEL_" + opcodePtr->str; ++ char *varPtr; ++ if ( ( varPtr = getenv( varName.latin1() ) ) ) { ++ if ( ( strtol( varPtr, NULL, 0 ) == 0 ) || ++ ( strcmp( varPtr, "false" ) == 0 ) ) { ++ opcodePtr->accelerated = false; ++ } ++ } ++ opcodePtr++; ++ } ++ } ++ ++ ~W100Control() ++ { ++ //Dump statistics about any opcode ++ Opcode *opcodePtr = lOpcodes; ++ while ( opcodePtr->index != EOO ) { ++ log( WARNING, "Opcode %s. Accelerated=%s. Hits=%d. Misses=%d", ++ opcodePtr->str.latin1(), ++ opcodePtr->accelerated ? "true" : "false", ++ opcodePtr->hits, ++ opcodePtr->misses ); ++ opcodePtr++; ++ } ++ if ( m_enabled && m_logfile ) { ++ fclose( m_logfile ); ++ } ++ } ++ ++ bool accelerated( int opcode ) ++ { ++ if ( opcode < EOO ) { ++ return lOpcodes[opcode].accelerated; ++ } ++ return false; ++ } ++ ++ void addHit( int opcode ) ++ { ++ lOpcodes[opcode].hits++; ++ } ++ ++ void addMiss( int opcode ) ++ { ++ lOpcodes[opcode].misses++; ++ } ++ ++ void log( int level, const char *fmt, ... ) ++ { ++ if ( m_enabled && ( level <= m_loglevel ) ) { ++ char buffer[1024]; ++ va_list ap; ++ va_start( ap, fmt ); ++ vsnprintf( buffer, 1023, fmt, ap ); ++ va_end( ap ); ++ fprintf( m_logfile, "%d:%s:%s\n", getpid(), ++ level2str( level ).latin1(), ++ buffer ); ++ fflush( m_logfile ); ++ } + } -+ return false; -+ } -+ -+ void addHit( int opcode ) -+ { -+ lOpcodes[opcode].hits++; -+ ( *lastop ) = opcode; -+ } -+ -+ int lastOp( void ) const -+ { -+ return ( *lastop ); -+ } -+ -+ void addMiss( int opcode ) -+ { -+ lOpcodes[opcode].misses++; -+ } -+ -+ void log( int level, const char *fmt, ... ) -+ { -+ if ( m_enabled && ( level <= m_loglevel ) ) { -+ char buffer[1024]; -+ va_list ap; -+ va_start( ap, fmt ); -+ vsnprintf( buffer, 1023, fmt, ap ); -+ va_end( ap ); -+ fprintf( m_logfile, "%d:%s:%s\n", getpid(), -+ level2str( level ).latin1(), -+ buffer ); -+ } -+ } + +private: -+ FILE *m_logfile; -+ int m_loglevel; -+ bool m_enabled; ++ FILE *m_logfile; ++ int m_loglevel; ++ bool m_enabled; +}; + +W100Control::Opcode W100Control::lOpcodes[] = { -+ { "DRAWLINE", W100Control::DRAWLINE, true, 0, 0 }, -+ { "DRAWPOINT", W100Control::DRAWPOINT, true, 0, 0 }, -+ { "DRAWPOINTS", W100Control::DRAWPOINTS, true, 0, 0 }, -+ { "FILLRECT", W100Control::FILLRECT, true, 0, 0 }, -+ { "SCROLL", W100Control::SCROLL, true, 0, 0 }, -+ { "BITBLT", W100Control::BITBLT, true, 0, 0 }, -+ { "POLYLINE", W100Control::POLYLINE, true, 0, 0 }, -+ { "" , W100Control::EOO, false, 0, 0 } ++ { "DRAWLINE", W100Control::DRAWLINE, true, 0, 0 }, ++ { "DRAWPOINT", W100Control::DRAWPOINT, true, 0, 0 }, ++ { "DRAWPOINTS", W100Control::DRAWPOINTS, true, 0, 0 }, ++ { "FILLRECT", W100Control::FILLRECT, true, 0, 0 }, ++ { "SCROLL", W100Control::SCROLL, true, 0, 0 }, ++ { "BITBLT", W100Control::BITBLT, true, 0, 0 }, ++ { "POLYLINE", W100Control::POLYLINE, true, 0, 0 }, ++ { "" , W100Control::EOO, false, 0, 0 } +}; + +W100Control control; + +static int W100_ProcessAttach( void ) +{ -+ return( AtiCore_ProcessAttach() ); ++ return( AtiCore_ProcessAttach() ); +} + +static int W100_ProcessDetach( void ) +{ -+ return( AtiCore_ProcessDetach() ); ++ return( AtiCore_ProcessDetach() ); +} + +static int W100_AllocateSurface( uint16_t *handle, uint32_t *offset, -+ uint32_t size, uint32_t direction ) ++ uint32_t size, uint32_t direction ) +{ -+ int retcode = AtiCore_AllocateSurface( handle, offset, size, direction ); -+ return( retcode ); ++ return( AtiCore_AllocateSurface( handle, offset, size, direction ) ); +} + +static int W100_DestroySurface( uint16_t handle ) +{ -+ int retcode = AtiCore_DestroySurface( handle ); -+ return( retcode ); ++ return( AtiCore_DestroySurface( handle ) ); +} + +static int W100_DrawPixel( int npoints, ATI_POINT *points ) +{ -+ return( AtiCore_DrawPixel( npoints, points ) ); ++ return( AtiCore_DrawPixel( npoints, points ) ); +} + +static int W100_SetRopOperation( uint32_t rop ) +{ -+ return( AtiCore_SetRopOperation( rop ) ); ++ return( AtiCore_SetRopOperation( rop ) ); +} + +static int W100_SetDstType( uint32_t dtype ) +{ -+ return( AtiCore_SetDstType( dtype ) ); ++ return( AtiCore_SetDstType( dtype ) ); +} + +static int W100_SetSrcType( uint32_t stype ) +{ -+ return( AtiCore_SetSrcType( stype ) ); ++ return( AtiCore_SetSrcType( stype ) ); +} + +static int W100_SetSrcClippingRect( ATI_CLIPRECT *cliprect ) +{ -+ return( AtiCore_SetSrcClippingRect( cliprect ) ); ++ return( AtiCore_SetSrcClippingRect( cliprect ) ); +} + -+ +static int W100_SetDstClippingRect( ATI_CLIPRECT *cliprect ) +{ -+ return( AtiCore_SetDstClippingRect( cliprect ) ); ++ return( AtiCore_SetDstClippingRect( cliprect ) ); +} + +static int W100_SetSrcPitchOffset( int pitch, int offset ) +{ -+ return( AtiCore_SetSrcPitchOffset( pitch, offset ) ); ++ return( AtiCore_SetSrcPitchOffset( pitch, offset ) ); +} + +static int W100_SetDstPitchOffset( int pitch, int offset ) +{ -+ return( AtiCore_SetDstPitchOffset( pitch, offset ) ); ++ return( AtiCore_SetDstPitchOffset( pitch, offset ) ); +} + +static int W100_BitBltFilpRotate( int flags, -+ ATI_RECT *dstRect, -+ ATI_RECT *srcRect ) ++ ATI_RECT *dstRect, ++ ATI_RECT *srcRect ) +{ -+ return( AtiCore_BitBltFilpRotate( flags, dstRect, srcRect ) ); ++ return( AtiCore_BitBltFilpRotate( flags, dstRect, srcRect ) ); +} + +static int W100_StretchBlt( ATI_STRETCH *option, -+ ATI_POINT *point, -+ ATI_RECT *srcRect ) ++ ATI_POINT *point, ++ ATI_RECT *srcRect ) +{ -+ return( AtiCore_StretchBlt( option, point, srcRect ) ); ++ return( AtiCore_StretchBlt( option, point, srcRect ) ); +} + +static int W100_WaitComplete( int msec ) +{ -+ return( AtiCore_WaitComplete( msec ) ); ++ return( AtiCore_WaitComplete( msec ) ); +} + +static int W100_AllocOverlay( uint16_t *handle ) +{ -+ return( AtiCore_AllocOverlay( handle ) ); ++ return( AtiCore_AllocOverlay( handle ) ); +} + +static int W100_ReleaseOverlay( uint16_t handle ) +{ -+ return( AtiCore_ReleaseOverlay( handle ) ); ++ return( AtiCore_ReleaseOverlay( handle ) ); +} + +static int W100_SetupOverlay( uint16_t handle, ATI_OVERLAYPROP *prop ) +{ -+ return( AtiCore_SetupOverlay( handle, prop ) ); ++ return( AtiCore_SetupOverlay( handle, prop ) ); +} + +static int W100_SetupOverlayExtended( uint16_t handle, ATI_EXTENDEDOVERLAYPROP *prop ) +{ -+ return( AtiCore_SetupOverlayExtended( handle, prop ) ); ++ return( AtiCore_SetupOverlayExtended( handle, prop ) ); +} + +static int W100_SetOverlayOnOff( uint16_t handle, int isShow ) +{ -+ return( AtiCore_SetOverlayOnOff( handle, isShow ) ); ++ return( AtiCore_SetOverlayOnOff( handle, isShow ) ); +} + +static int W100_SetOverlayPos( uint16_t handle, uint16_t x, uint16_t y ) +{ -+ return( AtiCore_SetOverlayPos( handle, x, y ) ); ++ return( AtiCore_SetOverlayPos( handle, x, y ) ); +} + +static int W100_SetupMemoryTransfer( uint32_t offset, uint32_t *regdata ) +{ -+ return( AtiCore_SetupMemoryTransfer( offset, regdata ) ); ++ return( AtiCore_SetupMemoryTransfer( offset, regdata ) ); +} + +static int W100_TerminateMemoryTransfer( void ) +{ -+ return( AtiCore_TerminateMemoryTransfer() ); ++ return( AtiCore_TerminateMemoryTransfer() ); +} + +static int W100_GetFrontBufferPitchOffset( uint32_t *pitch, uint32_t *offset ) +{ -+ return( AtiCore_GetFrontBufferPitchOffset( pitch, offset ) ); ++ return( AtiCore_GetFrontBufferPitchOffset( pitch, offset ) ); +} + +static int W100_SetDisplayBrightness( int bri ) +{ -+ return( AtiCore_SetDisplayBrightness( bri ) ); ++ return( AtiCore_SetDisplayBrightness( bri ) ); +} + +static int W100_GetAvailableVideoMem( uint32_t *internal, uint32_t *external ) +{ -+ return( GetAvailableVideoMem( internal, external ) ); ++ return( GetAvailableVideoMem( internal, external ) ); +} + +static int W100_SetupGraphicWindow( ATI_GRAPHICWINDOW *win ) +{ -+ return( AtiCore_SetupGraphicWindow( ( void * ) win ) ); ++ return( AtiCore_SetupGraphicWindow( ( void * ) win ) ); +} + +static int W100_ProcessAttachSpecialMode( int mode ) +{ -+ return( AtiCore_ProcessAttachSpecialMode( mode ) ); ++ return( AtiCore_ProcessAttachSpecialMode( mode ) ); +} + +static int W100_SetGraphicWindowPos( int x, int y ) +{ -+ return( AtiCore_SetGraphicWindowPos( x, y ) ); ++ return( AtiCore_SetGraphicWindowPos( x, y ) ); +} + +static int W100_SetFrontBuffer( int offset, int a, int b ) +{ -+ return( AtiCore_SetFrontBuffer( offset, a, b ) ); ++ return( AtiCore_SetFrontBuffer( offset, a, b ) ); +} + +static int W100_SetGraphicWindowOnOff( int val ) +{ -+ return( AtiCore_SetGraphicWindowOnOff( val ) ); ++ return( AtiCore_SetGraphicWindowOnOff( val ) ); +} + +static unsigned long ccolor( unsigned int rgb ) +{ -+ unsigned char r = ( rgb & 0xff0000 ) >> 19; -+ unsigned char g = ( rgb & 0xff00 ) >> 10; -+ unsigned char b = ( rgb & 0xff ) >> 3; -+ return ( ( ( ( unsigned short )0x1f & r ) << 11 ) | -+ ( ( ( unsigned short )0x3f & g ) << 5 ) | -+ ( ( ( unsigned short )0x1f & b ) ) ); ++ unsigned char r = ( rgb & 0xff0000 ) >> 19; ++ unsigned char g = ( rgb & 0xff00 ) >> 10; ++ unsigned char b = ( rgb & 0xff ) >> 3; ++ return ( ( ( ( unsigned short )0x1f & r ) << 11 ) | ++ ( ( ( unsigned short )0x3f & g ) << 5 ) | ++ ( ( ( unsigned short )0x1f & b ) ) ); +} + +static int W100_SetFrgColour( int val ) +{ -+ return( AtiCore_SetFrgColour( ccolor( val ) ) ); ++ return( AtiCore_SetFrgColour( ccolor( val ) ) ); +} + +static int W100_BrushType( int type, unsigned int pattern ) +{ -+ return( AtiCore_BrushType( type, &pattern ) ); ++ return( AtiCore_BrushType( type, &pattern ) ); +} + +static int W100_PaintRect( int flags, ATI_RECT *rect ) +{ -+ return( AtiCore_PaintRect( flags, rect ) ); ++ return( AtiCore_PaintRect( flags, rect ) ); +} + +static int W100_Polyline( int npoints, ATI_POINT *points ) +{ -+ return( AtiCore_Polyline( npoints, points ) ); ++ return( AtiCore_Polyline( npoints, points ) ); +} + +static int W100_GetPitchOffsetProperty( void *pitch, void *offset ) +{ -+ return( AtiCore_GetPitchOffsetProperty( pitch, offset ) ); ++ return( AtiCore_GetPitchOffsetProperty( pitch, offset ) ); +} + +static int W100_CursorOnOff( int a, int b ) +{ -+ return( AtiCore_CursorOnOff( a, b ) ); ++ return( AtiCore_CursorOnOff( a, b ) ); +} + +static int W100_BitBlt( int flags, ATI_RECT *dst, ATI_RECT *src ) +{ -+ return( AtiCore_BitBlt( flags, dst, src ) ); ++ return( AtiCore_BitBlt( flags, dst, src ) ); +} + +static int W100_WakeUpCall( void ) +{ -+ return( AtiCore_WakeUpCall() ); ++ return( AtiCore_WakeUpCall() ); +} + ++class QW100Screen; ++static QW100Screen *qt_w100_screen = 0; ++ ++class QW100Screen : public QLinuxFbScreen { ++public: ++ class HWSurface { ++ public: ++ HWSurface( void ): ++ m_handle( 0 ), ++ m_offset( 0 ), ++ m_addr( 0 ), ++ m_size( 0 ), ++ m_internal( false ), ++ m_clientid( -1 ) {}; ++ HWSurface( unsigned short handle, ++ uint32_t sOffset, ++ unsigned char *localAddr, ++ int amount, ++ bool internal, ++ int clientid ): ++ m_handle( handle ), ++ m_offset( sOffset ), ++ m_addr( localAddr ), ++ m_size( amount ), ++ m_internal( internal ), ++ m_clientid( clientid ) {}; ++ HWSurface( uint32_t sOffset, ++ unsigned char *localAddr, ++ bool internal, ++ int amount ): ++ m_handle( 0 ), ++ m_offset( sOffset ), ++ m_addr( localAddr ), ++ m_size( amount ), ++ m_internal( internal ), ++ m_clientid( -1 ) {}; ++ bool operator!=( HWSurface &other ) { ++ return( m_offset == other.getSOffset() ); ++ }; ++ HWSurface &operator=( const HWSurface &c ) { ++ m_handle = c.getHandle(); ++ m_offset = c.getSOffset(); ++ m_addr = c.getAddr(); ++ m_size = c.getSize(); ++ m_clientid= c.getCId(); ++ m_internal = c.internal(); ++ return( *this ); ++ }; ++ unsigned short getHandle( void ) const { return m_handle; }; ++ uint32_t getSOffset( void ) const { return m_offset; }; ++ unsigned char *getAddr( void ) const { return m_addr; }; ++ unsigned int getSize( void ) const { return m_size; }; ++ int getCId( void ) const { return m_clientid; }; ++ bool internal( void ) const { return m_internal; }; ++ ++ private: ++ unsigned short m_handle; ++ uint32_t m_offset; ++ unsigned char *m_addr; ++ int m_size; ++ bool m_internal; ++ int m_clientid; ++ }; ++ ++ QW100Screen( int display_id ); ++ virtual ~QW100Screen(); ++ virtual bool connect( const QString &spec ); ++ virtual void disconnect( void ); ++ virtual bool initDevice(); ++ virtual void shutdownDevice(); ++ virtual void restore(); ++ virtual bool useOffscreen() { return true; } ++ virtual QGfx * createGfx( unsigned char *, int, int, int, int); ++ virtual uchar *cache( int amount, int optim ); ++ virtual void uncache( uchar *c ); ++ virtual bool onCard( unsigned char *p ) const; ++ virtual bool onCard( unsigned char *p, ulong& offset ) const; ++ QMap< uchar*, HWSurface > *getPSurfaceMap( void ) const; ++ void clearCache( int clientId ); ++ ++ // Rotation stuff ++ enum Transformation { None, Rot90, Rot180, Rot270 }; ++ void setTransformation( Transformation t ); ++ Transformation transformation() const; ++ virtual bool isTransformed() const { return trans != None; }; ++ virtual QSize mapToDevice( const QSize & ) const; ++ virtual QSize mapFromDevice( const QSize & ) const; ++ virtual QPoint mapToDevice( const QPoint &, const QSize & ) const; ++ virtual QPoint mapFromDevice( const QPoint &, const QSize & ) const; ++ virtual QRect mapToDevice( const QRect &, const QSize & ) const; ++ virtual QRect mapFromDevice( const QRect &, const QSize & ) const; ++ virtual QImage mapToDevice( const QImage & ) const; ++ virtual QImage mapFromDevice( const QImage & ) const; ++ virtual QRegion mapToDevice( const QRegion &, const QSize & ) const; ++ virtual QRegion mapFromDevice( const QRegion &, const QSize & ) const; ++ virtual int transformOrientation() const; ++ ++protected: ++ bool w100init(); ++ void w100shutdown(); ++ Transformation trans; ++ static Transformation getTransSpec( const QString &dspec ); ++ static void clearCache( QScreen *instance, int clientId ); ++ QMap< uchar*, HWSurface > surfaceMap; ++ int vramoffset; ++ virtual int pixmapLinestepAlignment() { return 128; } ++}; + +template <const int depth, const int type> +class QGfxW100 : public QGfxRaster<depth,type> { + +public: -+ QGfxW100( unsigned char *b, int w, int h ); -+ virtual void drawLine( int, int, int, int); -+ virtual void fillRect( int, int, int, int); -+ virtual void blt( int, int, int, int, int, int ); -+ virtual void sync(); -+ virtual void setOffset( int x, int y ); -+ virtual void setPen( const QPen & p ); -+ -+ virtual void drawPolyline( const QPointArray &, int, int ); -+ virtual void drawPolygon( const QPointArray &, bool, int, int ); -+ virtual void drawPoint( int, int ); -+ virtual void drawPoints( const QPointArray &, int, int ); -+ virtual void scroll( int, int, int, int, int, int ); ++ QGfxW100( unsigned char *b, int w, int h ); ++ virtual void drawLine( int, int, int, int); ++ virtual void fillRect( int, int, int, int); ++ virtual void blt( int, int, int, int, int, int ); ++ virtual void sync(); ++ virtual void setOffset( int x, int y ); ++ virtual void setPen( const QPen & p ); + ++ virtual void drawPolyline( const QPointArray &, int, int ); ++ virtual void drawPolygon( const QPointArray &, bool, int, int ); ++ virtual void drawPoint( int, int ); ++ virtual void drawPoints( const QPointArray &, int, int ); ++ virtual void scroll( int, int, int, int, int, int ); ++ virtual void tiledBlt( int rx, int ry, int w, int h ); ++ ++ inline int tx( int x, int y ) { ++ switch ( qt_w100_screen->transformation() ) { ++ case QW100Screen::Rot90: ++ return y - this->xoffs + this->yoffs; ++ case QW100Screen::Rot180: ++ return ( this->width - x - 1) - this->xoffs - this->xoffs; ++ case QW100Screen::Rot270: ++ return ( this->height - y - 1) - this->xoffs - this->yoffs; ++ default: ++ return x; ++ } ++ } ++ inline int ty( int x, int y ) { ++ switch ( qt_w100_screen->transformation() ) { ++ case QW100Screen::Rot90: ++ return (this->width - x - 1) - this->yoffs - this->xoffs; ++ case QW100Screen::Rot180: ++ return (this->height - y - 1) - this->yoffs - this->yoffs; ++ case QW100Screen::Rot270: ++ return x - this->yoffs + this->xoffs; ++ default: ++ return y; ++ } ++ } + -+private: -+ bool checkDest( bool setsrc = false ); -+ bool checkSourceDest(); ++protected: ++ bool checkDest( bool setsrc = false ); ++ bool checkSourceDest(); ++ virtual void setSourceWidgetOffset( int x, int y ); ++ void processSpans( int n, QPoint* point, int* width ); ++ bool inDraw; ++ ++ virtual void dDrawLine( int, int, int, int); ++ virtual void dFillRect( int, int, int, int); ++ virtual void dBlt( int, int, int, int, int, int ); ++ void dDrawPolyline( const QPointArray &, int, int ); ++ void dDrawPolygon( const QPointArray &, bool, int, int ); ++ void dDrawPoint( int, int ); ++ void dDrawPoints( const QPointArray &, int, int ); ++ void dScroll( int, int, int, int, int, int ); ++ void dTiledBlt( int rx, int ry, int w, int h ); +}; + +template<const int depth,const int type> +QGfxW100<depth,type>::QGfxW100( unsigned char * b, int w, int h ) -+ : QGfxRaster<depth,type>(b, w, h) ++ : QGfxRaster<depth,type>(b, w, h), ++ inDraw( false ) +{ +} + -+ +template<const int depth,const int type> +inline void QGfxW100<depth,type>::setOffset( int x, int y ) +{ -+ QGfxRaster<depth,type>::setOffset( x, y ); ++ QGfxRaster<depth,type>::setOffset( x, y ); +} + +static QString penStyleStr( const QPen &pen ) +{ -+ QString res; -+ switch( pen.style() ) { -+ case Qt::NoPen: -+ res = "NoPen"; -+ break; -+ case Qt::SolidLine: -+ res = "SolidLine"; -+ break; -+ case Qt::DashLine: -+ res = "DashLine"; -+ break; -+ case Qt::DotLine: -+ res = "DotLine"; -+ break; -+ case Qt::DashDotLine: -+ res = "DashDotLine"; -+ break; -+ case Qt::DashDotDotLine: -+ res = "DashDotDotLine"; -+ break; -+ default: -+ res = "Unknown"; -+ } -+ return res; ++ QString res; ++ switch( pen.style() ) { ++ case Qt::NoPen: ++ res = "NoPen"; ++ break; ++ case Qt::SolidLine: ++ res = "SolidLine"; ++ break; ++ case Qt::DashLine: ++ res = "DashLine"; ++ break; ++ case Qt::DotLine: ++ res = "DotLine"; ++ break; ++ case Qt::DashDotLine: ++ res = "DashDotLine"; ++ break; ++ case Qt::DashDotDotLine: ++ res = "DashDotDotLine"; ++ break; ++ default: ++ res = "Unknown"; ++ } ++ return res; +} + +template<const int depth, const int type> +inline void QGfxW100<depth,type>::setPen( const QPen &p ) +{ -+ QGfxRaster<depth,type>::setPen( p ); ++ QGfxRaster<depth,type>::setPen( p ); +} + +template<const int depth,const int type> +inline bool QGfxW100<depth,type>::checkSourceDest() +{ -+ if ( !checkDest() ) { -+ return FALSE; -+ } ++ if ( !checkDest() ) { ++ return FALSE; ++ } + -+ int sourcepixelpitch; -+ ulong src_buffer_offset; -+ if ( this->srctype == this->SourcePen ) { -+ src_buffer_offset = -1; -+ return FALSE; -+ } else { -+ if ( !qt_screen->onCard( this->srcbits, src_buffer_offset ) ) { -+ return FALSE; ++ int sourcepixelpitch; ++ ulong src_buffer_offset; ++ if ( this->srctype == this->SourcePen ) { ++ src_buffer_offset = -1; ++ return FALSE; ++ } else { ++ if ( !qt_screen->onCard( this->srcbits, src_buffer_offset ) ) { ++ return FALSE; ++ } ++ sourcepixelpitch = ( this->srclinestep * 8 ) / this->srcdepth; ++ W100_SetSrcPitchOffset( sourcepixelpitch, ++ src_buffer_offset ); + } -+ sourcepixelpitch = ( this->srclinestep * 8 ) / this->srcdepth; -+ W100_SetSrcPitchOffset( sourcepixelpitch, -+ src_buffer_offset ); -+ } -+ return TRUE; ++ return TRUE; +} + +template< const int depth, const int type> +inline bool QGfxW100<depth, type>::checkDest( bool setsrc ) +{ -+ //Main framebuffer should be registered as a hardware surface -+ ulong buffer_offset; -+ if ( !qt_screen->onCard( this->buffer, buffer_offset ) ) { -+ return FALSE; -+ } -+ int pixelstep = ( this->linestep() * 8 ) / depth; -+ W100_SetDstPitchOffset( pixelstep, buffer_offset ); -+ if ( setsrc ) { -+ W100_SetSrcPitchOffset( pixelstep, buffer_offset ); -+ } -+ return TRUE; ++ //Main framebuffer should be registered as a hardware surface ++ ulong buffer_offset; ++ if ( !qt_screen->onCard( this->buffer, buffer_offset ) ) { ++ return FALSE; ++ } ++ int pixelstep = ( this->linestep() * 8 ) / depth; ++ W100_SetDstPitchOffset( pixelstep, buffer_offset ); ++ if ( setsrc ) { ++ W100_SetSrcPitchOffset( pixelstep, buffer_offset ); ++ } ++ return TRUE; +} + +template<const int depth,const int type> +void QGfxW100<depth,type>::drawLine( int x1, int y1, int x2, int y2 ) +{ -+ // No point going any further if the window isn't visible -+ if( this->ncliprect < 1 ) { -+ return; -+ } -+ -+ if ( !control.accelerated( W100Control::DRAWLINE ) ) { -+ control.addMiss( W100Control::DRAWLINE ); -+ QGfxRaster<depth,type>::drawLine( x1, y1, x2, y2 ); -+ return; -+ } -+ -+ // Only handle 'normal' lines -+ if ( ( this->cpen.style() != this->SolidLine ) || -+ ( this->myrop != this->CopyROP ) || -+ ( this->cpen.width() > 1 ) || -+ ( this->dashedLines ) ) { -+ control.addMiss( W100Control::DRAWLINE ); -+ QGfxRaster<depth,type>::drawLine(x1,y1,x2,y2); -+ return; -+ } -+ -+ // Stop anyone else trying to access optype/lastop/the graphics engine -+ // to avoid synchronization problems with other processes -+ QWSDisplay::grab( TRUE ); -+ if ( !checkDest() ) { -+ QWSDisplay::ungrab(); -+ control.addMiss( W100Control::DRAWLINE ); -+ QGfxRaster<depth,type>::drawLine( x1, y1, x2, y2); -+ return; -+ } -+ -+ // Note that the last operation used the 2d engine -+ ( *optype ) = 1; -+ -+ -+ -+ // Add the offset of the gfx - used to make the origin the right -+ // place for windows -+ x1 = x1 + this->xoffs; -+ y1 = y1 + this->yoffs; -+ x2 = x2 + this->xoffs; -+ y2 = y2 + this->yoffs; -+ -+ // Only cope with lines going from left to right -+ // - swap them round if this isn't TRUE -+ if ( x1 > x2 ) { -+ int x3 = x2; -+ int y3 = y2; -+ x2 = x1; -+ y2 = y1; -+ x1 = x3; -+ y1 = y3; -+ } -+ -+ GFX_START( QRect( x1, -+ y1 < y2 ? y1 : y2, -+ ( x2 - x1 + 1 ), -+ QABS( y2 - y1 ) + 1 ) ); -+ -+ // The clip region is defined as a series of rectangles -+ // We repeatedly set up the hardware clip rectangle to one of -+ // these rectangles and re-draw the line - an alternative approach -+ // would be to clip to the rectangle in software ++ if ( inDraw ) { ++ dDrawLine( x1, y1, x2, y2 ); ++ } else { ++ inDraw = true; ++ dDrawLine( tx(x1,y1), ty(x1,y1), ++ tx(x2,y2), ty(x2,y2) ); ++ inDraw = false; ++ } ++} ++ ++template<const int depth,const int type> ++void QGfxW100<depth,type>::dDrawLine( int x1, int y1, int x2, int y2 ) ++{ ++ // No point going any further if the window isn't visible ++ if( this->ncliprect < 1 ) { ++ return; ++ } ++ ++ if ( !control.accelerated( W100Control::DRAWLINE ) ) { ++ control.addMiss( W100Control::DRAWLINE ); ++ QGfxRaster<depth,type>::drawLine( x1, y1, x2, y2 ); ++ return; ++ } ++ ++ // Only handle 'normal' lines ++ if ( ( this->cpen.style() != this->SolidLine ) || ++ ( this->myrop != this->CopyROP ) || ++ ( this->cpen.width() > 1 ) || ++ ( this->dashedLines ) ) { ++ control.addMiss( W100Control::DRAWLINE ); ++ QGfxRaster<depth,type>::drawLine( x1, y1, x2, y2); ++ return; ++ } ++ ++ // Stop anyone else trying to access optype/lastop/the graphics engine ++ // to avoid synchronization problems with other processes ++ QWSDisplay::grab( true ); ++ if ( !checkDest() ) { ++ QWSDisplay::ungrab(); ++ control.addMiss( W100Control::DRAWLINE ); ++ QGfxRaster<depth,type>::drawLine( x1, y1, x2, y2 ); ++ return; ++ } ++ ++ // Note that the last operation used the 2d engine ++ ( *optype ) = 1; ++ ++ ++ ++ // Add the offset of the gfx - used to make the origin the right ++ // place for windows ++ x1 += this->xoffs; ++ y1 += this->yoffs; ++ x2 += this->xoffs; ++ y2 += this->yoffs; ++ ++ // Only cope with lines going from left to right ++ // - swap them round if this isn't TRUE ++ if ( x1 > x2 ) { ++ int x3 = x2; ++ int y3 = y2; ++ x2 = x1; ++ y2 = y1; ++ x1 = x3; ++ y1 = y3; ++ } ++ ++ GFX_START( QRect( x1, ++ y1 < y2 ? y1 : y2, ++ ( x2 - x1 + 1 ), ++ QABS( y2 - y1 ) + 1 ) ); ++ ++ // The clip region is defined as a series of rectangles ++ // We repeatedly set up the |
