1 ATI IMAGEON (W100) Accelerated support
2 Manuel Teira <manuel.teira@telefonica.net>
5 # Patch managed by http://www.holgerschurig.de/patcher.html
8 --- qt-2.3.10/configure~w100
9 +++ qt-2.3.10/configure
22 QT_CXX="$QT_CXX -DQT_NO_QWS_MATROX"
24 +if [ -z "$QWS_ACCEL_W100" -a -n "$EMB" ]
26 + QT_CXX="$QT_CXX -DQT_NO_QWS_W100"
28 if [ -z "$QWS_VNC" -a -n "$EMB" ]
30 QT_CXX="$QT_CXX -DQT_NO_QWS_VNC"
32 -accel-voodoo3 ..... Enable Voodoo3 acceleration.
33 -accel-mach64 ...... Enable Mach64 acceleration.
34 -accel-matrox ...... Enable Matrox MGA acceleration.
35 + -accel-w100 ........ Enable ATI Imageon w100 acceleration (experimental).
36 -qvfb .............. Enable X11-based Qt Virtual Frame Buffer.
37 -vnc ............... Enable VNC server (requires network module).
40 [ "x$JPEG" = "xyes" ] && QT_LIBS="${QT_LIBS} -ljpeg"
41 [ "x$MNG" = "xyes" ] && QT_LIBS="${QT_LIBS} -lmng -ljpeg" # assume JNG support
42 [ "x$NAS_SOUND" = "xyes" ] && QT_LIBS="${QT_LIBS} -laudio -lXt" # Xt junk in audio library
43 +[ "x$QWS_ACCEL_W100" = "xy" ] && QT_LIBS="${QT_LIBS} -laticore" # Aticore W100 support
44 QT_LIBS="$L_FLAGS $R_FLAGS $QT_LIBS $l_FLAGS"
47 --- qt-2.3.10/src/kernel/qgfxraster_qws.cpp~w100
48 +++ qt-2.3.10/src/kernel/qgfxraster_qws.cpp
52 // Bresenham algorithm from Graphics Gems
57 @@ -5945,6 +5944,10 @@
58 # include "qgfxmatrox_qws.cpp"
61 +#if !defined(QT_NO_QWS_W100)
62 +# include "qgfxw100_qws.cpp"
65 #if !defined(QT_NO_QWS_VFB)
66 # include "qgfxvfb_qws.cpp"
69 #if !defined(QT_NO_QWS_MATROX)
70 { "Matrox", qt_get_screen_matrox, 1 },
72 +#if !defined(QT_NO_QWS_W100)
73 + { "W100", qt_get_screen_w100, 1 },
75 #if !defined(QT_NO_QWS_TRANSFORMED)
76 { "Transformed", qt_get_screen_transformed, 0 },
79 qt_screen = driverTable[i].qt_get_screen( display_id );
81 if ( qt_screen->connect( spec ) ) {
82 + printf( "[%d]:Connected to screen '%s'\n",
83 + getpid(), driverTable[i].name );
88 +++ qt-2.3.10/src/3rdparty/kernel/aticore/aticore.h
91 + * AtiCore 2D acceleration API
95 +#include <inttypes.h>
96 +#include <sys/types.h>
98 +#ifndef __W100API_H__
99 +#define __W100API_H__
105 +#define SolidRop_GXclear 0x00 /* 0 */
106 +#define SolidRop_GXand 0xa0 /* src AND dst */
107 +#define SolidRop_GXandReverse 0x50 /* src AND NOT dst */
108 +#define SolidRop_GXcopy 0xf0 /* src */
109 +#define SolidRop_GXandInverted 0x0a /* NOT src AND dst */
110 +#define SolidRop_GXnoop 0xaa /* dst */
111 +#define SolidRop_GXxor 0x5a /* src XOR dst */
112 +#define SolidRop_GXor 0xfa /* src OR dst */
113 +#define SolidRop_GXnor 0x05 /* NOT src AND NOT dst */
114 +#define SolidRop_GXequiv 0xa5 /* NOT src XOR dst */
115 +#define SolidRop_GXinvert 0x55 /* NOT dst */
116 +#define SolidRop_GXorReverse 0xf5 /* src OR NOT dst */
117 +#define SolidRop_GXcopyInverted 0x0f /* NOT src */
118 +#define SolidRop_GXorInverted 0xaf /* NOT src OR dst */
119 +#define SolidRop_GXnand 0x5f /* NOT src OR NOT dst */
120 +#define SolidRop_GXset 0xff /* 1 */
122 +#define BltRop_GXclear 0x00 /* 0 */
123 +#define BltRop_GXand 0x88 /* src AND dst */
124 +#define BltRop_GXandReverse 0x44 /* src AND NOT dst */
125 +#define BltRop_GXcopy 0xcc /* src */
126 +#define BltRop_GXandInverted 0x22 /* NOT src AND dst */
127 +#define BltRop_GXnoop 0xaa /* dst */
128 +#define BltRop_GXxor 0x66 /* src XOR dst */
129 +#define BltRop_GXor 0xee /* src OR dst */
130 +#define BltRop_GXnor 0x11 /* NOT src AND NOT dst */
131 +#define BltRop_GXequiv 0x99 /* NOT src XOR dst */
132 +#define BltRop_GXinvert 0x55 /* NOT dst */
133 +#define BltRop_GXorReverse 0xdd /* src OR NOT dst */
134 +#define BltRop_GXcopyInverted 0x33 /* NOT src */
135 +#define BltRop_GXorInverted 0xbb /* NOT src OR dst */
136 +#define BltRop_GXnand 0x77 /* NOT src OR NOT dst */
137 +#define BltRop_GXset 0xff /* 1 */
139 +#define DSTTYPE_8BPP 2 //8bpp
140 +#define DSTTYPE_16BPP_1555 3 //16 bpp aRGB 1555
141 +#define DSTTYPE_16BPP_444 5 //16 bpp aRGB 4444
143 +#define SRCTYPE_1BPP_OPA 0 //mono (expanded to frgd, bkgd)
144 +#define SRCTYPE_1BPP_TRA 1 //mono (expanded to frgd, leave_alone)
145 +#define SRCTYPE_EQU_DST 3 //color (same as DST)
146 +#define SRCTYPE_SOLID_COLOR_BLT 4 //solid color for Blt (use frgd)
147 +#define SRCTYPE_4BPP 5 //4 bpp
148 +#define SRCTYPE_12BPP_PACKED 6 //12 bpp packed
150 +#define ROP3_SRCCOPY 0xcc
151 +#define ROP3_PATCOPY 0xf0
153 +#define OVLTYPE_YUV420 7
154 +#define OVLTYPE_RGB565 8
156 +#define DP_BRUSH_8x8MONOOPA 0 //8x8 mono pattern (expanded to frgd, bkgd )
157 +#define DP_BRUSH_8x8MONOTRA 1 //8x8 mono pattern (expanded to frgd, leave alone )
158 +#define DP_PEN_32x1MONOOPA 6 //32x1 mono pattern (expanded to frgd, bkgd)
159 +#define DP_PEN_32x1MONOTRA 7 //32x1 mono pattern (expanded to frgd, leave alone)
160 +#define DP_BRUSH_8x8COLOR 10 //8x8 color pattern
161 +#define DP_BRUSH_SOLIDCOLOR 13 //solid color pattern (frgd)
162 +#define DB_BRUSH_NONE 15 //No brush used
177 + int16_t X_Top_Left; // x coordinate of top left corner
178 + int16_t Y_Top_Left; // y coordinate of top left corner
179 + int16_t X_Bottom_Right; // x coordinate of bottom right corner
180 + int16_t Y_Bottom_Right; // y coordinate of bottom right corner
185 + uint8_t ScaleXFactor;
186 + uint8_t ScaleYFactor;
192 + uint32_t *lpSrcBitmap; /* ¥µ¡¼¥Õ¥§¥¹¤Î¥ª¥Õ¥»¥Ã¥È */
193 + uint16_t XCoord; /* +4 ³ÎÄê:¥µ¡¼¥Õ¥§¥¹Æâ¤ÎxºÂɸ */
194 + uint16_t YCoord; /* +6 ³ÎÄê:¥µ¡¼¥Õ¥§¥¹Æâ¤ÎyºÂɸ */
195 + uint16_t SrcPitch; /* +8 ³ÎÄê: */
196 + uint16_t SrcHeight; /* +10 ³ÎÄê: */
197 + uint16_t OverlayWidth; /* ¥ª¡¼¥Ð¥ì¥¤¤ÎÉý(Src¤È°ã¤¦Ãͤˤ·¤Æ¤â¡¢Æ°Åª¤Ë³ÈÂç½Ì¾®¤µ¤ì¤¿¤ê¤Ï¤·¤Ê¤¤¡¢°ÕÌ£¤¢¤ó¤Î¡©) */
198 + uint16_t OverlayHeight;
199 + uint32_t lpOverlayKey; /* +16 ³ÎÄê:Ææ(¥«¥é¡¼¥¡¼¡©) */
200 + uint8_t OverlayFormat; /* +20 ³ÎÄê */
203 + } ATI_OVERLAYPROP; /* 24bytes? */
208 + } ATI_EXTVIDEOPROP;
211 + ATI_EXTVIDEOPROP ExtVideoProp;
215 + unsigned long clr_cmp_fcn_src :3;
217 + unsigned long clr_cmp_fcn_dst :3;
219 + unsigned long clr_cmp_src :2;
228 + clr_cmp_cntl_t cmp_cntl;
229 + unsigned long tcolour;
235 + uint8_t HExpansion; /* +8 ³ÎÄê */
236 + uint8_t VExpansion; /* +9 ³ÎÄê */
239 + uint8_t RConversion; /* +12 ³ÎÄê */
244 + } ATI_EXTENDEDOVERLAYPROP; /* 16byte? */
247 + * AtiCore initialization.
248 + * Sets up the shared memory area
249 + * @return 1:success, 0:fail
251 + int AtiCore_ProcessAttach( void );
256 + * @return 1:success, 0:fail
258 + int AtiCore_ProcessDetach( void );
262 + * Allocates a surface on the internal RAM.
263 + * Perhaps there's a way to indicate to allocate on the
265 + * @arg handle Reference to the returned surface handle
266 + * @arg offset Returned offset of this surface on the video memory
267 + * @arg size Size (bytes) to be reserved (16 multiple)
269 + * @return 1:success, 0:fail
271 + int AtiCore_AllocateSurface( uint16_t *handle, uint32_t *offset,
272 + uint32_t size, uint32_t direction );
275 + * Deallocates a given surface.
276 + * @arg handle Handle to the allocated surface
277 + * (As returned by AllocateSurface)
278 + * @return 1:success, 0:fail
280 + int AtiCore_DestroySurface( uint16_t handle );
283 + * Sets the kind of Raster Operation.
284 + * @param rop Raster operation to be performed
285 + * @return 1:success, 0:fail
287 + int AtiCore_SetRopOperation( uint32_t rop );
290 + * Sets the destination type for raster operation.
292 + * @return 1:success, 0:fail
294 + int AtiCore_SetDstType( uint32_t dsttype );
297 + * Sets the source type for raster operation.
299 + * @return 1:success, 0:fail
301 + int AtiCore_SetSrcType( uint32_t srctype );
304 + * Sets Source clipping rectangle.
305 + * @param cliprect Rectangle to perform clipping.
306 + * @return 1:success, 0:fail
308 + int AtiCore_SetSrcClippingRect( ATI_CLIPRECT *cliprect );
311 + * Sets Destination clipping rectangle.
312 + * @param cliprect Rectangle to perform clipping.
313 + * @return 1:success, 0:fail
315 + int AtiCore_SetDstClippingRect(ATI_CLIPRECT *cliprect);
318 + * Sets pitch and offset for source in a raster operation.
319 + * @param pitch Pitch (line width) of source
320 + * @param offset Offset of source
321 + * @return 1:success, 0:fail
323 + int AtiCore_SetSrcPitchOffset( int pitch, int offset );
326 + * Sets pitch and offset destination source in a raster operation.
327 + * @param pitch Pitch (line width) of destination
328 + * @param offset Offset of destination (memory offset)
329 + * @return 1:success, 0:fail
331 + int AtiCore_SetDstPitchOffset( int pitch, int offset );
334 + * Performs a BitBlt with source rotation.
335 + * @param flags Rotation degree
336 + * @param dstRect Rectangle for destination Bitblitting
337 + * @param srcRect Rectangle for origin bitblitting
338 + * @test Tested with specified flags parameter
340 + int AtiCore_BitBltFilpRotate( int flags,
342 + ATI_RECT *srcRect);
345 + * Performs a BitBlt with source stretching.
346 + * @param option Unknown
347 + * @param point Unknown
348 + * @param srcRect Source blitting surface
351 + int AtiCore_StretchBlt( ATI_STRETCH *option,
353 + ATI_RECT *srcRect);
356 + * Waits for the FIFO to be idle at least msecs.
357 + * @param msecs Maximum time to wait for FIFO to idle
358 + * @return 1:success, 0:fail
361 + int AtiCore_WaitComplete( int msec );
364 + * Allocates a new overlay handle.
365 + * @param handle overlay
366 + * @return 1:success, 0:fail
369 + int AtiCore_AllocOverlay( uint16_t *handle );
372 + * Deallocates a overlay handle.
373 + * @param handle overlay
374 + * @return 1:success, 0:fail
377 + int AtiCore_ReleaseOverlay( uint16_t handle );
380 + * Sets up an overlay given a handle an a set of properties.
381 + * @param handle Allocated handle to setup the overlay.
382 + * @param props Overlay properties struct
383 + * @return 1:success, 0:fail
385 + int AtiCore_SetupOverlay( uint16_t handle, ATI_OVERLAYPROP *props );
388 + * Sets up extended overlay features.
389 + * @param handle Allocated handle to an overlay
390 + * @param props Extended overlay properties
391 + * @return 1:success, 0:fail
393 + int AtiCore_SetupOverlayExtended( uint16_t handle,
394 + ATI_EXTENDEDOVERLAYPROP *props );
397 + * Enable/Disable an overlayed surface.
398 + * @param handle Overlay to be enabled/disabled
399 + * @param enable 1: Enable, 0: Disable
400 + * @return 1:success, 0:fail
403 + int AtiCore_SetOverlayOnOff( uint16_t handle, int enable );
406 + * Sets up the overlay position for a given handle.
407 + * @param handle Overlay Handle
408 + * @param x X Coordinate (Seems to be a bug with x < 4 )
409 + * @param y Y Coordinate
410 + * @return 1:success, 0:fail
412 + int AtiCore_SetOverlayPos( uint16_t handle,
417 + * Translates between physical/virtual addresses.
418 + * @param offset VRAM offset to be translated
419 + * @param viraddr Virtual address for VRAM
420 + * @return 1:success,0:fail
422 + int AtiCore_SetupMemoryTransfer( uint32_t offset,
423 + uint32_t *viraddr );
426 + * Related with the previous one. It seems to be necesary to be called
427 + * but I'm not sure of its function.
428 + * @return 1:success, 0:fail
430 + int AtiCore_TerminateMemoryTransfer( void );
433 + * Returns the frontbuffer pitch and offset.
434 + * @param pitch Return value for the frontbuffer pitch (width)
435 + * @param offset Return value for the frontbuffer offset
436 + * @return 1:success, 0:fail
438 + int AtiCore_GetFrontBufferPitchOffset( uint32_t *pitch,
439 + uint32_t *offset );
442 + * Changes display brighness ?
443 + * @param brightness -64...63
444 + * @return 1:success, 0:fail
446 + int AtiCore_SetDisplayBrightness( int brightness );
449 + * Returns the amount of available internal/external memory.
450 + * @param internal Pointer to return internal memory size
451 + * @param external Pointer to return external memory size
452 + * @return 1:success, 0:fail
454 + int GetAvailableVideoMem( uint32_t *internal,
455 + uint32_t *external );
478 + } ATI_GRAPHICWINDOW;
480 + int AtiCore_SetupGraphicWindow(void* );
483 + * It seems to be necessary after AtiCore_ProcessAttach
484 + * @param mode: 0xaaab for portrait, 0xaaaa for landscape
485 + * @return 1:success, 0:fail
487 + int AtiCore_ProcessAttachSpecialMode( int mode );
490 + * Detach from the special mode. Whatever it means.
491 + * @return 1:success, 0:fail
493 + int AtiCore_ProcessDetachSpecialMode( void );
496 + * Sets up the position of the Graphic viewport ?
497 + * @param x X coordinate
498 + * @param y Y coordinate
499 + * @return 1:success, 0:fail
501 + int AtiCore_SetGraphicWindowPos( int x, int y );
504 + * Get the graphic viewport position.
505 + * @param x Pointer to xcoord placeholder
506 + * @param y Pointer to ycoord placeholder
507 + * @return 1:success, 0:fail
509 + int AtiCore_GetGraphicWindowPos( int *x, int *y );
512 + * Sets up the frontbuffer position.
513 + * @param offset VRAM offset to be used.
514 + * @param x X Coordinate?
515 + * @param y Y Coordinate?
516 + * @return 1:success, 0:fail
518 + int AtiCore_SetFrontBuffer( int offset, int x, int y );
521 + * Enable/Disable the frontbuffer?
522 + * @param enable 1 enables/ 0 disables
523 + * @return 1:success, 0:fail
525 + int AtiCore_SetGraphicWindowOnOff( int enable );
528 + * Sets the foreground color.
529 + * @param colour Color in 565 format (perhaps depends on the source format)
530 + * @return 1:success, 0:fail
532 + int AtiCore_SetFrgColour( int colour );
535 + * Sets the background colour.
536 + * @param colour Colour in 565 format (perhaps depends on the source format)
537 + * @return 1:success, 0:fail
539 + int AtiCore_SetBkgColour( int colour );
542 + * Changes the painting brush
543 + * @param btype Type of brush to use
544 + * 4: Uses the pattern
546 + * @param pattern Pointer to a 32 bit pattern
547 + * @return 1:success, 0:fail
548 + * @test Some values for btype produces a kind of antialiasing line
550 + int AtiCore_BrushType( int btype, unsigned int *pattern );
553 + * Performs a rectangle paint.
554 + * @param nrects Number of rectangles to be painted
555 + * @param rects Array of rectangles to be painted
556 + * @return 1:success, 0:fail
557 + * @test Tested with nrects==1
559 + int AtiCore_PaintRect( int nrects ,
560 + ATI_RECT rects[] );
563 + * Draws a set of lines.
564 + * @param npoints Number of points in the polyline set
565 + * @param points Pointer to an array of ATI_POINT
566 + * @return 1:success, 0:fail
568 + int AtiCore_Polyline( int npoints, ATI_POINT points[] );
570 + int AtiCore_GetPitchOffsetProperty( void *, void *);
572 + int AtiCore_CursorOnOff( int, int );
575 + * Performs a BitBlt ROP operation.
576 + * @param unk Unknown (Always set to 1)
577 + * @param dstrect Bounding destination rect
578 + * @param srcrect Bounding source rect
579 + * @return 1:success, 0:fail
581 + int AtiCore_BitBlt( int unk,
583 + ATI_RECT *srcrect );
586 + * Performs a Transparent BitBlt ROP operation.
587 + * @param dstrect Transparent DstRect bitblt argument
588 + * @param srcrect Transparent SrcRect bitblt argument
589 + * @return 1:success, 0:fail
590 + * @test Doesn't work. It sets to zero CLR_CMP_CNTL and CLR_CMP_MSK
592 + int AtiCore_TransBitBlt( transbitblt_t *dstrect,
593 + transbitblt_t *srcrect );
595 + int AtiCore_WakeUpCall( void );
598 + * Draws a set of pixels
599 + * @param npoints Number of points to draw
600 + * @param points Pointer to an array of ATI_POINT
601 + * @return 1:success, 0:fail
603 + int AtiCore_DrawPixel( int npoints, ATI_POINT *points );
605 + int AtiCore_SetSysClk( unsigned short in0 );
606 + int AtiCore_SetFastSysClk( unsigned short in0 );
607 + int AtiCore_SetSlowSysClk( unsigned short in0 );
609 + int AtiCore_GetCursorPos( unsigned long in0,
611 + unsigned short *y );
615 +/* ================================================================ */
616 +/* from libqte.so.2.3.2 */
621 +AtiCore_GammaCorrection
623 +AtiCore_GetCursorPos
624 +AtiCore_GetDeviceInfo
625 +AtiCore_GetGPIO_Data
626 +AtiCore_GetGraphicExtended
627 +AtiCore_GetGraphicWindowPos
628 +AtiCore_GetLargestVideoMemBlock
629 +AtiCore_GetLastError
631 +AtiCore_GetOverlayPos
633 +AtiCore_LoadCursorBitMap
634 +AtiCore_PolyScanline
635 +AtiCore_ProcessAttachMinimal(void)?
636 +AtiCore_ProcessDetachMinimal(void)?
637 +AtiCore_ProcessDetachSpecialMode
639 +AtiCore_ReadMem(int, int)?
640 +AtiCore_ReadReg(int, int)?
641 +AtiCore_ScanlineShading
642 +AtiCore_SetApertures
643 +AtiCore_SetBytePixelOrder
644 +AtiCore_SetCursorPos
645 +AtiCore_SetDisplayParameters
646 +AtiCore_SetDriverBehaviour
647 +AtiCore_SetGPIO_Data
648 +AtiCore_SetOverlayPosUsingGraphicWindowXY
649 +AtiCore_SetPartialCursor
650 +AtiCore_SetupGraphicExtended
653 +AtiCore_SubmitPM4Packet
665 +++ qt-2.3.10/src/kernel/qgfxw100_qws.cpp
667 + /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil -*- */
668 +/***************************************************************************
670 +** Imageon driver for qte using libAticore
671 +** Manuel Teira( 2005 )
673 +* - Enable again internal memory surfaces.
674 +****************************************************************************/
682 +#include <sys/types.h>
683 +#include <sys/mman.h>
684 +#include <sys/time.h>
687 +#include <sys/ipc.h>
688 +#include <sys/shm.h>
690 +#include <qapplication.h>
696 +#include "qgfxraster_qws.h"
697 +#include "qgfxlinuxfb_qws.h"
698 +#include <aticore/aticore.h>
705 + typedef enum Loglevel {
711 + typedef enum Opcodes {
722 + typedef enum Retcodes {
728 + typedef struct Opcode {
736 + static Opcode lOpcodes[];
738 + static QString level2str( int level )
742 + return QString( "ERROR" );
745 + return QString( "WARNING" );
748 + return QString( "INFO" );
751 + return QString( "UNKNOWN" );
760 + m_attached( false )
765 + if ( var = getenv( "W100_DEBUG" ) ) {
766 + if ( strtol( var, 0, 0 ) == 1 ) {
771 + if ( m_logenabled ) {
772 + if ( var = getenv( "W100_DEBUGLEVEL" ) ) {
773 + if ( ( m_loglevel = strtol( var, 0, 0 ) ) < 0 ) {
778 + QString path( "/mnt/card/w100/w100debug.log" );
779 + if ( var = getenv( "W100_DEBUGPATH" ) ) {
780 + path = QString( var ) + "/w100debug.log";
782 + m_logfile = fopen( path.latin1(), "a" );
783 + if ( m_logfile == NULL ) m_logenabled = 0;
786 + Opcode *opcodePtr = lOpcodes;
787 + while ( opcodePtr->index != EOO ) {
788 + QString varName = "W100_ACCEL_" + opcodePtr->str;
790 + if ( ( varPtr = getenv( varName.latin1() ) ) ) {
791 + if ( ( strtol( varPtr, NULL, 0 ) == 0 ) ||
792 + ( strcmp( varPtr, "false" ) == 0 ) ) {
793 + opcodePtr->accelerated = false;
802 + //Dump statistics about any opcode
803 + Opcode *opcodePtr = lOpcodes;
804 + while ( opcodePtr->index != EOO ) {
805 + log( WARNING, "Opcode %s. Accelerated=%s. Hits=%d. Misses=%d",
806 + opcodePtr->str.latin1(),
807 + opcodePtr->accelerated ? "true" : "false",
809 + opcodePtr->misses );
812 + if ( m_logenabled && m_logfile ) {
813 + fclose( m_logfile );
817 + bool accelerated( int opcode )
819 + if ( !m_attached ) {
820 + log( WARNING, "Asking for accelerated '%s' when not attached",
821 + lOpcodes[opcode].str.latin1() );
824 + if ( opcode < EOO ) {
825 + if ( lOpcodes[opcode].accelerated ) {
828 + log( WARNING, "Not accelerated '%s'",
829 + lOpcodes[opcode].str.latin1() );
836 + void addHit( int opcode )
838 + lOpcodes[opcode].hits++;
841 + void addMiss( int opcode )
843 + lOpcodes[opcode].misses++;
846 + void log( int level, const char *fmt, ... )
848 + if ( m_logenabled && ( level <= m_loglevel ) ) {
852 + va_start( ap, fmt );
853 + vsnprintf( buffer, 1023, fmt, ap );
855 + gettimeofday( &tv, NULL );
856 + fprintf( m_logfile, "(%010u.%06u)%d:%d:%s:%s\n",
857 + tv.tv_sec, tv.tv_usec,
860 + level2str( level ).latin1(),
862 + fflush( m_logfile );
866 + bool attached( void ) const
871 + int processAttach( void )
873 + if ( !m_attached ) {
874 + if ( AtiCore_ProcessAttach() ) {
875 + log( WARNING, "Process attached succesfully" );
879 + log( WARNING, "Error attaching process" );
882 + log( WARNING, "Process already attached" );
887 + int processDetach( void )
889 + if ( m_attached ) {
890 + if ( AtiCore_ProcessDetach() ) {
891 + log( WARNING, "Process detached succesfully" );
892 + m_attached = false;
895 + log( WARNING, "Error detaching process" );
898 + log( WARNING, "Trying to detach while not attached" );
903 + int allocateSurface( uint16_t *handle, uint32_t *offset,
904 + uint32_t size, uint32_t direction )
906 + if ( m_attached ) {
907 + if ( AtiCore_AllocateSurface( handle, offset,
908 + size, direction ) ) {
911 + log( ERROR, "Error in allocateSurface" );
914 + log( WARNING, "Trying to allocateSurface while not attached" );
919 + int destroySurface( uint16_t handle )
921 + if ( m_attached ) {
922 + if ( AtiCore_DestroySurface( handle ) ) {
925 + log( ERROR, "Error in destroySurface" );
928 + log( WARNING, "Trying to destroySurface while not attached" );
933 + int drawPixel( int npoints, ATI_POINT *points )
935 + if ( m_attached ) {
936 + if ( AtiCore_DrawPixel( npoints, points ) ) {
939 + log( ERROR, "Error in drawPixel" );
942 + log( WARNING, "Trying to drawPixel while not attached" );
947 + int setRopOperation( uint32_t rop )
949 + if ( m_attached ) {
950 + if ( AtiCore_SetRopOperation( rop ) ) {
953 + log( ERROR, "Error in setRopOperation" );
956 + log( WARNING, "Trying to setRopOperation while not attached" );
961 + int setDstType( uint32_t dtype )
963 + if ( m_attached ) {
964 + if ( AtiCore_SetDstType( dtype ) ) {
967 + log( ERROR, "Error in setDstType" );
970 + log( WARNING, "Trying to setDstType while not attached" );
975 + int setSrcType( uint32_t stype )
977 + if ( m_attached ) {
978 + if ( AtiCore_SetSrcType( stype ) ) {
981 + log( ERROR, "Error in setSrcType" );
984 + log( WARNING, "Trying to setSrcType while not attached" );
989 + int setSrcClippingRect( ATI_CLIPRECT *cliprect )
991 + if ( m_attached ) {
992 + if ( AtiCore_SetSrcClippingRect( cliprect ) ) {
995 + log( ERROR, "Error in setSrcClippingRect" );
998 + log( WARNING, "Trying to setSrcClippingRect while not attached" );
1003 + int setDstClippingRect( ATI_CLIPRECT *cliprect )
1005 + if ( m_attached ) {
1006 + if ( AtiCore_SetDstClippingRect( cliprect ) ) {
1009 + log( ERROR, "Error in setDstClippingRect" );
1012 + log( WARNING, "Trying to setDstClippingRect while not attached" );
1017 + int setSrcPitchOffset( int pitch, int offset )
1019 + if ( m_attached ) {
1020 + if ( AtiCore_SetSrcPitchOffset( pitch, offset ) ) {
1023 + log( ERROR, "Error in setSrcPitchOffset" );
1026 + log( WARNING, "Trying to setSrcPitchOffset while not attached" );
1031 + int setDstPitchOffset( int pitch, int offset )
1033 + if ( m_attached ) {
1034 + if ( AtiCore_SetDstPitchOffset( pitch, offset ) ) {
1037 + log( ERROR, "Error in setDstPitchOffset" );
1040 + log( WARNING, "Trying to setDstPitchOffset while not attached" );
1045 + int bitBltFlipRotate( int rot,
1046 + ATI_RECT *dstRect,
1047 + ATI_RECT *srcRect )
1049 + if ( m_attached ) {
1050 + if ( AtiCore_BitBltFilpRotate( rot, dstRect, srcRect ) ) {
1053 + log( ERROR, "Error in bitBltFlipRotate" );
1056 + log( WARNING, "Trying to bitBltFlipRotate while not attached" );
1061 + int stretchBlt( ATI_STRETCH *option,
1063 + ATI_RECT *srcRect )
1065 + if ( m_attached ) {
1066 + if ( AtiCore_StretchBlt( option, point, srcRect ) ) {
1069 + log( ERROR, "Error in stretchBlt" );
1072 + log( WARNING, "Trying to stretchBlt while not attached" );
1077 + int waitComplete( int msec )
1079 + if ( m_attached ) {
1080 + if ( AtiCore_WaitComplete( msec ) ) {
1083 + log( ERROR, "Error in waitComplete" );
1086 + log( WARNING, "Trying to waitComplete while not attached" );
1091 + int allocOverlay( uint16_t *handle )
1093 + if ( m_attached ) {
1094 + if ( AtiCore_AllocOverlay( handle ) ) {
1097 + log( ERROR, "Error in allocOverlay" );
1100 + log( WARNING, "Trying to allocOverlay while not attached" );
1105 + int releaseOverlay( uint16_t handle )
1107 + if ( m_attached ) {
1108 + if ( AtiCore_ReleaseOverlay( handle ) ) {
1111 + log( ERROR, "Error in releaseOverlay" );
1114 + log( WARNING, "Trying to releaseOverlay while not attached" );
1119 + int setupOverlay( uint16_t handle, ATI_OVERLAYPROP *prop )
1121 + if ( m_attached ) {
1122 + if ( AtiCore_SetupOverlay( handle, prop ) ) {
1125 + log( ERROR, "Error in setupOverlay" );
1128 + log( WARNING, "Trying to setupOverlay while not attached" );
1133 + int setupOverlayExtended( uint16_t handle,
1134 + ATI_EXTENDEDOVERLAYPROP *prop )
1136 + if ( m_attached ) {
1137 + if ( AtiCore_SetupOverlayExtended( handle, prop ) ) {
1140 + log( ERROR, "Error in setupOverlayExtended" );
1143 + log( WARNING, "Trying to setupOverlayExtended while not attached" );
1148 + int setOverlayOnOff( uint16_t handle, int isShow )
1150 + if ( m_attached ) {
1151 + if ( AtiCore_SetOverlayOnOff( handle, isShow ) ) {
1154 + log( ERROR, "Error in setOverlayOnOff" );
1157 + log( WARNING, "Trying to setOverlayOnOff while not attached" );
1162 + int setOverlayPos( uint16_t handle, uint16_t x, uint16_t y )
1164 + if ( m_attached ) {
1165 + if ( AtiCore_SetOverlayPos( handle, x, y ) ) {
1168 + log( ERROR, "Error in setOverlayPos" );
1171 + log( WARNING, "Trying to setOverlayPos while not attached" );
1176 + int setupMemoryTransfer( uint32_t offset, uint32_t *regdata )
1178 + if ( m_attached ) {
1179 + if ( AtiCore_SetupMemoryTransfer( offset, regdata ) ) {
1182 + log( ERROR, "Error in setupMemoryTransfer" );
1185 + log( WARNING, "Trying to setupMemoryTransfer while not attached" );
1190 + int terminateMemoryTransfer( void )
1192 + if ( m_attached ) {
1193 + if ( AtiCore_TerminateMemoryTransfer() ) {
1196 + log( ERROR, "Error in terminateMemoryTransfer" );
1199 + log( WARNING, "Trying to terminateMemoryTransfer while not attached" );
1204 + int getFrontBufferPitchOffset( uint32_t *pitch, uint32_t *offset )
1206 + if ( m_attached ) {
1207 + if ( AtiCore_GetFrontBufferPitchOffset( pitch, offset ) ) {
1210 + log( ERROR, "Error in getFrontBufferPitchOffset" );
1213 + log( WARNING, "Trying to getFrontBufferPitchOffset while not attached" );
1218 + int setDisplayBrightness( int bri )
1220 + if ( m_attached ) {
1221 + if ( AtiCore_SetDisplayBrightness( bri ) ) {
1224 + log( ERROR, "Error in setDisplayBrightness" );
1227 + log( WARNING, "Trying to setDisplayBrighness while not attached" );
1232 + int getAvailableVideoMem( uint32_t *internal, uint32_t *external )
1234 + if ( m_attached ) {
1235 + if ( GetAvailableVideoMem( internal, external ) ) {
1238 + log( ERROR, "Error in getAvailableVideoMem" );
1241 + log( WARNING, "Trying to getAvailableVideoMem while not attached" );
1246 + int setupGraphicWindow( ATI_GRAPHICWINDOW *win )
1248 + if ( m_attached ) {
1249 + if ( AtiCore_SetupGraphicWindow( ( void * ) win ) ) {
1252 + log( ERROR, "Error in setupGraphicWindow" );
1255 + log( WARNING, "Trying to setupGraphicWindow while not attached" );
1260 + int processAttachSpecialMode( int mode )
1262 + if ( m_attached ) {
1263 + if ( AtiCore_ProcessAttachSpecialMode( mode ) ) {
1266 + log( ERROR, "Error in processAttachSpecialMode" );
1269 + log( WARNING, "Trying to processAttachSpecialMode while not attached" );
1274 + int processDetachSpecialMode( void )
1276 + if ( m_attached ) {
1277 + if ( AtiCore_ProcessDetachSpecialMode() ) {
1280 + log( ERROR, "Error in processDetachSpecialMode" );
1283 + log( WARNING, "Trying to processDetachSpecialMode while not attached" );
1288 + int setGraphicWindowPos( int x, int y )
1290 + if ( m_attached ) {
1291 + if ( AtiCore_SetGraphicWindowPos( x, y ) ) {
1294 + log( ERROR, "Error in setGraphicWindowPos" );
1297 + log( WARNING, "Trying to setGraphicWindow while not attached" );
1302 + int setFrontBuffer( int offset, int a, int b )
1304 + if ( m_attached ) {
1305 + if ( AtiCore_SetFrontBuffer( offset, a, b ) ) {
1308 + log( ERROR, "Error in setFrontBuffer" );
1311 + log( WARNING, "Trying to setFrontBuffer while not attached" );
1316 + int setGraphicWindowOnOff( int val )
1318 + if ( m_attached ) {
1319 + if ( AtiCore_SetGraphicWindowOnOff( val ) ) {
1322 + log( ERROR, "Error in setGraphicWindowOnOff" );
1325 + log( WARNING, "Trying to setGraphicWindowOnOff while not attached" );
1329 + static unsigned long ccolor( unsigned int rgb )
1331 + unsigned char r = ( rgb & 0xff0000 ) >> 19;
1332 + unsigned char g = ( rgb & 0xff00 ) >> 10;
1333 + unsigned char b = ( rgb & 0xff ) >> 3;
1334 + return ( ( ( ( unsigned short )0x1f & r ) << 11 ) |
1335 + ( ( ( unsigned short )0x3f & g ) << 5 ) |
1336 + ( ( ( unsigned short )0x1f & b ) ) );
1339 + int setFrgColour( int val )
1341 + if ( m_attached ) {
1342 + if ( AtiCore_SetFrgColour( ccolor( val ) ) ) {
1345 + log( ERROR, "Error in setFrgColour" );
1348 + log( WARNING, "Trying to setFrgColour while not attached" );
1353 + int brushType( int type, unsigned int pattern )
1355 + if ( m_attached ) {
1356 + if ( AtiCore_BrushType( type, &pattern ) ) {
1359 + log( ERROR, "Error in brushType" );
1362 + log( WARNING, "Trying to brushType while not attached" );
1367 + int paintRect( int flags, ATI_RECT *rect )
1369 + if ( m_attached ) {
1370 + if ( AtiCore_PaintRect( flags, rect ) ) {
1373 + log( ERROR, "Error in paintRect" );
1376 + log( WARNING, "Trying to paintRect while not attached" );
1381 + int polyline( int npoints, ATI_POINT *points )
1383 + if ( m_attached ) {
1384 + if ( AtiCore_Polyline( npoints, points ) ) {
1387 + log( ERROR, "Error in polyline" );
1390 + log( WARNING, "Trying to polyline while not attached" );
1395 + int getPitchOffsetProperty( void *pitch, void *offset )
1397 + if ( m_attached ) {
1398 + if ( AtiCore_GetPitchOffsetProperty( pitch, offset ) ) {
1401 + log( ERROR, "Error in getPitchOffsetProperty" );
1404 + log( WARNING, "Trying to getPitchOffsetProperty while not attached" );
1409 + int cursorOnOff( int a, int b )
1411 + if ( m_attached ) {
1412 + if ( AtiCore_CursorOnOff( a, b ) ) {
1415 + log( ERROR, "Error in cursorOnOff" );
1418 + log( WARNING, "Trying to cursorOnOff while not attached" );
1423 + int bitBlt( int flags, ATI_RECT *dst, ATI_RECT *src )
1425 + if ( m_attached ) {
1426 + if ( AtiCore_BitBlt( flags, dst, src ) ) {
1429 + log( ERROR, "Error in bitBlt" );
1432 + log( WARNING, "Trying to bitBlt while not attached" );
1437 + int wakeUpCall( void )
1439 + if ( m_attached ) {
1440 + if ( AtiCore_WakeUpCall() ) {
1443 + log( ERROR, "Error in wakeUpCall" );
1446 + log( WARNING, "Trying to wakeupCall while not attached" );
1454 + bool m_logenabled;
1460 +W100Driver::Opcode W100Driver::lOpcodes[] = {
1461 + { "DRAWLINE", W100Driver::DRAWLINE, true, 0, 0 },
1462 + { "DRAWPOINT", W100Driver::DRAWPOINT, true, 0, 0 },
1463 + { "DRAWPOINTS", W100Driver::DRAWPOINTS, true, 0, 0 },
1464 + { "FILLRECT", W100Driver::FILLRECT, true, 0, 0 },
1465 + { "SCROLL", W100Driver::SCROLL, true, 0, 0 },
1466 + { "BITBLT", W100Driver::BITBLT, true, 0, 0 },
1467 + { "POLYLINE", W100Driver::POLYLINE, true, 0, 0 },
1468 + { "" , W100Driver::EOO, false, 0, 0 }
1474 +static QW100Screen *qt_w100_screen = 0;
1476 +class QW100Screen : public QLinuxFbScreen {
1480 + HWSurface( void ):
1485 + m_internal( false ),
1486 + m_clientid( -1 ) {};
1487 + HWSurface( unsigned short handle,
1489 + unsigned char *localAddr,
1493 + m_handle( handle ),
1494 + m_offset( sOffset ),
1495 + m_addr( localAddr ),
1497 + m_internal( internal ),
1498 + m_clientid( clientid ) {};
1499 + HWSurface( uint32_t sOffset,
1500 + unsigned char *localAddr,
1504 + m_offset( sOffset ),
1505 + m_addr( localAddr ),
1507 + m_internal( internal ),
1508 + m_clientid( -1 ) {};
1509 + bool operator!=( HWSurface &other ) {
1510 + return( m_offset == other.getSOffset() );
1512 + HWSurface &operator=( const HWSurface &c ) {
1513 + m_handle = c.getHandle();
1514 + m_offset = c.getSOffset();
1515 + m_addr = c.getAddr();
1516 + m_size = c.getSize();
1517 + m_clientid= c.getCId();
1518 + m_internal = c.internal();
1521 + unsigned short getHandle( void ) const { return m_handle; };
1522 + uint32_t getSOffset( void ) const { return m_offset; };
1523 + unsigned char *getAddr( void ) const { return m_addr; };
1524 + unsigned int getSize( void ) const { return m_size; };
1525 + int getCId( void ) const { return m_clientid; };
1526 + bool internal( void ) const { return m_internal; };
1529 + unsigned short m_handle;
1530 + uint32_t m_offset;
1531 + unsigned char *m_addr;
1537 + QW100Screen( int display_id );
1538 + virtual ~QW100Screen();
1539 + virtual bool connect( const QString &spec );
1540 + virtual void disconnect( void );
1541 + virtual bool initDevice();
1542 + virtual void shutdownDevice();
1543 + virtual void restore();
1544 + virtual bool useOffscreen() { return true; }
1545 + virtual QGfx * createGfx( unsigned char *, int, int, int, int);
1546 + virtual uchar *cache( int amount, int optim );
1547 + virtual void uncache( uchar *c );
1548 + virtual bool onCard( unsigned char *p ) const;
1549 + virtual bool onCard( unsigned char *p, ulong& offset ) const;
1550 + QMap< uchar*, HWSurface > *getPSurfaceMap( void ) const;
1551 + void clearCache( int clientId );
1553 + // Suspend/resume hooks
1554 + virtual void prepareToSuspend();
1555 + virtual void prepareToResume();
1557 + enum Transformation { None, Rot90, Rot180, Rot270 };
1558 + void setTransformation( Transformation t );
1559 + Transformation transformation() const;
1560 + virtual bool isTransformed() const { return trans != None; };
1561 + virtual QSize mapToDevice( const QSize & ) const;
1562 + virtual QSize mapFromDevice( const QSize & ) const;
1563 + virtual QPoint mapToDevice( const QPoint &, const QSize & ) const;
1564 + virtual QPoint mapFromDevice( const QPoint &, const QSize & ) const;
1565 + virtual QRect mapToDevice( const QRect &, const QSize & ) const;
1566 + virtual QRect mapFromDevice( const QRect &, const QSize & ) const;
1567 + virtual QImage mapToDevice( const QImage & ) const;
1568 + virtual QImage mapFromDevice( const QImage & ) const;
1569 + virtual QRegion mapToDevice( const QRegion &, const QSize & ) const;
1570 + virtual QRegion mapFromDevice( const QRegion &, const QSize & ) const;
1571 + virtual int transformOrientation() const;
1575 + void w100shutdown();
1576 + Transformation trans;
1577 + static Transformation getTransSpec( const QString &dspec );
1578 + static void clearCache( QScreen *instance, int clientId );
1579 + QMap< uchar*, HWSurface > surfaceMap;
1582 + virtual int pixmapLinestepAlignment() { return 128; }
1585 +template <const int depth, const int type>
1586 +class QGfxW100 : public QGfxRaster<depth,type> {
1589 + QGfxW100( unsigned char *b, int w, int h );
1590 + virtual void drawLine( int, int, int, int);
1591 + virtual void fillRect( int, int, int, int);
1592 + virtual void blt( int, int, int, int, int, int );
1593 + virtual void sync();
1594 + virtual void setOffset( int x, int y );
1595 + virtual void setPen( const QPen & p );
1597 + virtual void drawPolyline( const QPointArray &, int, int );
1598 + virtual void drawPolygon( const QPointArray &, bool, int, int );
1599 + virtual void drawPoint( int, int );
1600 + virtual void drawPoints( const QPointArray &, int, int );
1601 + virtual void scroll( int, int, int, int, int, int );
1602 + virtual void tiledBlt( int rx, int ry, int w, int h );
1604 + inline int tx( int x, int y ) {
1605 + switch ( qt_w100_screen->transformation() ) {
1606 + case QW100Screen::Rot90:
1607 + return y - this->xoffs + this->yoffs;
1608 + case QW100Screen::Rot180:
1609 + return ( this->width - x - 1) - this->xoffs - this->xoffs;
1610 + case QW100Screen::Rot270:
1611 + return ( this->height - y - 1) - this->xoffs - this->yoffs;
1616 + inline int ty( int x, int y ) {
1617 + switch ( qt_w100_screen->transformation() ) {
1618 + case QW100Screen::Rot90:
1619 + return (this->width - x - 1) - this->yoffs - this->xoffs;
1620 + case QW100Screen::Rot180:
1621 + return (this->height - y - 1) - this->yoffs - this->yoffs;
1622 + case QW100Screen::Rot270:
1623 + return x - this->yoffs + this->xoffs;
1630 + bool checkDest( bool setsrc = false );
1631 + bool checkSourceDest();
1632 + virtual void setSourceWidgetOffset( int x, int y );
1633 + void processSpans( int n, QPoint* point, int* width );
1636 + virtual void dDrawLine( int, int, int, int);
1637 + virtual void dFillRect( int, int, int, int);
1638 + virtual void dBlt( int, int, int, int, int, int );
1639 + void dDrawPolyline( const QPointArray &, int, int );
1640 + void dDrawPolygon( const QPointArray &, bool, int, int );
1641 + void dDrawPoint( int, int );
1642 + void dDrawPoints( const QPointArray &, int, int );
1643 + void dScroll( int, int, int, int, int, int );
1644 + void dTiledBlt( int rx, int ry, int w, int h );
1647 +template<const int depth,const int type>
1648 +QGfxW100<depth,type>::QGfxW100( unsigned char * b, int w, int h )
1649 + : QGfxRaster<depth,type>(b, w, h),
1654 +template<const int depth,const int type>
1655 +inline void QGfxW100<depth,type>::setOffset( int x, int y )
1657 + QGfxRaster<depth,type>::setOffset( x, y );
1661 + QString penStyleStr( const QPen &pen )
1664 + switch( pen.style() ) {
1668 + case Qt::SolidLine:
1669 + res = "SolidLine";
1671 + case Qt::DashLine:
1677 + case Qt::DashDotLine:
1678 + res = "DashDotLine";
1680 + case Qt::DashDotDotLine:
1681 + res = "DashDotDotLine";
1690 +template<const int depth, const int type>
1691 +inline void QGfxW100<depth,type>::setPen( const QPen &p )
1693 + QGfxRaster<depth,type>::setPen( p );
1696 +template<const int depth,const int type>
1697 +inline bool QGfxW100<depth,type>::checkSourceDest()
1699 + if ( !checkDest() ) {
1703 + int sourcepixelpitch;
1704 + ulong src_buffer_offset;
1705 + if ( this->srctype == this->SourcePen ) {
1706 + src_buffer_offset = -1;
1709 + if ( !qt_screen->onCard( this->srcbits, src_buffer_offset ) ) {
1712 + sourcepixelpitch = ( this->srclinestep * 8 ) / this->srcdepth;
1713 + driver.setSrcPitchOffset( sourcepixelpitch,
1714 + src_buffer_offset );
1719 +template< const int depth, const int type>
1720 +inline bool QGfxW100<depth, type>::checkDest( bool setsrc )
1722 + //Main framebuffer should be registered as a hardware surface
1723 + ulong buffer_offset;
1724 + if ( !qt_screen->onCard( this->buffer, buffer_offset ) ) {
1727 + int pixelstep = ( this->linestep() * 8 ) / depth;
1728 + driver.setDstPitchOffset( pixelstep, buffer_offset );
1730 + driver.setSrcPitchOffset( pixelstep, buffer_offset );
1735 +template<const int depth,const int type>
1736 +void QGfxW100<depth,type>::drawLine( int x1, int y1, int x2, int y2 )
1739 + dDrawLine( x1, y1, x2, y2 );
1742 + dDrawLine( tx(x1,y1), ty(x1,y1),
1743 + tx(x2,y2), ty(x2,y2) );
1748 +template<const int depth,const int type>
1749 +void QGfxW100<depth,type>::dDrawLine( int x1, int y1, int x2, int y2 )
1751 + if ( ( this->ncliprect < 1) ||
1752 + ( this->cpen.style() == this->NoPen ) ) {
1756 + if ( depth != 16 ||
1757 + !driver.accelerated( W100Driver::DRAWLINE ) ) {
1758 + driver.addMiss( W100Driver::DRAWLINE );
1759 + QGfxRaster<depth,type>::drawLine( x1, y1, x2, y2 );
1763 + // Only handle 'normal' lines
1764 + if ( ( this->cpen.style() != this->SolidLine ) ||
1765 + ( this->myrop != this->CopyROP ) ||
1766 + ( this->cpen.width() > 1 ) ||
1767 + ( this->dashedLines ) ) {
1768 + driver.addMiss( W100Driver::DRAWLINE );
1769 + QGfxRaster<depth,type>::drawLine( x1, y1, x2, y2);
1773 + // Stop anyone else trying to access optype/lastop/the graphics engine
1774 + // to avoid synchronization problems with other processes
1775 + QWSDisplay::grab( true );
1776 + if ( !checkDest() ) {
1777 + QWSDisplay::ungrab();
1778 + driver.addMiss( W100Driver::DRAWLINE );
1779 + QGfxRaster<depth,type>::drawLine( x1, y1, x2, y2 );
1784 + // Note that the last operation used the 2d engine
1787 + // Add the offset of the gfx - used to make the origin the right
1788 + // place for windows
1789 + x1 += this->xoffs;
1790 + y1 += this->yoffs;
1791 + x2 += this->xoffs;
1792 + y2 += this->yoffs;
1794 + QRect boundRect( x1 < x2 ? x1: x2,
1795 + y1 < y2 ? y1 : y2,
1796 + QABS( x2 - x1 ) + 1,
1797 + QABS( y2 - y1 ) + 1 );
1799 + GFX_START( boundRect );
1801 + // The clip region is defined as a series of rectangles
1802 + // We repeatedly set up the hardware clip rectangle to one of
1803 + // these rectangles and re-draw the line - an alternative approach
1804 + // would be to clip to the rectangle in software
1806 + driver.setDstType( DSTTYPE_16BPP_1555 );
1807 + driver.setSrcType( SRCTYPE_EQU_DST );
1808 + driver.setRopOperation( ROP3_PATCOPY );
1809 + driver.brushType( 6, 0 );
1810 + driver.setFrgColour( this->cpen.color().rgb() );
1811 + driver.addHit( W100Driver::DRAWLINE );
1813 + //The imageon seems not to write on the edge of the clip
1814 + //for the polyline op.
1815 + //We are using a three points array repeating the last point
1816 + //to get the last single point painted.
1817 + ATI_POINT points[3];
1818 + points[0].XCoord = x1;
1819 + points[0].YCoord = y1;
1820 + points[1].XCoord = x2;
1821 + points[1].YCoord = y2;
1822 + points[2].XCoord = x2;
1823 + points[2].YCoord = y2;
1824 + for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
1825 + if ( boundRect.intersects( this->cliprect[loopc] ) ) {
1826 + ATI_CLIPRECT clip;
1827 + clip.X_Top_Left = this->cliprect[loopc].x();
1828 + clip.Y_Top_Left = this->cliprect[loopc].y();
1829 + clip.X_Bottom_Right = this->cliprect[loopc].right() + 1;
1830 + clip.Y_Bottom_Right = this->cliprect[loopc].bottom() + 1;
1831 + driver.setDstClippingRect( &clip );
1832 + driver.polyline( 3, points );
1836 + // Software mouse cursor stuff
1839 + // Release display again - not doing so will cause Qt/Embedded applications
1841 + QWSDisplay::ungrab();
1844 +template< const int depth, const int type >
1845 +void QGfxW100< depth, type>::drawPolyline( const QPointArray &a,
1850 + dDrawPolyline( a, index, npoints );
1853 + QPointArray na( npoints );
1855 + for ( int i = 0; i < npoints; i++ ) {
1857 + a.point( i+index, &x, &y );
1858 + na.setPoint( i, tx(x,y), ty(x,y) );
1861 + dDrawPolyline( na, 0, npoints );
1866 +template< const int depth, const int type >
1867 +void QGfxW100< depth, type>::dDrawPolyline( const QPointArray &a,
1871 + if ( ( this->ncliprect < 1 ) ||
1872 + ( npoints < 1 ) ||
1873 + ( this->cpen.style() == this->NoPen ) ) {
1877 + if ( depth != 16 ||
1878 + !driver.accelerated( W100Driver::POLYLINE ) ) {
1879 + driver.addMiss( W100Driver::POLYLINE );
1880 + QGfxRaster<depth,type>::drawPolyline( a, index, npoints );
1884 + if ( this->cpen.style() != this->SolidLine ||
1885 + this->myrop != this->CopyROP ) {
1886 + driver.addMiss( W100Driver::POLYLINE );
1887 + QGfxRaster<depth,type>::drawPolyline( a, index, npoints );
1891 + QWSDisplay::grab( TRUE );
1892 + if ( !checkDest() ) {
1893 + QWSDisplay::ungrab();
1894 + driver.addMiss( W100Driver::POLYLINE );
1895 + QGfxRaster<depth,type>::drawPolyline( a, index, npoints );
1901 + driver.setDstType( DSTTYPE_16BPP_1555 );
1902 + driver.setSrcType( SRCTYPE_EQU_DST );
1903 + driver.setRopOperation( ROP3_PATCOPY );
1904 + driver.brushType( 6, 0 );
1905 + driver.setFrgColour( this->cpen.color().rgb() );
1907 + driver.addHit( W100Driver::POLYLINE );
1909 + ATI_POINT *points = new ATI_POINT[ npoints + 1 ];
1911 + for ( int i = 0; i < npoints; i++ ) {
1912 + points[i].XCoord = a[i+index].x() + this->xoffs;
1913 + points[i].YCoord = a[i+index].y() + this->yoffs;
1915 + //Hack to get the last point of the last line painted
1916 + points[ npoints ] = points[ npoints - 1 ];
1919 + GFX_START( clipbounds );
1920 + driver.setFrgColour( this->cpen.color().rgb() );
1921 + driver.setRopOperation( ROP3_PATCOPY );
1922 + for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
1923 + ATI_CLIPRECT clip;
1924 + clip.X_Top_Left = this->cliprect[loopc].x();
1925 + clip.Y_Top_Left = this->cliprect[loopc].y();
1926 + clip.X_Bottom_Right = this->cliprect[loopc].right() + 1;
1927 + clip.Y_Bottom_Right = this->cliprect[loopc].bottom() + 1;
1928 + driver.setDstClippingRect( &clip );
1929 + driver.polyline( npoints + 1, points );
1935 + QWSDisplay::ungrab();
1939 +template< const int depth, const int type >
1940 +void QGfxW100< depth, type>::drawPolygon( const QPointArray &a,
1941 + bool w, int index,
1944 + if ( inDraw || this->cpen.style()==this->NoPen || this->patternedbrush ) {
1946 + dDrawPolygon( a, w, index, npoints );
1949 + QPointArray na( npoints );
1951 + for ( int i = 0; i < npoints; i++ ) {
1953 + a.point( i+index, &x, &y );
1954 + na.setPoint( i, tx(x,y), ty(x,y) );
1956 + dDrawPolygon( na, w, 0, npoints );
1961 +template< const int depth, const int type >
1962 +void QGfxW100< depth, type>::dDrawPolygon( const QPointArray &a, bool w, int index, int npoints )
1964 + QGfxRaster<depth,type>::drawPolygon( a, w, index, npoints );
1967 +template< const int depth, const int type >
1968 +void QGfxW100< depth, type>::drawPoint( int x, int y )
1970 + dDrawPoint( tx( x, y ), ty( x, y ) );
1973 +template< const int depth, const int type >
1974 +void QGfxW100< depth, type>::dDrawPoint( int x, int y )
1977 + if ( this->ncliprect < 1 ) {
1981 + if ( depth != 16 ||
1982 + !driver.accelerated( W100Driver::DRAWPOINT) ) {
1983 + driver.addMiss( W100Driver::DRAWPOINT );
1984 + QGfxRaster<depth,type>::drawPoint( x, y );
1988 + if ( this->cpen.style() != this->SolidLine ||
1989 + this->myrop != this->CopyROP ) {
1990 + driver.addMiss( W100Driver::DRAWPOINT );
1991 + QGfxRaster<depth,type>::drawPoint( x, y );
1995 + QWSDisplay::grab( TRUE );
1996 + if ( !checkDest() ) {
1997 + QWSDisplay::ungrab();
1998 + driver.addMiss( W100Driver::DRAWPOINT );
1999 + QGfxRaster<depth,type>::drawPoint( x, y );
2003 + driver.addHit( W100Driver::DRAWPOINT );
2007 + point.XCoord = x + this->xoffs;
2008 + point.YCoord = y + this->yoffs;
2010 + GFX_START( clipbounds );
2011 + driver.setFrgColour( this->cpen.color().rgb() );
2012 + driver.setRopOperation( ROP3_PATCOPY );
2013 + for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
2014 + ATI_CLIPRECT clip;
2015 + clip.X_Top_Left = this->cliprect[loopc].x();
2016 + clip.Y_Top_Left = this->cliprect[loopc].y();
2017 + clip.X_Bottom_Right = this->cliprect[loopc].right() + 1;
2018 + clip.Y_Bottom_Right = this->cliprect[loopc].bottom() + 1;
2019 + driver.setDstClippingRect( &clip );
2020 + driver.drawPixel( 1, &point );
2023 + QWSDisplay::ungrab();
2026 +template< const int depth, const int type >
2027 +void QGfxW100< depth, type>::drawPoints( const QPointArray &a,
2031 + QPointArray na( npoints );
2033 + for ( int i = 0; i < npoints; i++ ) {
2035 + a.point( i+index, &x, &y );
2036 + na.setPoint( i, tx( x, y ), ty( x, y ) );
2039 + dDrawPoints( na, 0, npoints );
2042 +template< const int depth, const int type >
2043 +void QGfxW100< depth, type>::dDrawPoints( const QPointArray &a,
2047 + if ( ( this->ncliprect < 1 ) || ( npoints < 1 ) ) {
2051 + if ( depth != 16 ||
2052 + !driver.accelerated( W100Driver::DRAWPOINTS ) ) {
2053 + driver.addMiss( W100Driver::DRAWPOINTS );
2054 + QGfxRaster<depth,type>::drawPoints( a, index, npoints );
2058 + if ( this->cpen.style() != this->SolidLine ||
2059 + this->myrop != this->CopyROP ) {
2060 + driver.addMiss( W100Driver::DRAWPOINTS );
2061 + QGfxRaster<depth,type>::drawPoints( a, index, npoints );
2065 + QWSDisplay::grab( TRUE );
2066 + if ( !checkDest() ) {
2067 + QWSDisplay::ungrab();
2068 + driver.addMiss( W100Driver::DRAWPOINTS );
2069 + QGfxRaster<depth,type>::drawPoints( a, index, npoints );
2073 + driver.addHit( W100Driver::DRAWPOINTS );
2076 + ATI_POINT *points = new ATI_POINT[ npoints ];
2077 + for ( int i = 0; i < npoints; i++ ) {
2078 + points[i].XCoord = a[i+index].x() + this->xoffs;
2079 + points[i].YCoord = a[i+index].y() + this->yoffs;
2082 + GFX_START( clipbounds );
2083 + driver.setFrgColour( this->cpen.color().rgb() );
2084 + driver.setRopOperation( ROP3_PATCOPY );
2085 + for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
2086 + ATI_CLIPRECT clip;
2087 + clip.X_Top_Left = this->cliprect[loopc].x();
2088 + clip.Y_Top_Left = this->cliprect[loopc].y();
2089 + clip.X_Bottom_Right = this->cliprect[loopc].right() + 1;
2090 + clip.Y_Bottom_Right = this->cliprect[loopc].bottom() + 1;
2091 + driver.setDstClippingRect( &clip );
2092 + driver.drawPixel( npoints, points );
2097 + QWSDisplay::ungrab();
2100 +template <const int depth, const int type>
2101 +void QGfxW100<depth,type>::scroll( int x, int y, int w, int h, int sx, int sy )
2103 + if ( w == 0 || h == 0 )
2108 + r = QRect( x, y, w, h );
2109 + s = QRect( sx, sy, w, h );
2111 + r.setCoords( tx(x,y), ty(x,y), tx(x+w-1,y+h-1), ty(x+w-1,y+h-1) );
2112 + s.setCoords( tx(sx,sy), ty(sx,sy), tx(sx+w-1,sy+h-1), ty(sx+w-1,sy+h-1) );
2113 + r = r.normalize();
2114 + s = s.normalize();
2116 + dScroll( r.x(), r.y(), r.width(), r.height(), s.x(), s.y() );
2120 +template< const int depth, const int type >
2121 +void QGfxW100< depth, type>::dScroll( int rx, int ry,
2125 + if ( depth != 16 ||
2126 + !driver.accelerated( W100Driver::SCROLL ) ) {
2127 + driver.addMiss( W100Driver::SCROLL );
2128 + QGfxRaster<depth,type>::scroll( rx, ry, w, h, sx, sy );
2132 + if ( this->ncliprect < 1 ) return;
2134 + if ( ( w < 1 ) || ( h < 1 ) ) return;
2139 + if ( dx == 0 && dy == 0 ) return;
2142 + QWSDisplay::grab( TRUE );
2144 + if ( checkDest( true ) ) {
2146 + rx += this->xoffs;
2147 + sx += this->xoffs;
2148 + ry += this->yoffs;
2149 + sy += this->yoffs;
2151 + QRect boundRect( QMIN( rx , sx ),
2153 + w + QABS( dx ) + 1,
2154 + h + QABS( dy ) + 1 );
2155 + GFX_START( boundRect );
2159 + //if ( driver.lastOp() != W100Driver::SCROLL ) {
2160 + driver.setRopOperation( ROP3_SRCCOPY );
2161 + driver.setDstType( DSTTYPE_16BPP_1555 );
2162 + driver.setSrcType( SRCTYPE_EQU_DST );
2165 + driver.addHit( W100Driver::SCROLL );
2167 + ATI_RECT srcrect, dstrect;
2169 + srcrect.XCoord = sx;
2170 + srcrect.YCoord = sy;
2171 + srcrect.Width = w;
2172 + srcrect.Height = h;
2173 + dstrect.XCoord = rx;
2174 + dstrect.YCoord = ry;
2175 + dstrect.Width = w;
2176 + dstrect.Height = h;
2177 + for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
2178 + if ( boundRect.intersects( this->cliprect[loopc] ) ) {
2179 + ATI_CLIPRECT clip;
2180 + clip.X_Top_Left = this->cliprect[ loopc ].x();
2181 + clip.Y_Top_Left = this->cliprect[ loopc ].y();
2182 + clip.X_Bottom_Right = this->cliprect[ loopc ].right() + 1;
2183 + clip.Y_Bottom_Right = this->cliprect[ loopc ].bottom() + 1;
2184 + driver.setDstClippingRect( &clip );
2185 + driver.bitBlt( 1, &dstrect, &srcrect );
2189 + QWSDisplay::ungrab();
2192 + QWSDisplay::ungrab();
2193 + // software fallback
2194 + driver.addMiss( W100Driver::SCROLL );
2195 + QGfxRaster<depth,type>::scroll( rx, ry, w, h, sx, sy );
2199 +template< const int depth, const int type >
2200 +void QGfxW100< depth, type>::fillRect( int x, int y, int w, int h )
2202 + if ( w == 0 || h == 0 )
2204 + QRect r( x, y, w, h );
2205 + r.setCoords( tx( x, y ), ty( x, y ),
2206 + tx( x + w - 1, y + h - 1 ), ty( x + w - 1, y + h - 1 ) );
2207 + r = r.normalize();
2209 + dFillRect( r.x(), r.y(), r.width(), r.height() );
2213 +template< const int depth, const int type >
2214 +void QGfxW100< depth, type>::dFillRect( int rx, int ry, int w, int h )
2216 + if ( w <= 0 || h <= 0 || this->ncliprect < 1 ) return;
2218 + if ( depth != 16 ||
2219 + !driver.accelerated( W100Driver::FILLRECT ) ) {
2220 + driver.addMiss( W100Driver::FILLRECT );
2221 + QGfxRaster<depth,type>::fillRect( rx, ry, w, h );
2225 + if ( ( this->cbrush.style() != this->NoBrush ) &&
2226 + ( this->cbrush.style() != this->SolidPattern ) ) {
2227 + driver.addMiss( W100Driver::FILLRECT );
2228 + QGfxRaster<depth,type>::fillRect( rx, ry, w, h );
2232 + if ( !checkDest() || ( this->myrop != this->CopyROP ) ) {
2233 + driver.addMiss( W100Driver::FILLRECT );
2234 + QGfxRaster<depth,type>::fillRect( rx, ry, w, h );
2238 + QWSDisplay::grab( TRUE );
2239 + rx += this->xoffs;
2240 + ry += this->yoffs;
2242 + QRect boundRect( rx, ry, w + 1, h + 1 );
2243 + GFX_START( boundRect );
2247 + driver.setDstType( DSTTYPE_16BPP_1555 );
2248 + driver.setSrcType( SRCTYPE_EQU_DST );
2249 + driver.setRopOperation( ROP3_PATCOPY );
2250 + driver.brushType( 6, 0 );
2251 + driver.setFrgColour( this->cbrush.color().rgb() );
2253 + driver.addHit( W100Driver::FILLRECT );
2255 + if ( this->cbrush.style() != this->NoBrush ) {
2256 + //Using all the cliprects
2257 + for ( int loopc = 0; loopc < this->ncliprect; loopc++ ) {
2258 + if ( boundRect.intersects( this->cliprect[loopc] ) ) {
2259 + ATI_CLIPRECT clip;
2262 + clip.X_Top_Left = this->cliprect[ loopc ].x();
2263 + clip.Y_Top_Left = this->cliprect[ loopc ].y();
2264 + clip.X_Bottom_Right = this->cliprect[ loopc ].right() + 1;
2265 + clip.Y_Bottom_Right = this->cliprect[ loopc ].bottom() + 1;
2267 + driver.setDstClippingRect( &clip );
2272 + driver.paintRect( 1, &rect );
2278 + QWSDisplay::ungrab();
2281 +template <const int depth, const int type>
2282 +void QGfxW100<depth,type>::blt( int x, int y, int w, int h, int sx, int sy )
2284 + if ( w == 0 || h == 0 )
2290 + r = QRect( x, y, w, h );
2294 + r.setCoords( tx(x,y), ty(x,y), tx(x+w-1,y+h-1), ty(x+w-1,y+h-1) );
2295 + r = r.normalize();
2296 + switch ( qt_w100_screen->transformation() ) {
2297 + case QW100Screen::Rot90:
2299 + rsy = this->srcwidth - sx - w;
2301 + case QW100Screen::Rot180:
2302 + rsx = this->srcwidth - sx - w;
2303 + rsy = this->srcheight - sy - h;
2305 + case QW100Screen::Rot270:
2306 + rsx = this->srcheight - sy - h;
2315 + dBlt( r.x(), r.y(), r.width(), r.height(), rsx, rsy );
2318 +template< const int depth, const int type >
2319 +inline void QGfxW100< depth, type>::dBlt( int rx, int ry,
2323 + if ( !w || !h || this->ncliprect < 1 ) {
2327 + if ( depth != 16 ||
2328 + !driver.accelerated( W100Driver::BITBLT ) ) {
2329 + driver.addMiss( W100Driver::BITBLT );
2330 + QGfxRaster<depth,type>::blt( rx, ry, w, h, sx, sy );
2334 + if ( this->alphatype == this->BigEndianMask ||
2335 + this->alphatype == this->LittleEndianMask ||
2336 + this->alphatype == this->SeparateAlpha ||
2337 + this->srctype == this->SourcePen ||
2338 + ( this->myrop != this->CopyROP ) ) {
2339 + driver.addMiss( W100Driver::BITBLT );
2340 + QGfxRaster<depth,type>::blt( rx, ry, w, h, sx, sy );
2344 + if ( ( this->srcdepth != 16 ) || this->alphatype != this->IgnoreAlpha ) {
2345 + driver.addMiss( W100Driver::BITBLT );
2346 + QGfxRaster<depth,type>::blt( rx, ry, w, h, sx, sy );
2350 + QWSDisplay::grab( TRUE );
2352 + if ( checkSourceDest() ) {
2353 + QRect boundRect( rx + this->xoffs, ry + this->yoffs,
2355 + GFX_START( boundRect );
2358 + driver.setRopOperation( ROP3_SRCCOPY );
2359 + driver.setDstType( DSTTYPE_16BPP_1555 );
2360 + driver.setSrcType( SRCTYPE_EQU_DST );
2362 + driver.addHit( W100Driver::BITBLT );
2367 + rx += this->xoffs;
2368 + ry += this->yoffs;
2370 + rect1.XCoord = this->srcwidgetoffs.x() + sx;
2371 + rect1.YCoord = this->srcwidgetoffs.y() + sy;
2374 + rect2.XCoord = rx;
2375 + rect2.YCoord = ry;
2378 + for(int loopc = 0; loopc < this->ncliprect; loopc++ ) {
2379 + if ( boundRect.intersects( this->cliprect[loopc] ) ) {
2380 + ATI_CLIPRECT clip;
2381 + clip.X_Top_Left = this->cliprect[ loopc ].x();
2382 + clip.Y_Top_Left = this->cliprect[ loopc ].y();
2383 + clip.X_Bottom_Right = this->cliprect[ loopc ].right() + 1;
2384 + clip.Y_Bottom_Right = this->cliprect[ loopc ].bottom() + 1;
2385 + driver.setDstClippingRect( &clip );
2386 + driver.bitBlt( 1, &rect2, &rect1 );
2391 + QWSDisplay::ungrab();
2394 + QWSDisplay::ungrab();
2395 + driver.addMiss( W100Driver::BITBLT );
2396 + QGfxRaster<depth,type>::blt( rx, ry,
2402 +template <const int depth, const int type>
2403 +void QGfxW100<depth,type>::tiledBlt( int rx,int ry,int w,int h )
2405 + if ( w <= 0 || h <= 0 )
2409 + r = QRect(rx,ry,w,h);
2411 + r.setCoords( tx(rx,ry), ty(rx,ry), tx(rx+w-1,ry+h-1), ty(rx+w-1,ry+h-1) );
2412 + r = r.normalize();
2417 + QPoint oldBrushOffs = this->brushoffs;
2419 + switch ( qt_w100_screen->transformation() ) {
2420 + case QW100Screen::Rot90:
2421 + brx = this->brushoffs.y();
2422 + bry = this->srcwidth - this->brushoffs.x() - w;
2424 + case QW100Screen::Rot180:
2425 + brx = this->srcwidth - this->brushoffs.x() - w;
2426 + bry = this->srcheight - this->brushoffs.y() - h;
2428 + case QW100Screen::Rot270:
2429 + brx = this->srcheight - this->brushoffs.y() - h;
2430 + bry = this->brushoffs.x();
2433 + brx = this->brushoffs.x();
2434 + bry = this->brushoffs.y();
2437 + this->brushoffs = QPoint( brx, bry );
2439 + int oldsw = this->srcwidth;
2440 + int oldsh = this->srcheight;
2441 + QSize s = qt_screen->mapToDevice( QSize(this->srcwidth,this->srcheight) );
2442 + this->srcwidth = s.width();
2443 + this->srcheight = s.height();
2445 + dTiledBlt( r.x(), r.y(), r.width(), r.height() );
2447 + this->srcwidth = oldsw;
2448 + this->srcheight = oldsh;
2449 + this->brushoffs = oldBrushOffs;
2454 +template <const int depth, const int type>
2455 +void QGfxW100<depth,type>::dTiledBlt( int rx,int ry, int w,int h )
2457 + if ( this->srcwidth == 0 || this->srcheight == 0 )
2459 + QGfxRaster<depth,type>::tiledBlt( rx, ry, w, h );
2462 +template<const int depth,const int type>
2463 +void QGfxW100<depth,type>::sync()
2465 + driver.waitComplete( -1 );
2468 +template <const int depth, const int type>
2469 +void QGfxW100<depth,type>::setSourceWidgetOffset(int x, int y)
2471 + if ( this->srcbits == this->buffer ) {
2472 + switch ( qt_w100_screen->transformation() ) {
2473 + case QW100Screen::Rot90:
2474 + this->srcwidgetoffs = QPoint( y, this->width - x - this->srcwidth );
2476 + case QW100Screen::Rot180:
2477 + this->srcwidgetoffs = QPoint( this->width - x - this->srcwidth, this->height - y - this->srcheight );
2479 + case QW100Screen::Rot270:
2480 + this->srcwidgetoffs = QPoint( this->height - y - this->srcheight, x );
2483 + this->srcwidgetoffs = QPoint( x, y );
2487 + this->srcwidgetoffs = QPoint( x, y );
2491 +template <const int depth, const int type>
2492 +void QGfxW100<depth,type>::processSpans( int n, QPoint* point, int* width )
2495 + this->patternedbrush &&
2496 + this->srcwidth != 0 &&
2497 + this->srcheight != 0 ) {
2498 + //in the patternedbrush case, we let blt do the transformation
2499 + // so we leave inDraw false.
2500 + QGfxRaster<depth,type>::processSpans( n, point, width );
2504 + if ( *width > 0 ) {
2505 + int x=tx(point->x(),point->y())+this->xoffs;
2506 + int y=ty(point->x(),point->y())+this->yoffs;
2508 + switch( qt_w100_screen->transformation() ) {
2509 + case QW100Screen::Rot90:
2510 + this->vline( x, y-(*width-1), y );
2512 + case QW100Screen::Rot180:
2513 + this->hline( x - (*width-1), x, y );
2515 + case QW100Screen::Rot270:
2516 + this->vline( x, y, y+*width-1 );
2519 + this->hline( x, x+*width-1, y );
2530 +QW100Screen::QW100Screen( int display_id )
2531 + :QLinuxFbScreen( display_id ),
2533 + m_isServer( false )
2535 + qt_w100_screen = this;
2537 + clearCacheFunc = &clearCache;
2541 +static const char *trans2str( QW100Screen::Transformation t )
2544 + case QW100Screen::None:
2547 + case QW100Screen::Rot90:
2550 + case QW100Screen::Rot180:
2553 + case QW100Screen::Rot270:
2562 +QW100Screen::Transformation QW100Screen::getTransSpec( const QString &dspec )
2564 + Transformation mytrans = None;
2565 + if ( dspec.find( ":Rot270" ) >= 0 ) {
2567 + } else if ( dspec.find( ":Rot180" ) >= 0 ) {
2569 + } else if ( dspec.find( ":Rot90" ) >= 0 ) {
2575 +bool QW100Screen::connect( const QString &displaySpec )
2577 + driver.log( W100Driver::WARNING, "QW100Screen::connect('%s')",
2578 + displaySpec.latin1() );
2579 + trans = getTransSpec( displaySpec );
2581 + if ( QLinuxFbScreen::connect( displaySpec ) ) {
2582 + vramoffset = ( w == 320 ) ? 0 : 0x0f000000;
2583 + if ( driver.processAttach() == W100Driver::codOK ) {
2584 + driver.processAttachSpecialMode( ( w == 480 ) ? 0xaaab : 0xaaaa );
2585 + surfaceMap.clear();
2586 + surfaceMap.insert( 0, HWSurface( vramoffset,
2590 + QSize s = mapFromDevice( QSize( w, h ) );
2599 +void QW100Screen::disconnect( void )
2601 + driver.log( W100Driver::WARNING, "QW100Screen::disconnect()" );
2602 + driver.processDetachSpecialMode();
2603 + driver.processDetach();
2604 + QLinuxFbScreen::disconnect();
2605 + printf( "[%d]QW100Screen disconnected with %d surfaces\n",
2606 + getpid(), surfaceMap.count() );
2607 + surfaceMap.clear();
2610 +void QW100Screen::prepareToSuspend( void )
2613 + driver.log( W100Driver::WARNING,
2614 + "QW100Screen::prepareToSuspend. Server = %s",
2615 + m_isServer ? "true" : "false" );
2617 + QWSDisplay::grab( true );
2618 + driver.waitComplete( -1 );
2620 + if ( !driver.attached() ) {
2621 + driver.log( W100Driver::ERROR, "Driver was not attached. " );
2623 + driver.processDetachSpecialMode();
2624 + driver.processDetach();
2626 + QWSDisplay::ungrab();
2628 + driver.log( W100Driver::WARNING, "prepareToSuspend done" );
2632 +void QW100Screen::prepareToResume( void )
2635 + driver.log( W100Driver::WARNING,
2636 + "QW100Screen::prepareToResume. Server = %s",
2637 + m_isServer ? "true": "false" );
2639 + driver.processAttach();
2640 + driver.processAttachSpecialMode( ( w == 480 ) ? 0xaaab : 0xaaaa );
2641 + if ( m_isServer ) {
2642 + QWSDisplay::grab( true );
2644 + QWSDisplay::ungrab();
2645 + driver.log( W100Driver::WARNING, "W100 restarted" );
2647 + driver.log( W100Driver::WARNING, "prepareToResume done" );
2651 +QW100Screen::~QW100Screen()
2655 +bool QW100Screen::w100init()
2657 + driver.log( W100Driver::WARNING,
2658 + "QW100Screen::w100init(%dx%d)", dw, dh );
2659 + ATI_GRAPHICWINDOW win;
2660 + ATI_CLIPRECT clip;
2664 + win.Size.XCoord = 0;
2665 + win.Size.YCoord = 0;
2666 + win.Size.Width = dw;
2667 + win.Size.Height = dh;
2668 + win.Width = dw > dh ? dh : dw;
2669 + win.Height = dw > dh ? dw : dh;
2670 + win.Flag = DSTTYPE_16BPP_444;
2672 + driver.waitComplete( -1 );
2673 + driver.setGraphicWindowOnOff( 0 );
2675 + driver.setupGraphicWindow( &win );
2676 + driver.setGraphicWindowPos( 0, 0 );
2678 + driver.setFrontBuffer( vramoffset, 0, 0 );
2679 + driver.setDstPitchOffset( dw, vramoffset );
2680 + driver.setDstType( DSTTYPE_16BPP_444 );
2681 + driver.setSrcPitchOffset( dw, vramoffset );
2682 + driver.setSrcType( SRCTYPE_SOLID_COLOR_BLT );
2683 + clip.X_Top_Left = 0;
2684 + clip.Y_Top_Left = 0;
2685 + clip.X_Bottom_Right = dw;
2686 + clip.Y_Bottom_Right = dh;
2687 + driver.setDstClippingRect( &clip );
2689 + clip.X_Top_Left = 0xE000;
2690 + clip.Y_Top_Left = 0xE000;
2691 + clip.X_Bottom_Right = 0x1FFF;
2692 + clip.Y_Bottom_Right = 0x1FFF;
2694 + driver.setSrcClippingRect( &clip );
2696 + driver.setRopOperation( ROP3_SRCCOPY );
2697 + driver.setGraphicWindowOnOff( 1 );
2698 + driver.allocOverlay( &overlay );
2699 + driver.setOverlayOnOff( overlay, 0 );
2700 + driver.releaseOverlay( overlay );
2701 + driver.setDstPitchOffset( dw, vramoffset );
2702 + driver.setDstClippingRect( NULL );
2703 + for ( int i = 0; i < dw * dh ; i++ ) {
2704 + *( data + i ) = 0;
2706 + driver.waitComplete( -1 );
2710 +void QW100Screen::w100shutdown()
2714 +bool QW100Screen::initDevice()
2716 + QWSDisplay::grab( true );
2717 + driver.log( W100Driver::WARNING, "initDevice( dw=%d, dh=%d )",
2719 + m_isServer = true;
2721 + if ( !w100init() ) {
2722 + QWSDisplay::ungrab();
2726 + if ( QLinuxFbScreen::initDevice() ) {
2728 + //Some sprite corruption seems to be avoided
2729 + //reserving some upper memory on the offscreen framebuffer memory
2730 + QLinuxFbScreen::cache( 65535 * 2, 0 );
2731 + QWSDisplay::ungrab();
2734 + QWSDisplay::ungrab();
2738 +void QW100Screen::shutdownDevice()
2740 + driver.log( W100Driver::WARNING, "Shutting down device" );
2741 + QLinuxFbScreen::shutdownDevice();
2744 +void QW100Screen::restore()
2746 + driver.log( W100Driver::WARNING, "Restoring W100..." );
2747 + QLinuxFbScreen::restore();
2748 + driver.log( W100Driver::WARNING, "Restoring done" );
2752 +QGfx *QW100Screen::createGfx( unsigned char *b,
2753 + int w, int h, int d, int linestep )
2755 + //We need ALL the gfx created to be QGfxW100 to allow software
2756 + //drawing syncing after hardware operations
2759 +#ifndef QT_NO_QWS_DEPTH_1
2760 + } else if ( d == 1 ) {
2761 + ret = new QGfxW100<1,0>( b, w, h );
2763 +#ifndef QT_NO_QWS_DEPTH_4
2764 + } else if ( d == 4 ) {
2765 + ret = new QGfxW100<4,0>( b, w, h );
2767 +#ifndef QT_NO_QWS_DEPTH_8
2768 + } else if ( d == 8 ) {
2769 + ret = new QGfxW100<8,0>( b, w, h );
2771 +#ifndef QT_NO_QWS_DEPTH_16
2772 + } else if ( d == 16 ) {
2773 + ret = new QGfxW100<16,0>( b, w, h );
2775 +#ifndef QT_NO_QWS_DEPTH_24
2776 + } else if ( d == 24 ) {
2777 + ret = new QGfxW100<24,0>( b, w, h );
2779 +#ifndef QT_NO_QWS_DEPTH_32
2780 + } else if ( d == 32 ) {
2781 + ret = new QGfxW100<32,0>( b, w, h );
2784 + qFatal( "Unsupported depth %d\n", d );
2788 + ret->setLineStep( linestep );
2793 +uchar *QW100Screen::cache( int amount, int optim )
2795 + unsigned short hSurface = 0;
2796 + uint32_t surfaceOffset = 0;
2797 + uchar* localAddr = 0;
2798 + bool internal = false;
2800 + /* The size must have 0xF bit zeroed (16 multiple)*/
2801 + /* Perhaps this is not needed anymore, after setting
2802 + * QW100Screen::pixmapLinestepAlignment to 128
2804 + amount = ( amount & 0x0F ) ? ( amount | 0x10 ) & ~0x0F : amount;
2806 + /* Experimenting memory corruption with the
2807 + * internal AtiCore memory allocation routines
2808 + * disabled for now
2811 + if ( !( localAddr = QLinuxFbScreen::cache( amount, optim ) ) ) {
2814 + surfaceOffset = vramoffset + ( uint32_t ) localAddr - ( uint32_t )data;
2818 + qt_fbdpy->grab( true );
2819 + retcode = driver.allocateSurface( &hSurface,
2822 + qt_fbdpy->ungrab();
2825 + driver.setupMemoryTransfer( surfaceOffset,
2826 + (uint32_t*) &localAddr );
2827 + driver.terminateMemoryTransfer();
2829 + // Try to use the offscreen framebuffer memory
2830 + // to allocate the surface. Use the qgfxlinuxfb routines
2831 + if ( !( localAddr = QLinuxFbScreen::cache( amount, optim ) ) ) {
2834 + //Distance between physical vram start and surface should be
2835 + //the same than distance between logical addresses
2836 + surfaceOffset = vramoffset + ( uint32_t ) localAddr - ( uint32_t ) data;
2840 + HWSurface surface( hSurface, surfaceOffset,
2841 + localAddr, amount,
2844 + surfaceMap.insert( surface.getAddr(), surface );
2845 + return( ( uchar* ) localAddr );
2848 +void QW100Screen::uncache( uchar *c )
2850 + QMap< uchar*, HWSurface >::Iterator itr;
2851 + if ( ( itr = surfaceMap.find( c ) ) != surfaceMap.end() ) {
2852 + driver.waitComplete( -1 );
2853 + if ( itr.data().internal() ) {
2854 + qt_fbdpy->grab( true );
2855 + driver.destroySurface( itr.data().getHandle() );
2856 + qt_fbdpy->ungrab();
2858 + QLinuxFbScreen::uncache( c );
2860 + surfaceMap.remove( itr );
2864 +bool QW100Screen::onCard( uchar *p ) const
2866 + QMap< uchar*, HWSurface >::ConstIterator itr = surfaceMap.begin();
2867 + for ( ; itr != surfaceMap.end(); itr++ ) {
2869 + if ( ( begin = itr.data().getAddr() ) <= p ) {
2870 + if ( ( itr.data().getSize() + begin ) >= p ) {
2878 +bool QW100Screen::onCard( unsigned char *p, ulong& offset ) const
2880 + QMap< uchar*, HWSurface >::ConstIterator itr;
2881 + for ( itr = surfaceMap.begin(); itr != surfaceMap.end(); itr++ ) {
2883 + if ( ( begin = itr.data().getAddr() ) <= p ) {
2884 + if ( ( itr.data().getSize() + begin ) >= p ) {
2885 + offset = itr.data().getSOffset() + ( p - begin );
2893 +QMap< uchar*, QW100Screen::HWSurface >
2894 +*QW100Screen::getPSurfaceMap( void ) const
2896 + return ( QMap<uchar*,HWSurface> *) &surfaceMap;
2899 +void QW100Screen::clearCache( int clientId )
2901 + printf( "[%d] CLEARING CACHE FOR %d\n", getpid(), clientId );
2902 + driver.log( W100Driver::WARNING, "Cleaning cache for '%d'", clientId );
2903 + QMap< uchar*, HWSurface >::Iterator itr = surfaceMap.begin();
2904 + while ( itr != surfaceMap.end() ) {
2905 + if ( itr.data().getCId() == clientId ) {
2906 + if ( itr.data().internal() ) {
2908 + driver.destroySurface( itr.data().getHandle() );
2909 + qt_fbdpy->ungrab();
2911 + surfaceMap.remove( itr );
2915 + QLinuxFbScreen::clearCache( this, clientId );
2918 +void QW100Screen::clearCache( QScreen *instance, int clientId )
2920 + QW100Screen *screen = reinterpret_cast<QW100Screen *> ( instance );
2921 + screen->clearCache( clientId );
2924 +void QW100Screen::setTransformation( Transformation t )
2926 + qt_fbdpy->grab( true );
2929 + QSize s = mapFromDevice( QSize( dw,dh ) );
2932 + qt_fbdpy->ungrab();
2935 +QW100Screen::Transformation QW100Screen::transformation( void ) const
2940 +QSize QW100Screen::mapToDevice( const QSize &s ) const
2942 + if ( trans == Rot90 || trans == Rot270 ) {
2943 + return QSize( s.height(), s.width() );
2949 +QSize QW100Screen::mapFromDevice( const QSize &s ) const
2951 + if ( trans == Rot90 || trans == Rot270 ) {
2952 + return QSize( s.height(), s.width() );
2958 +QPoint QW100Screen::mapToDevice( const QPoint &p, const QSize &s ) const
2962 + switch ( trans ) {
2965 + rp.setY( s.width() - p.x() - 1 );
2968 + rp.setX( s.width() - p.x() - 1 );
2969 + rp.setY( s.height() - p.y() - 1 );
2972 + rp.setX( s.height() - p.y() - 1 );
2982 +QPoint QW100Screen::mapFromDevice( const QPoint &p, const QSize &s ) const
2986 + switch ( trans ) {
2988 + rp.setX( s.height() - p.y() - 1 );
2992 + rp.setX( s.width() - p.x() - 1 );
2993 + rp.setY( s.height() - p.y() - 1 );
2997 + rp.setY( s.width() - p.x() - 1 );
3006 +QRect QW100Screen::mapToDevice( const QRect &r, const QSize &s ) const
3009 + switch ( trans ) {
3011 + tr.setCoords( r.y(), s.width() - r.x() - 1,
3012 + r.bottom(), s.width() - r.right() - 1 );
3015 + tr.setCoords( s.width() - r.x() - 1, s.height() - r.y() - 1,
3016 + s.width() - r.right() - 1, s.height() - r.bottom() - 1 );
3019 + tr.setCoords( s.height() - r.y() - 1, r.x(),
3020 + s.height() - r.bottom() - 1, r.right() );
3027 + return tr.normalize();
3030 +QRect QW100Screen::mapFromDevice( const QRect &r, const QSize &s ) const
3033 + switch ( trans ) {
3035 + tr.setCoords( s.height() - r.y() - 1, r.x(),
3036 + s.height() - r.bottom() - 1, r.right() );
3039 + tr.setCoords( s.width() - r.x() - 1, s.height() - r.y() - 1,
3040 + s.width() - r.right() - 1, s.height() - r.bottom() - 1 );
3043 + tr.setCoords( r.y(), s.width() - r.x() - 1,
3044 + r.bottom(), s.width() - r.right() - 1 );
3051 + return tr.normalize();
3055 +static inline void rotateLoopTemplate( uchar *src, int srcBytesPerLine,
3056 + uchar *dst, int dstBytesPerLine,
3057 + int width, int height,
3058 + QW100Screen::Transformation trans,
3059 + bool mapToDevice )
3065 + int srcYAdd = srcBytesPerLine - width * sizeof(T);
3067 + if ( !mapToDevice ) {
3068 + if ( trans == QW100Screen::Rot90 )
3069 + trans = QW100Screen::Rot270;
3070 + else if ( trans == QW100Screen::Rot270 )
3071 + trans = QW100Screen::Rot90;
3074 + switch ( trans ) {
3075 + case QW100Screen::Rot90:
3077 + dstYOfs = width - 1;
3078 + dstXAdd = -dstBytesPerLine;
3079 + dstYAdd = 1 * sizeof(T) + width * dstBytesPerLine;
3081 + case QW100Screen::Rot270:
3082 + dstXOfs = height - 1;
3084 + dstXAdd = dstBytesPerLine;
3085 + dstYAdd = -1 * sizeof(T) - width * dstBytesPerLine;
3088 + dstXOfs = width - 1;
3089 + dstYOfs = height - 1;
3090 + dstXAdd = -1 * sizeof(T);
3091 + dstYAdd = -dstBytesPerLine + width * sizeof(T);
3095 + T *dstPtr = (T *)(dst + dstYOfs * dstBytesPerLine) + dstXOfs;
3096 + T *srcPtr = (T *)src;
3097 + for ( int y = 0; y < height; y++ ) {
3098 + for ( int x = 0; x < width; x++ ) {
3099 + *dstPtr = *srcPtr++;
3100 + dstPtr = (T *)((uchar*)dstPtr + dstXAdd); // add dstXAdd number of bytes
3102 + srcPtr = (T *)((uchar*)srcPtr + srcYAdd); // add srcYAdd number of bytes
3103 + dstPtr = (T *)((uchar*)dstPtr + dstYAdd); // add dstYAdd number of bytes
3107 +QImage QW100Screen::mapToDevice( const QImage &img ) const
3109 + if ( img.isNull() || trans == None )
3112 + int iw = img.width();
3113 + int ih = img.height();
3116 + if ( trans == Rot90 || trans == Rot270 ) {
3121 + QImage rimg( w, h, img.depth(), img.numColors(), img.bitOrder() );
3123 + for ( int i = 0; i < img.numColors(); i++ ) {
3124 + rimg.colorTable()[i] = img.colorTable()[i];
3127 + // Optimized image rotation code for nice bit depths
3128 + int d = img.depth();
3129 + if ( d == 8 || d == 16 || d == 32 ) {
3130 + int srcBytesPerLine = img.bytesPerLine();
3131 + int dstBytesPerLine = rimg.bytesPerLine();
3132 + uchar *srcBits = img.bits();
3133 + uchar *dstBits = rimg.bits();
3136 + rotateLoopTemplate<uchar>( srcBits, srcBytesPerLine, dstBits, dstBytesPerLine, iw, ih, trans, TRUE );
3139 + rotateLoopTemplate<ushort>( srcBits, srcBytesPerLine, dstBits, dstBytesPerLine, iw, ih, trans, TRUE );
3142 + rotateLoopTemplate<uint>( srcBits, srcBytesPerLine, dstBits, dstBytesPerLine, iw, ih, trans, TRUE );
3145 + rimg.setAlphaBuffer( img.hasAlphaBuffer() );
3146 + rimg.setOffset( img.offset() );
3150 + // Slower fall back code for image rotation for 1-bit and other depths
3151 +#define ROTATE_LOOP( X, Y, VAL ) \
3152 + for ( int y = 0; y < ih; y++ ) { \
3153 + for ( int x = 0; x < iw; x++ ) { \
3154 + rimg.setPixel( X, Y, VAL ); \
3159 + if ( img.depth() > 8 ) {
3160 + switch ( trans ) {
3162 + ROTATE_LOOP( y, iw - x - 1, img.pixel(x, y) )
3164 + ROTATE_LOOP( ih - y - 1, x, img.pixel(x, y) );
3166 + ROTATE_LOOP( iw - x - 1, ih - y - 1, img.pixel(x, y) );
3169 + switch ( trans ) {
3171 + ROTATE_LOOP( y, iw - x - 1, img.pixelIndex(x, y) );
3173 + ROTATE_LOOP( ih - y - 1, x, img.pixelIndex(x, y) );
3175 + ROTATE_LOOP( iw - x - 1, ih - y - 1, img.pixelIndex(x, y) );
3181 + rimg.setAlphaBuffer( img.hasAlphaBuffer() );
3182 + rimg.setOffset( img.offset() );
3187 +QImage QW100Screen::mapFromDevice( const QImage &img ) const
3189 + if ( img.isNull() || trans == None )
3192 + int iw = img.width();
3193 + int ih = img.height();
3196 + if ( trans == Rot90 || trans == Rot270 ) {
3201 + QImage rimg( w, h, img.depth(), img.numColors(), img.bitOrder() );
3203 + for ( int i = 0; i < img.numColors(); i++ ) {
3204 + rimg.colorTable()[i] = img.colorTable()[i];
3207 + // Optimized image rotation code for nice bit depths
3208 + int d = img.depth();
3209 + if ( d == 8 || d == 16 || d == 32 ) {
3210 + int srcBytesPerLine = img.bytesPerLine();
3211 + int dstBytesPerLine = rimg.bytesPerLine();
3212 + uchar *srcBits = img.bits();
3213 + uchar *dstBits = rimg.bits();
3216 + rotateLoopTemplate<uchar>( srcBits, srcBytesPerLine, dstBits, dstBytesPerLine, iw, ih, trans, FALSE );
3219 + rotateLoopTemplate<ushort>( srcBits, srcBytesPerLine, dstBits, dstBytesPerLine, iw, ih, trans, FALSE );
3222 + rotateLoopTemplate<uint>( srcBits, srcBytesPerLine, dstBits, dstBytesPerLine, iw, ih, trans, FALSE );
3225 + rimg.setAlphaBuffer( img.hasAlphaBuffer() );
3226 + rimg.setOffset( img.offset() );
3230 + // Slower fall back code for image rotation for 1-bit and other depths
3231 +#define ROTATE_LOOP( X, Y, VAL ) \
3232 + for ( int y = 0; y < ih; y++ ) { \
3233 + for ( int x = 0; x < iw; x++ ) { \
3234 + rimg.setPixel( X, Y, VAL ); \
3239 + if ( img.depth() > 8 ) {
3240 + switch ( trans ) {
3242 + ROTATE_LOOP( ih - y - 1, x, img.pixel(x, y) );
3244 + ROTATE_LOOP( y, iw - x - 1, img.pixel(x, y) )
3246 + ROTATE_LOOP( iw - x - 1, ih - y - 1, img.pixel(x, y) );
3249 + switch ( trans ) {
3251 + ROTATE_LOOP( ih - y - 1, x, img.pixelIndex(x, y) );
3253 + ROTATE_LOOP( y, iw - x - 1, img.pixelIndex(x, y) );
3255 + ROTATE_LOOP( iw - x - 1, ih - y - 1, img.pixelIndex(x, y) );
3261 + rimg.setAlphaBuffer( img.hasAlphaBuffer() );
3262 + rimg.setOffset( img.offset() );
3267 +QRegion QW100Screen::mapToDevice( const QRegion &rgn, const QSize &s ) const
3269 + if ( trans == None )
3273 + QArray<QRect> a = rgn.rects();
3275 + const QRect *r = a.data();
3277 + int w = s.width();
3278 + int h = s.height();
3279 + int size = a.size();
3281 + switch ( trans ) {
3283 + for ( int i = 0; i < size; i++, r++ ) {
3284 + tr.setCoords( h - r->y() - 1, r->x(),
3285 + h - r->bottom() - 1, r->right() );
3286 + trgn |= tr.normalize();
3290 + for ( int i = 0; i < size; i++, r++ ) {
3291 + tr.setCoords( r->y(), w - r->x() - 1,
3292 + r->bottom(), w - r->right() - 1 );
3293 + trgn |= tr.normalize();
3297 + for ( int i = 0; i < size; i++, r++ ) {
3298 + tr.setCoords( w - r->x() - 1, h - r->y() - 1,
3299 + w - r->right() - 1, h - r->bottom() - 1 );
3300 + trgn |= tr.normalize();
3309 +QRegion QW100Screen::mapFromDevice( const QRegion &rgn, const QSize &s ) const
3311 + if ( trans == None )
3315 + QArray<QRect> a = rgn.rects();
3316 + const QRect *r = a.data();
3319 + int w = s.width();
3320 + int h = s.height();
3321 + int size = a.size();
3323 + switch ( trans ) {
3325 + for ( int i = 0; i < size; i++, r++ ) {
3326 + tr.setCoords( r->y(), w - r->x() - 1,
3327 + r->bottom(), w - r->right() - 1 );
3328 + trgn |= tr.normalize();
3332 + for ( int i = 0; i < size; i++, r++ ) {
3333 + tr.setCoords( h - r->y() - 1, r->x(),
3334 + h - r->bottom() - 1, r->right() );
3335 + trgn |= tr.normalize();
3339 + for ( int i = 0; i < size; i++, r++ ) {
3340 + tr.setCoords( w - r->x() - 1, h - r->y() - 1,
3341 + w - r->right() - 1, h - r->bottom() - 1 );
3342 + trgn |= tr.normalize();
3354 + 1..3 = rotates 90..270
3355 + 4..7 = mirrored 0..3
3357 +int QW100Screen::transformOrientation() const
3359 + return (int)trans;
3363 +void qws_w100Transformation( int t )
3365 + if ( qt_w100_screen ) {
3366 + qt_w100_screen->setTransformation( static_cast<QW100Screen::Transformation>( t ) );
3370 +extern bool qws_accel;
3372 +extern "C" QScreen * qt_get_screen_w100( int display_id )
3374 + return( new QW100Screen( display_id ) );
3376 --- qt-2.3.10/src/kernel/qapplication_qws.cpp~w100
3377 +++ qt-2.3.10/src/kernel/qapplication_qws.cpp
3378 @@ -1450,16 +1450,25 @@
3379 extern void qws_clearLoadedFonts();
3382 +#ifndef QT_NO_QWS_W100
3383 +extern void qws_w100Transformation( int t );
3386 void QWSDisplay::setTransformation( int t )
3388 -#ifndef QT_NO_QWS_TRANSFORMED
3389 +#if !defined(QT_NO_QWS_TRANSFORMED) || !defined(QT_NO_QWS_W100)
3390 QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect,
3391 QSize(qt_screen->width(), qt_screen->height()) );
3393 QPixmapCache::clear();
3394 qws_clearLoadedFonts();
3395 qws_mapPixmaps( TRUE );
3396 +#ifndef QT_NO_QWS_TRANSFORMED
3397 qws_setScreenTransformation( t );
3399 +#ifndef QT_NO_QWS_W100
3400 + qws_w100Transformation( t );
3402 qws_mapPixmaps( FALSE );
3404 if ( qt_fbdpy->d->directServerConnection() ) {