1
/* Copyright (c) 2003-2005 Advanced Micro Devices, Inc.
3
* Permission is hereby granted, free of charge, to any person obtaining a copy
4
* of this software and associated documentation files (the "Software"), to
5
* deal in the Software without restriction, including without limitation the
6
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
* sell copies of the Software, and to permit persons to whom the Software is
8
* furnished to do so, subject to the following conditions:
10
* The above copyright notice and this permission notice shall be included in
11
* all copies or substantial portions of the Software.
13
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
* Neither the name of the Advanced Micro Devices, Inc. nor the names of its
22
* contributors may be used to endorse or promote products derived from this
23
* software without specific prior written permission.
27
* File Contents: This file is consists of main Xfree acceleration supported
28
* routines like solid fill used here.
30
* Project: Geode Xfree Frame buffer device driver.
33
/* #undef OPT_ACCEL */
35
/* Xfree86 header files */
45
#include "xf86fbman.h"
51
#include "xf86_OSproc.h"
53
#include "xf86PciInfo.h"
58
/* Common macros for blend operations are here */
60
#include "geode_blend.h"
63
typedef unsigned long ulong;
66
typedef unsigned int uint;
69
typedef unsigned short ushort;
72
typedef unsigned char uchar;
74
#define CALC_FBOFFSET(x, y) \
75
(((ulong)(y) * gu2_pitch + ((ulong)(x) << gu2_xshift)))
78
((unsigned char *)pGeode->FBBase + CALC_FBOFFSET(x, y))
82
#define OS_USLEEP(usec) usleep(usec);
84
#define OS_USLEEP(usec)
88
static unsigned int BPP;
89
static unsigned int BLT_MODE, VEC_MODE;
90
static unsigned int ACCEL_STRIDE;
92
#define GU2_WAIT_PENDING while(READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_PENDING)
93
#define GU2_WAIT_BUSY while(READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_BUSY)
96
#define HOOK(fn) localRecPtr->fn = GX##fn
98
#define DLOG(l, fmt, args...) ErrorF(fmt, ##args)
100
/* static storage declarations */
102
typedef struct sGBltBox {
106
int bpp, transparent;
109
#if GX_SCANLINE_SUPPORT
112
#if GX_CPU2SCREXP_SUPPORT
115
#if GX_CLREXP_8X8_PAT_SUPPORT
116
static ulong *gc8x8p;
119
#if GX_DASH_LINE_SUPPORT
120
typedef struct sGDashLine {
127
static GDashLine gdln;
130
static unsigned int gu2_xshift, gu2_yshift;
131
static unsigned int gu2_pitch;
134
static XAAInfoRecPtr localRecPtr;
143
static const int SDfn[16] = {
144
0x00, 0x88, 0x44, 0xCC, 0x22, 0xAA, 0x66, 0xEE,
145
0x11, 0x99, 0x55, 0xDD, 0x33, 0xBB, 0x77, 0xFF
148
/* ((src FUNC dst) AND pat-mask) OR (dst AND (NOT pat-mask)) */
150
static const int SDfn_PM[16] = {
151
0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA,
152
0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA
157
static const int PDfn[16] = {
158
0x00, 0xA0, 0x50, 0xF0, 0x0A, 0xAA, 0x5A, 0xFA,
159
0x05, 0xA5, 0x55, 0xF5, 0x0F, 0xAF, 0x5F, 0xFF
162
/* ((pat FUNC dst) AND src-mask) OR (dst AND (NOT src-mask)) */
164
static const int PDfn_SM[16] = {
165
0x22, 0xA2, 0x62, 0xE2, 0x2A, 0xAA, 0x6A, 0xEA,
166
0x26, 0xA6, 0x66, 0xE6, 0x2E, 0xAE, 0x6E, 0xEE
171
amd_gx_BppToRasterMode(int bpp)
175
return MGP_RM_BPPFMT_565;
177
return MGP_RM_BPPFMT_8888;
179
return MGP_RM_BPPFMT_332;
184
#endif /* OPT_ACCEL */
186
/*----------------------------------------------------------------------------
189
* Description :This function is called to synchronize with the graphics
190
* engine and it waits the graphic engine is idle. This is
191
* required before allowing direct access to the framebuffer.
194
* pScrni ScrnInfoPtr pointer to Screeen info
197
*---------------------------------------------------------------------------*/
199
GXAccelSync(ScrnInfoPtr pScrni)
201
//ErrorF("GXAccelSync()\n");
203
gfx_wait_until_idle();
209
#if GX_FILL_RECT_SUPPORT
210
/*----------------------------------------------------------------------------
211
* GXSetupForSolidFill.
213
* Description :The SetupFor and Subsequent SolidFill(Rect) provide
214
* filling rectangular areas of the screen with a
219
* pScrni ScrnInfoPtr pointer to Screeen info
220
* color int foreground fill color
221
* rop int unmapped raster op
222
* planemask uint -1 (fill) or pattern data
225
*--------------------------------------------------------------------------*/
227
GXSetupForSolidFill(ScrnInfoPtr pScrni,
228
int color, int rop, unsigned int planemask)
230
//ErrorF("GXSetupForSolidFill(%#x,%#x,%#x)\n", color, rop, planemask);
233
gfx_set_solid_pattern(planemask);
234
gfx_set_solid_source(color);
235
gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
238
unsigned int ROP = BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
240
BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0;
241
if (((ROP ^ (ROP >> 1)) & 0x55) != 0)
242
BLT_MODE |= MGP_BM_DST_REQ;
244
WRITE_GP32(MGP_RASTER_MODE, ROP);
245
WRITE_GP32(MGP_PAT_COLOR_0, planemask);
246
WRITE_GP32(MGP_SRC_COLOR_FG, color);
247
WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
252
/*----------------------------------------------------------------------------
253
* GXSubsequentSolidFillRect.
255
* Description :see GXSetupForSolidFill.
259
* pScrni ScrnInfoPtr pointer to Screeen info
260
* x int destination x offset
261
* y int destination y offset
262
* w int fill area width (pixels)
263
* h int fill area height (pixels)
267
* Sample application uses:
268
* - Window backgrounds.
269
* - pull down highlighting.
270
* - x11perf: rectangle tests (-rect500).
271
* - x11perf: fill trapezoid tests (-trap100).
272
* - x11perf: horizontal line segments (-hseg500).
273
*----------------------------------------------------------------------------*/
275
GXSubsequentSolidFillRect(ScrnInfoPtr pScrni, int x, int y, int w, int h)
277
//ErrorF("GXSubsequentSolidFillRect() at %d,%d %dx%d\n", x, y, w, h);
279
gfx_pattern_fill(x, y, w, h);
282
unsigned int offset = CALC_FBOFFSET(x, y);
283
unsigned int size = (w << 16) | h;
286
WRITE_GP32(MGP_DST_OFFSET, offset);
287
WRITE_GP32(MGP_WID_HEIGHT, size);
288
WRITE_GP32(MGP_BLT_MODE, BLT_MODE);
293
#endif /* if GX_FILL_RECT_SUPPORT */
295
#if GX_CLREXP_8X8_PAT_SUPPORT
296
/*----------------------------------------------------------------------------
297
* GXSetupForColor8x8PatternFill
299
* Description :8x8 color pattern data is 64 pixels of full color data
300
* stored linearly in offscreen video memory. These patterns
301
* are useful as a substitute for 8x8 mono patterns when tiling,
302
* doing opaque stipples, or regular stipples.
305
* pScrni ScrnInfoPtr pointer to Screeen info
306
* patx int x offset to pattern data
307
* paty int y offset to pattern data
308
* rop int unmapped raster operation
309
* planemask uint -1 (copy) or pattern data
310
* trans_color int -1 (copy) or transparent color (not enabled)
311
* trans color only supported on source channel
312
* or in monochrome pattern channel
316
*---------------------------------------------------------------------------*/
319
GXSetupForColor8x8PatternFill(ScrnInfoPtr pScrni, int patx, int paty, int rop,
320
uint planemask, int trans_color)
322
GeodeRec *pGeode = GEODEPTR(pScrni);
324
//ErrorF("GXSetupForColor8x8PatternFill() pat %#x,%#x rop %#x %#x %#x\n",
325
// patx, paty, rop, planemask, trans_color);
327
gc8x8p = (unsigned long *) FBADDR(patx, paty);
328
/* gfx_set_solid_pattern is needed to clear src/pat transparency */
329
gfx_set_solid_pattern(0);
330
gfx_set_raster_operation(planemask == ~0U ? PDfn[rop] :
331
(gfx_set_solid_source(planemask), PDfn_SM[rop]));
332
gfx2_set_source_stride(pGeode->Pitch);
333
gfx2_set_destination_stride(pGeode->Pitch);
334
if (trans_color == -1)
335
gfx2_set_source_transparency(0, 0);
337
gfx2_set_source_transparency(trans_color, ~0);
340
/*----------------------------------------------------------------------------
341
* GXSubsequentColor8x8PatternFillRect
343
* Description :see GXSetupForColor8x8PatternFill.
346
* pScrni ScrnInfoPtr pointer to Screeen info
347
* patx int pattern phase x offset
348
* paty int pattern phase y offset
349
* x int destination x offset
350
* y int destination y offset
351
* w int fill area width (pixels)
352
* h int fill area height (pixels)
356
* Sample application uses:
357
* - Patterned desktops
358
* - x11perf: stippled rectangle tests (-srect500).
359
* - x11perf: opaque stippled rectangle tests (-osrect500).
360
*--------------------------------------------------------------------------*/
362
GXSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrni, int patx, int paty,
363
int x, int y, int w, int h)
366
// "GXSubsequentColor8x8PatternFillRect() patxy %d,%d at %d,%d %dsx%d\n",
367
// patx, paty, x, y, w, h);
368
gfx2_set_pattern_origin(patx, paty);
369
gfx2_color_pattern_fill(CALC_FBOFFSET(x, y), w, h, gc8x8p);
372
/* GX_CLREXP_8X8_PAT_SUPPORT */
375
#if GX_MONO_8X8_PAT_SUPPORT
376
/*----------------------------------------------------------------------------
377
* GXSetupForMono8x8PatternFill
379
* Description :8x8 mono pattern data is 64 bits of color expansion data
380
* with ones indicating the foreground color and zeros
381
* indicating the background color. These patterns are
382
* useful when tiling, doing opaque stipples, or regular
386
* pScrni ScrnInfoPtr pointer to Screeen info
387
* patx int x offset to pattern data
388
* paty int y offset to pattern data
389
* fg int foreground color
390
* bg int -1 (transparent) or background color
391
* rop int unmapped raster operation
392
* planemask uint -1 (copy) or pattern data
398
*--------------------------------------------------------------------------*/
400
GXSetupForMono8x8PatternFill(ScrnInfoPtr pScrni, int patx, int paty,
401
int fg, int bg, int rop, uint planemask)
404
//"GXSetupForMono8x8PatternFill() pat %#x,%#x fg %#x bg %#x %#x %#x\n",
405
//patx, paty, fg, bg, rop, planemask);
408
gfx_set_mono_pattern(bg, fg, patx, paty, bg == -1 ? 1 : 0);
409
gfx_set_raster_operation(planemask == ~0U ? PDfn[rop] :
410
(gfx_set_solid_source(planemask), PDfn_SM[rop]));
413
unsigned int ROP = BPP |
415
-1 ? MGP_RM_PAT_MONO | MGP_RM_PAT_TRANS : MGP_RM_PAT_MONO) |
416
(planemask == ~0U ? PDfn[rop] : PDfn_SM[rop]);
417
BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0;
418
if (((ROP ^ (ROP >> 1)) & 0x55) != 0)
419
BLT_MODE |= MGP_BM_DST_REQ;
421
WRITE_GP32(MGP_RASTER_MODE, ROP);
422
WRITE_GP32(MGP_SRC_COLOR_FG, planemask);
423
WRITE_GP32(MGP_PAT_COLOR_0, bg);
424
WRITE_GP32(MGP_PAT_COLOR_1, fg);
425
WRITE_GP32(MGP_PAT_DATA_0, patx);
426
WRITE_GP32(MGP_PAT_DATA_1, paty);
427
WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
432
/*----------------------------------------------------------------------------
433
* GXSubsequentMono8x8PatternFillRect
435
* Description :see GXSetupForMono8x8PatternFill
438
* pScrni ScrnInfoPtr pointer to Screeen info
439
* patx int pattern phase x offset
440
* paty int pattern phase y offset
441
* x int destination x offset
442
* y int destination y offset
443
* w int fill area width (pixels)
444
* h int fill area height (pixels)
448
* Sample application uses:
449
* - Patterned desktops
450
* - x11perf: stippled rectangle tests (-srect500).
451
* - x11perf: opaque stippled rectangle tests (-osrect500).
452
*--------------------------------------------------------------------------*/
454
GXSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrni, int patx, int paty,
455
int x, int y, int w, int h)
457
DEBUGMSG(1, (0, X_INFO, "%s() pat %#x,%#x at %d,%d %dx%d\n",
458
__func__, patx, paty, x, y, w, h));
460
gfx_pattern_fill(x, y, w, h);
463
unsigned int offset =
464
CALC_FBOFFSET(x, y) | ((x & 7) << 26) | ((y & 7) << 29);
465
unsigned int size = (w << 16) | h;
468
WRITE_GP32(MGP_DST_OFFSET, offset);
469
WRITE_GP32(MGP_WID_HEIGHT, size);
470
WRITE_GP32(MGP_BLT_MODE, BLT_MODE);
475
#endif /* GX_MONO_8X8_PAT_SUPPORT */
477
#if GX_SCR2SCRCPY_SUPPORT
478
/*----------------------------------------------------------------------------
479
* GXSetupForScreenToScreenCopy
481
* Description :SetupFor and Subsequent ScreenToScreenCopy functions
482
* provide an interface for copying rectangular areas from
483
* video memory to video memory.
486
* pScrni ScrnInfoPtr pointer to Screeen info
487
* xdir int x copy direction (up/dn)
488
* ydir int y copy direction (up/dn)
489
* rop int unmapped raster operation
490
* planemask uint -1 (copy) or pattern data
491
* trans_color int -1 (copy) or transparent color
494
*---------------------------------------------------------------------------*/
496
GXSetupForScreenToScreenCopy(ScrnInfoPtr pScrni, int xdir, int ydir, int rop,
497
uint planemask, int trans_color)
499
DEBUGMSG(1, (0, X_INFO, "%s() xd%d yd%d rop %#x %#x %#x\n",
500
__func__, xdir, ydir, rop, planemask, trans_color));
504
GeodeRec *pGeode = GEODEPTR(pScrni);
506
gfx_set_solid_pattern(planemask);
507
/* transparency is a parameter to set_rop, but set...pattern clears
509
if (trans_color == -1)
510
gfx2_set_source_transparency(0, 0);
512
gfx2_set_source_transparency(trans_color, ~0);
513
gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
514
gfx2_set_source_stride(pGeode->Pitch);
515
gfx2_set_destination_stride(pGeode->Pitch);
519
unsigned int ROP = BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
521
if (trans_color != -1)
522
ROP |= MGP_RM_SRC_TRANS;
523
BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ?
524
MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
526
WRITE_GP32(MGP_RASTER_MODE, ROP);
527
WRITE_GP32(MGP_PAT_COLOR_0, planemask);
528
WRITE_GP32(MGP_SRC_COLOR_FG, trans_color);
529
WRITE_GP32(MGP_SRC_COLOR_BG, ~0);
530
WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
535
/*----------------------------------------------------------------------------
536
* GXSubsquentScreenToScreenCopy
538
* Description :see GXSetupForScreenToScreenCopy.
541
* pScrni ScrnInfoPtr pointer to Screeen info
542
* x1 int source x offset
543
* y1 int source y offset
544
* x2 int destination x offset
545
* y2 int destination y offset
546
* w int copy area width (pixels)
547
* h int copy area height (pixels)
551
* Sample application uses (non-transparent):
553
* - x11perf: scroll tests (-scroll500).
554
* - x11perf: copy from window to window (-copywinwin500).
555
*---------------------------------------------------------------------------*/
557
GXSubsequentScreenToScreenCopy(ScrnInfoPtr pScrni,
558
int x1, int y1, int x2, int y2, int w, int h)
560
DEBUGMSG(1, (0, X_INFO, "%s() from %d,%d to %d,%d %dx%d\n",
561
__func__, x1, y1, x2, y2, w, h));
570
gfx2_screen_to_screen_blt(CALC_FBOFFSET(x1, y1), CALC_FBOFFSET(x2,
576
GeodeRec *pGeode = GEODEPTR(pScrni);
577
unsigned int src = CALC_FBOFFSET(x1, y1);
578
unsigned int dst = CALC_FBOFFSET(x2, y2);
579
unsigned int size = (w << 16) | h;
580
unsigned int blt_mode = BLT_MODE;
583
int n = (w << gu2_xshift) - 1;
587
blt_mode |= MGP_BM_NEG_XDIR;
590
int n = (h - 1) * pGeode->Pitch;
594
blt_mode |= MGP_BM_NEG_YDIR;
597
WRITE_GP32(MGP_SRC_OFFSET, src);
598
WRITE_GP32(MGP_DST_OFFSET, dst);
599
WRITE_GP32(MGP_WID_HEIGHT, size);
600
WRITE_GP16(MGP_BLT_MODE, blt_mode);
605
#endif /* if GX_SCR2SCRCPY_SUPPORT */
607
#if GX_SCANLINE_SUPPORT
608
/*----------------------------------------------------------------------------
609
* GXSetupForScanlineImageWrite
611
* Description :SetupFor/Subsequent ScanlineImageWrite and ImageWriteScanline
612
* transfer full color pixel data from system memory to video
613
* memory. This is useful for dealing with alignment issues and
614
* performing raster ops on the data.
617
* pScrni ScrnInfoPtr pointer to Screeen info
618
* rop int unmapped raster operation
619
* planemask uint -1 (copy) or pattern data
620
* bpp int bits per pixel (unused)
621
* depth int color depth (unused)
625
* x11perf -putimage10
626
* x11perf -putimage100
627
* x11perf -putimage500
628
*----------------------------------------------------------------------------
631
GXSetupForScanlineImageWrite(ScrnInfoPtr pScrni, int rop, uint planemask,
632
int trans_color, int bpp, int depth)
634
GeodeRec *pGeode = GEODEPTR(pScrni);
636
DEBUGMSG(1, (0, X_INFO, "%s() rop %#x %#x %#x %d %d\n",
637
__func__, rop, planemask, trans_color, bpp, depth));
639
/* transparency is a parameter to set_rop, but set...pattern clears
641
gfx_set_solid_pattern(planemask);
642
if (trans_color == -1)
643
gfx2_set_source_transparency(0, 0);
645
gfx2_set_source_transparency(trans_color, ~0);
646
gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
647
gfx2_set_source_stride(pGeode->Pitch);
648
gfx2_set_destination_stride(pGeode->Pitch);
651
/*----------------------------------------------------------------------------
652
* GXSubsequentScanlineImageWriteRect
654
* Description : see GXSetupForScanlineImageWrite.
657
* pScrni ScrnInfoPtr pointer to Screeen info
658
* x int destination x offset
659
* y int destination y offset
660
* w int copy area width (pixels)
661
* h int copy area height (pixels)
662
* skipleft int x margin (pixels) to skip (not enabled)
665
*---------------------------------------------------------------------------*/
667
GXSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrni,
668
int x, int y, int w, int h, int skipleft)
670
DEBUGMSG(1, (0, X_INFO, "%s() rop %d,%d %dx%d %d\n",
671
__func__, x, y, w, h, skipleft));
676
#if !GX_USE_OFFSCRN_MEM
677
#if !GX_ONE_LINE_AT_A_TIME
683
/*----------------------------------------------------------------------------
684
* GXSubsquentImageWriteScanline
686
* Description : see GXSetupForScanlineImageWrite.
689
* pScrni ScrnInfoPtr pointer to Screeen info
690
* bufno int scanline number in write group
694
* Sample application uses (non-transparent):
696
* - x11perf: scroll tests (-scroll500).
697
* - x11perf: copy from window to window (-copywinwin500).
699
*---------------------------------------------------------------------------*/
701
GXSubsequentImageWriteScanline(ScrnInfoPtr pScrni, int bufno)
703
GeodeRec *pGeode = GEODEPTR(pScrni);
705
#if !GX_USE_OFFSCRN_MEM
706
unsigned long offset;
709
#if GX_ONE_LINE_AT_A_TIME
710
DEBUGMSG(1, (0, X_INFO, "%s() %d\n", __func__, bufno));
711
#if !GX_USE_OFFSCRN_MEM
712
offset = pGeode->AccelImageWriteBuffers[bufno] - pGeode->FBBase;
713
gfx2_screen_to_screen_blt(offset, CALC_FBOFFSET(giwr.x, giwr.y), giwr.w,
715
#else /* if !GX_USE_OFFSCRN_MEM */
716
gfx2_color_bitmap_to_screen_blt(0, 0, CALC_FBOFFSET(giwr.x, giwr.y),
718
pGeode->AccelImageWriteBuffers[bufno],
720
#endif /* if !GX_USE_OFFSCRN_MEM */
722
#else /* if GX_ONE_LINE_AT_A_TIME */
725
DEBUGMSG(1, (0, X_INFO, "%s() %d\n", __func__, bufno));
727
if ((blt_height = pGeode->NoOfImgBuffers) > giwr.h)
729
if (++bufno < blt_height)
731
#if !GX_USE_OFFSCRN_MEM
732
offset = pGeode->AccelImageWriteBuffers[0] - pGeode->FBBase;
733
gfx2_screen_to_screen_blt(offset, CALC_FBOFFSET(giwr.x, giwr.y), giwr.w,
736
#else /* if !GX_USE_OFFSCRN_MEM */
737
gfx2_color_bitmap_to_screen_blt(0, 0, CALC_FBOFFSET(giwr.x, giwr.y),
739
pGeode->AccelImageWriteBuffers[0],
741
#endif /* if !GX_USE_OFFSCRN_MEM */
742
giwr.h -= blt_height;
743
giwr.y += blt_height;
744
#endif /* if GX_ONE_LINE_AT_A_TIME */
746
#endif /* GX_SCANLINE_SUPPORT */
748
#if GX_CPU2SCREXP_SUPPORT
749
/*----------------------------------------------------------------------------
750
* GXSetupForScanlineCPUToScreenColorExpandFill
752
* Description :SetupFor/Subsequent CPUToScreenColorExpandFill and
753
* ColorExpandScanline routines provide an interface for
754
* doing expansion blits from source patterns stored in
758
* pScrni ScrnInfoPtr pointer to Screeen info
759
* fg int foreground color
760
* bg int -1 (transparent) or background color
761
* rop int unmapped raster operation
762
* planemask uint -1 (copy) or pattern data
765
*---------------------------------------------------------------------------*/
768
GXSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrni,
769
int fg, int bg, int rop,
772
GeodeRec *pGeode = GEODEPTR(pScrni);
775
DEBUGMSG(1, (0, X_INFO, "%s() fg %#x bg %#x rop %#x %#x\n",
776
__func__, fg, bg, rop, planemask));
778
srcpitch = ((pGeode->Pitch + 31) >> 5) << 2;
780
gfx_set_solid_pattern(planemask);
781
gfx_set_mono_source(bg, fg, bg == -1 ? 1 : 0);
782
gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
783
gfx2_set_source_stride(srcpitch);
784
gfx2_set_destination_stride(pGeode->Pitch);
787
unsigned int stride = (srcpitch << 16) | pGeode->Pitch;
788
unsigned int ROP = BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
791
ROP |= MGP_RM_SRC_TRANS;
792
BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ?
793
MGP_BM_SRC_MONO | MGP_BM_SRC_FB | MGP_BM_DST_REQ :
794
MGP_BM_SRC_MONO | MGP_BM_SRC_FB;
796
WRITE_GP32(MGP_RASTER_MODE, ROP);
797
WRITE_GP32(MGP_PAT_COLOR_0, planemask);
798
WRITE_GP32(MGP_SRC_COLOR_BG, bg);
799
WRITE_GP32(MGP_SRC_COLOR_FG, fg);
800
WRITE_GP32(MGP_STRIDE, stride);
805
/*----------------------------------------------------------------------------
806
* GXSubsequentScanlineCPUToScreenColorExpandFill
808
Description :see GXSetupForScanlineCPUToScreenColorExpandFill
812
* pScrni ScrnInfoPtr pointer to Screeen info
813
* x int destination x offset
814
* y int destination y offset
815
* w int fill area width (pixels)
816
* h int fill area height (pixels)
820
*---------------------------------------------------------------------------*/
822
GXSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrni,
823
int x, int y, int w, int h,
826
DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %dx%d %d\n",
827
__func__, x, y, w, h, skipleft));
834
#if GX_ONE_LINE_AT_A_TIME
835
unsigned int size = (gc2s.w << 16) | 1;
838
WRITE_GP32(MGP_WID_HEIGHT, size);
840
GeodeRec *pGeode = GEODEPTR(pScrni);
841
unsigned int src = pGeode->AccelColorExpandBuffers[0] - pGeode->FBBase;
844
WRITE_GP32(MGP_SRC_OFFSET, src);
850
/*----------------------------------------------------------------------------
851
* GXSubsequentColorExpandScanline
853
* Description :see GXSetupForScanlineCPUToScreenColorExpandFill
856
* pScrni ScrnInfoPtr pointer to Screeen info
857
* bufno int scanline number in write group
860
*----------------------------------------------------------------------------
863
GXSubsequentColorExpandScanline(ScrnInfoPtr pScrni, int bufno)
865
GeodeRec *pGeode = GEODEPTR(pScrni);
867
DEBUGMSG(1, (0, X_INFO, "%s() %d\n", __func__, bufno));
870
#if GX_ONE_LINE_AT_A_TIME
871
ulong offset = pGeode->AccelColorExpandBuffers[bufno] - pGeode->FBBase;
873
gfx2_mono_expand_blt(offset, 0, 0, CALC_FBOFFSET(gc2s.x, gc2s.y),
876
#else /* if GX_ONE_LINE_AT_A_TIME */
880
if ((blt_height = pGeode->NoOfImgBuffers) > gc2s.h)
882
if (++bufno < blt_height)
885
/* convert from bits to dwords */
886
srcpitch = ((pGeode->Pitch + 31) >> 5) << 2;
887
gfx2_mono_bitmap_to_screen_blt(0, 0, CALC_FBOFFSET(gc2s.x, gc2s.y),
889
pGeode->AccelColorExpandBuffers[0],
891
gc2s.h -= blt_height;
892
gc2s.y += blt_height;
893
#endif /* if GX_ONE_LINE_AT_A_TIME */
895
#else /* ifndef OPT_ACCEL */
897
#if GX_ONE_LINE_AT_A_TIME
899
pGeode->AccelColorExpandBuffers[bufno] - pGeode->FBBase;
900
unsigned int dst = CALC_FBOFFSET(gc2s.x, gc2s.y);
904
WRITE_GP32(MGP_SRC_OFFSET, src);
905
WRITE_GP32(MGP_DST_OFFSET, dst);
906
WRITE_GP16(MGP_BLT_MODE, BLT_MODE);
907
#else /* if GX_ONE_LINE_AT_A_TIME */
908
unsigned int dst, size;
912
if ((blt_height = pGeode->NoOfImgBuffers) > gc2s.h)
914
if (++bufno < blt_height)
916
dst = CALC_FBOFFSET(gc2s.x, gc2s.y);
917
size = (gc2s.w << 16) | blt_height;
918
gc2s.h -= blt_height;
919
gc2s.y += blt_height;
921
WRITE_GP32(MGP_DST_OFFSET, dst);
922
WRITE_GP32(MGP_WID_HEIGHT, size);
923
WRITE_GP16(MGP_BLT_MODE, BLT_MODE);
924
#endif /* if GX_ONE_LINE_AT_A_TIME */
926
#endif /* ifndef OPT_ACCEL */
928
#endif /* GX_CPU2SCREXP_SUPPORT */
930
#if GX_SCR2SCREXP_SUPPORT
931
/*----------------------------------------------------------------------------
932
* GXSetupForScreenToScreenColorExpandFill
934
* Description :SetupFor/Subsequent ScreenToScreenColorExpandFill and
935
* ColorExpandScanline routines provide an interface for
936
* doing expansion blits from source patterns stored in
940
* pScrni ScrnInfoPtr pointer to Screeen info
941
* fg int foreground color
942
* bg int -1 (transparent) or background color
943
* rop int unmapped raster operation
944
* planemask uint -1 (copy) or pattern data
947
*---------------------------------------------------------------------------*/
950
GXSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrni, int fg, int bg,
951
int rop, uint planemask)
953
DEBUGMSG(1, (0, X_INFO, "%s() fg %#x bg %#x rop %#x %#x\n",
954
__func__, fg, bg, rop, planemask));
958
GeodeRec *pGeode = GEODEPTR(pScrni);
960
gfx_set_solid_pattern(planemask);
961
gfx_set_mono_source(bg, fg, bg == -1 ? 1 : 0);
962
gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
963
gfx2_set_source_stride(pGeode->Pitch);
964
gfx2_set_destination_stride(pGeode->Pitch);
968
unsigned int ROP = BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
971
ROP |= MGP_RM_SRC_TRANS;
972
BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ?
973
MGP_BM_SRC_MONO | MGP_BM_SRC_FB | MGP_BM_DST_REQ :
974
MGP_BM_SRC_MONO | MGP_BM_SRC_FB;
976
WRITE_GP32(MGP_RASTER_MODE, ROP);
977
WRITE_GP32(MGP_PAT_COLOR_0, planemask);
978
WRITE_GP32(MGP_SRC_COLOR_BG, bg);
979
WRITE_GP32(MGP_SRC_COLOR_FG, fg);
980
WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
985
/*----------------------------------------------------------------------------
986
* GXSubsequentScreenToScreenColorExpandFill
988
* Description :see GXSetupForScreenToScreenColorExpandFill
992
* pScrni ScrnInfoPtr pointer to Screeen info
993
* x int destination x offset
994
* y int destination y offset
995
* w int fill area width (pixels)
996
* h int fill area height (pixels)
997
* offset int initial x offset
1001
*---------------------------------------------------------------------------*/
1003
GXSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrni,
1004
int x, int y, int w, int h, int srcx,
1005
int srcy, int offset)
1007
DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %dx%d %d,%d %d\n",
1008
__func__, x, y, w, h, srcx, srcy, offset));
1010
gfx2_mono_expand_blt(CALC_FBOFFSET(srcx, srcy), offset, 0,
1011
CALC_FBOFFSET(x, y), w, h, 0);
1014
unsigned int src = (CALC_FBOFFSET(srcx,
1016
(offset >> 3)) | ((offset & 7) << 26);
1017
unsigned int dst = CALC_FBOFFSET(x, y);
1018
unsigned int size = (w << 16) | h;
1021
WRITE_GP32(MGP_SRC_OFFSET, src);
1022
WRITE_GP32(MGP_DST_OFFSET, dst);
1023
WRITE_GP32(MGP_WID_HEIGHT, size);
1024
WRITE_GP16(MGP_BLT_MODE, BLT_MODE);
1028
#endif /* GX_SCR2SCREXP_SUPPORT */
1030
#define VM_MAJOR_DEC 0
1031
#define VM_MINOR_DEC 0
1033
static unsigned short vmode[] = {
1034
VM_X_MAJOR | VM_MAJOR_INC | VM_MINOR_INC,
1035
/* !XDECREASING !YDECREASING !YMAJOR */
1036
VM_Y_MAJOR | VM_MAJOR_INC | VM_MINOR_INC,
1037
/* !XDECREASING !YDECREASING YMAJOR */
1038
VM_X_MAJOR | VM_MAJOR_INC | VM_MINOR_DEC,
1039
/* !XDECREASING YDECREASING !YMAJOR */
1040
VM_Y_MAJOR | VM_MAJOR_DEC | VM_MINOR_INC,
1041
/* !XDECREASING YDECREASING YMAJOR */
1042
VM_X_MAJOR | VM_MAJOR_DEC | VM_MINOR_INC,
1043
/* XDECREASING !YDECREASING !YMAJOR */
1044
VM_Y_MAJOR | VM_MAJOR_INC | VM_MINOR_DEC,
1045
/* XDECREASING !YDECREASING YMAJOR */
1046
VM_X_MAJOR | VM_MAJOR_DEC | VM_MINOR_DEC,
1047
/* XDECREASING YDECREASING !YMAJOR */
1048
VM_Y_MAJOR | VM_MAJOR_DEC | VM_MINOR_DEC,
1049
/* XDECREASING YDECREASING YMAJOR */
1052
#if GX_BRES_LINE_SUPPORT
1053
/*----------------------------------------------------------------------------
1054
* GXSetupForSolidLine
1056
* Description :SetupForSolidLine and Subsequent HorVertLine TwoPointLine
1057
* BresenhamLine provides an interface for drawing thin
1061
* pScrni ScrnInfoPtr pointer to Screeen info
1062
* color int foreground fill color
1063
* rop int unmapped raster op
1064
* planemask uint -1 (fill) or pattern data (not enabled)
1067
*---------------------------------------------------------------------------*/
1069
GXSetupForSolidLine(ScrnInfoPtr pScrni, int color, int rop, uint planemask)
1071
DEBUGMSG(1, (0, X_INFO, "%s() %#x %#x %#x\n",
1072
__func__, color, rop, planemask));
1075
gfx_set_solid_pattern(color);
1076
gfx_set_raster_operation(planemask == ~0U ? PDfn[rop] :
1077
(gfx_set_solid_source(planemask), PDfn_SM[rop]));
1080
unsigned int ROP = BPP | (planemask == ~0U ? PDfn[rop] : PDfn_SM[rop]);
1082
BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0;
1083
VEC_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ? ((BLT_MODE |=
1085
MGP_VM_DST_REQ) : 0;
1087
WRITE_GP32(MGP_RASTER_MODE, ROP);
1088
WRITE_GP32(MGP_PAT_COLOR_0, color);
1089
WRITE_GP32(MGP_SRC_COLOR_FG, planemask);
1090
WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
1095
/*---------------------------------------------------------------------------
1096
* GXSubsequentSolidBresenhamLine
1098
* Description :see GXSetupForSolidLine
1101
* pScrni ScrnInfoPtr pointer to Screeen info
1102
* x1 int destination x offset
1103
* y1 int destination y offset
1104
* absmaj int Bresenman absolute major
1105
* absmin int Bresenman absolute minor
1106
* err int Bresenman initial error term
1107
* len int length of the vector (pixels)
1108
* octant int specifies sign and magnitude relationships
1109
* used to determine axis of magor rendering
1110
* and direction of vector progress.
1114
* - Window outlines on window move.
1115
* - x11perf: line segments (-line500).
1116
* - x11perf: line segments (-seg500).
1117
*---------------------------------------------------------------------------*/
1119
GXSubsequentSolidBresenhamLine(ScrnInfoPtr pScrni, int x1, int y1,
1120
int absmaj, int absmin, int err, int len,
1125
DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %d %d, %d %d, %d\n",
1126
__func__, x1, y1, absmaj, absmin, err, len, octant));
1131
diagn = absmin - absmaj;
1133
gfx_bresenham_line(x1, y1, len, err, axial, diagn, vmode[octant]);
1136
unsigned int offset = CALC_FBOFFSET(x1, y1);
1137
unsigned int vec_err = (axial << 16) | (unsigned short) diagn;
1138
unsigned int vec_len = (len << 16) | (unsigned short) err;
1139
unsigned int vec_mode = VEC_MODE | vmode[octant];
1142
WRITE_GP32(MGP_DST_OFFSET, offset);
1143
WRITE_GP32(MGP_VEC_ERR, vec_err);
1144
WRITE_GP32(MGP_VEC_LEN, vec_len);
1145
WRITE_GP32(MGP_VECTOR_MODE, vec_mode);
1150
/*---------------------------------------------------------------------------
1151
* GXSubsequentSolidTwoPointLine
1153
* Description :see GXSetupForSolidLine
1156
* pScrni ScrnInfoPtr pointer to Screeen info
1157
* x0 int destination x start offset
1158
* y0 int destination y start offset
1159
* x1 int destination x end offset
1160
* y1 int destination y end offset
1161
* flags int OMIT_LAST, dont draw last pixel (not used)
1164
*---------------------------------------------------------------------------*/
1166
GXSubsequentSolidTwoPointLine(ScrnInfoPtr pScrni, int x0, int y0,
1167
int x1, int y1, int flags)
1169
long dx, dy, dmaj, dmin, octant, bias;
1170
long axial, diagn, err, len;
1172
DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %d,%d, %#x\n",
1173
__func__, x0, y0, x1, y1, flags));
1175
if ((dx = x1 - x0) < 0)
1177
if ((dy = y1 - y0) < 0)
1190
if ((flags & OMIT_LAST) == 0)
1195
octant |= XDECREASING;
1197
octant |= YDECREASING;
1200
bias = miGetZeroLineBias(pScrni->pScreen);
1201
err = axial - dmaj - ((bias >> octant) & 1);
1202
diagn = (dmin - dmaj) << 1;
1205
gfx_bresenham_line(x0, y0, len, err, axial, diagn, vmode[octant]);
1208
unsigned int offset = CALC_FBOFFSET(x0, y0);
1209
unsigned int vec_err = (axial << 16) | (unsigned short) diagn;
1210
unsigned int vec_len = (len << 16) | (unsigned short) err;
1211
unsigned int vec_mode = VEC_MODE | vmode[octant];
1214
WRITE_GP32(MGP_DST_OFFSET, offset);
1215
WRITE_GP32(MGP_VEC_ERR, vec_err);
1216
WRITE_GP32(MGP_VEC_LEN, vec_len);
1217
WRITE_GP32(MGP_VECTOR_MODE, vec_mode);
1222
/*---------------------------------------------------------------------------
1223
* GXSubsequentSolidHorVertLine
1225
* Description :see GXSetupForSolidLine
1228
* pScrni ScrnInfoPtr pointer to Screeen info
1229
* x int destination x offset
1230
* y int destination y offset
1231
* len int length of the vector (pixels)
1232
* dir int DEGREES_270 or DEGREES_0 line direction
1234
* Sample application uses:
1235
* - Window outlines on window move.
1236
* - x11perf: line segments (-hseg500).
1237
* - x11perf: line segments (-vseg500).
1238
*---------------------------------------------------------------------------
1241
GXSubsequentSolidHorVertLine(ScrnInfoPtr pScrni, int x, int y, int len, int dir)
1243
DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %d %d\n", __func__, x, y, len, dir));
1245
if (dir == DEGREES_0)
1246
gfx_pattern_fill(x, y, len, 1);
1248
gfx_pattern_fill(x, y, 1, len);
1251
unsigned int offset = CALC_FBOFFSET(x, y);
1253
dir == DEGREES_0 ? (len << 16) | 1 : (1 << 16) | len;
1255
WRITE_GP32(MGP_DST_OFFSET, offset);
1256
WRITE_GP32(MGP_WID_HEIGHT, size);
1257
WRITE_GP32(MGP_BLT_MODE, BLT_MODE);
1261
#endif /* GX_BRES_LINE_SUPPORT */
1263
#if GX_DASH_LINE_SUPPORT
1264
/*----------------------------------------------------------------------------
1265
* GXSetupForDashedLine
1267
* Description :SetupForDashedLine and Subsequent TwoPointLine
1268
* BresenhamLine provides an interface for drawing thin
1272
* pScrni ScrnInfoPtr pointer to Screeen info
1273
* fg int foreground fill color
1274
* bg int -1 (transp) or background fill color
1275
* rop int unmapped raster op
1276
* planemask uint -1 (fill) or pattern data (not enabled)
1277
* length int pattern length (bits)
1278
* pattern uchar* dash pattern mask
1281
*---------------------------------------------------------------------------*/
1283
GXSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
1284
unsigned int planemask, int length, unsigned char *pattern)
1287
CARD32 pat = *pattern;
1296
if ((n = l - 32) >= 0) {
1298
m = pat << (length - n);
1302
gdln.pat[0] = pat8x8[0];
1303
gdln.pat[1] = pat8x8[1];
1308
gfx_set_solid_pattern(0);
1309
gfx_set_raster_operation(planemask == ~0U ? PDfn[rop] :
1310
(gfx_set_solid_source(planemask), PDfn_SM[rop]));
1313
/*---------------------------------------------------------------------------
1314
* GXSubsequentDashedBresenhamLine
1316
* Description: This function is used to render a vector using the
1317
* specified bresenham parameters.
1320
* pScrni: Screen handler pointer having screen information.
1321
* x1: Specifies the starting x position
1322
* y1: Specifies starting y possition
1323
* absmaj: Specfies the Bresenman absolute major.
1324
* absmin: Specfies the Bresenman absolute minor.
1325
* err: Specifies the bresenham err term.
1326
* len: Specifies the length of the vector interms of pixels.
1327
* octant: not used in this function,may be added for standard
1334
* Sample application uses:
1335
* - Window outlines on window move.
1336
* - x11perf: line segments (-line500).
1337
* - x11perf: line segments (-seg500).
1338
*----------------------------------------------------------------------------
1341
GXSubsequentDashedBresenhamLine(ScrnInfoPtr pScrni,
1342
int x1, int y1, int absmaj, int absmin,
1343
int err, int len, int octant, int phase)
1347
int trans = (gdln.bg == -1);
1348
unsigned long pat8x8[2];
1350
//ErrorF("BLine %d, %d, %d, %d, %d, %d, %d\n" x1, y1, absmaj, absmin,
1351
//err, len, octant);
1353
i = phase >= 32 ? (phase -= 32, 1) : 0;
1356
((gdln.pat[i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[1 - i] << n);
1358
((gdln.pat[1 - i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[i] << n);
1361
diagn = absmin - absmaj;
1362
gfx_set_mono_pattern(gdln.bg, gdln.fg, pat8x8[0], pat8x8[1], trans);
1363
gfx2_set_pattern_origin(x1, y1);
1364
gfx2_bresenham_line(CALC_FBOFFSET(x1, y1), len, err, axial, diagn,
1368
/*---------------------------------------------------------------------------
1369
* GXSubsequentDashedTwoPointLine
1371
* Description :see GXSetupForDashedLine
1374
* pScrni ScrnInfoPtr pointer to Screeen info
1375
* x0 int destination x start offset
1376
* y0 int destination y start offset
1377
* x1 int destination x end offset
1378
* y1 int destination y end offset
1379
* flags int OMIT_LAST, dont draw last pixel (not used)
1380
* phase int initial pattern offset at x1,y1
1383
*---------------------------------------------------------------------------*/
1385
GXSubsequentDashedTwoPointLine(ScrnInfoPtr pScrni, int x0, int y0,
1386
int x1, int y1, int flags, int phase)
1389
long dx, dy, dmaj, dmin, octant, bias;
1390
long axial, diagn, err, len, pat8x8[2];
1392
//ErrorF("GXSubsequentDashedTwoPointLine() %d,%d %d,%d, %#x %d\n",
1393
// x0, y0, x1, y1, flags, phase);
1395
i = phase >= 32 ? (phase -= 32, 1) : 0;
1398
((gdln.pat[i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[1 - i] << n);
1400
((gdln.pat[1 - i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[i] << n);
1402
if ((dx = x1 - x0) < 0)
1404
if ((dy = y1 - y0) < 0)
1417
if ((flags & OMIT_LAST) == 0)
1422
octant |= XDECREASING;
1424
octant |= YDECREASING;
1427
bias = miGetZeroLineBias(pScrni->pScreen);
1428
err = axial - dmaj - ((bias >> octant) & 1);
1429
diagn = (dmin - dmaj) << 1;
1431
gfx2_set_pattern_origin(x0, y0);
1432
gfx2_bresenham_line(CALC_FBOFFSET(x0, y0), len, err, axial, diagn,
1436
#endif /* GX_DASH_LINE_SUPPORT */
1438
#if GX_WRITE_PIXMAP_SUPPORT
1440
GXWritePixmap(ScrnInfoPtr pScrni, int x, int y, int w, int h,
1441
unsigned char *src, int srcwidth, int rop, unsigned int planemask,
1442
int trans, int bpp, int depth)
1444
GeodeRec *pGeode = GEODEPTR(pScrni);
1446
//ErrorF("GXWritePixmap() %d,%d %dx%d, s%#x sp%d %#x %#x %#x %d %d\n",
1447
// x, y, w, h, src, srcwidth, rop, planemask, trans, bpp, depth);
1449
if (bpp == pScrni->bitsPerPixel) {
1451
if (rop == GXcopy && trans == -1) {
1452
gfx_wait_until_idle();
1453
geode_memory_to_screen_blt((unsigned long) src,
1454
(unsigned long) FBADDR(x, y), srcwidth,
1455
pGeode->Pitch, w, h, bpp);
1458
gfx_set_solid_pattern(planemask);
1459
gfx_set_raster_operation(planemask ==
1460
~0U ? SDfn[rop] : SDfn_PM[rop]);
1462
gfx_color_bitmap_to_screen_xblt(0, 0, x, y, w, h, src,
1465
gfx_color_bitmap_to_screen_blt(0, 0, x, y, w, h, src, srcwidth);
1466
SET_SYNC_FLAG(pGeode->AccelInfoRec);
1470
pGeode->WritePixmap(pScrni, x, y, w, h, src, srcwidth, rop, planemask,
1473
#endif /* if GX_WRITE_PIXMAP_SUPPORT */
1478
amd_gx_exa_WaitMarker(ScreenPtr pScreen, int Marker)
1484
amd_gx_exa_Done(PixmapPtr p)
1489
amd_gx_exa_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
1490
char *src, int src_pitch)
1492
char *dst = pDst->devPrivate.ptr;
1493
int dst_pitch = exaGetPixmapPitch(pDst);
1494
int bpp = pDst->drawable.bitsPerPixel;
1496
dst += y * dst_pitch + x * (bpp >> 3);
1498
geode_memory_to_screen_blt((unsigned long) src, (unsigned long) dst,
1499
src_pitch, dst_pitch, w, h, bpp);
1504
amd_gx_exa_DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
1505
char *dst, int dst_pitch)
1507
char *src = pSrc->devPrivate.ptr;
1508
int src_pitch = exaGetPixmapPitch(pSrc);
1509
int bpp = pSrc->drawable.bitsPerPixel;
1511
src += (y * src_pitch) + (x * (bpp >> 3));
1513
geode_memory_to_screen_blt((unsigned long) src, (unsigned long) dst,
1514
src_pitch, dst_pitch, w, h, bpp);
1521
amd_gx_exa_PrepareSolid(PixmapPtr pxMap, int alu, Pixel planemask, Pixel fg)
1523
int dstPitch = exaGetPixmapPitch(pxMap);
1524
unsigned int ROP = amd_gx_BppToRasterMode(pxMap->drawable.bitsPerPixel)
1525
| (planemask == ~0U ? SDfn[alu] : SDfn_PM[alu]);
1527
// FIXME: this should go away -- workaround for the blockparty icon corruption
1528
//if (pxMap->drawable.bitsPerPixel == 32)
1531
BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0;
1532
if (((ROP ^ (ROP >> 1)) & 0x55) != 0)
1533
BLT_MODE |= MGP_BM_DST_REQ;
1534
//ErrorF("amd_gx_exa_PrepareSolid(%#x,%#x,%#x - ROP=%x,BLT_MODE=%x)\n", alu, planemask, fg, ROP, BLT_MODE);
1536
WRITE_GP32(MGP_RASTER_MODE, ROP);
1537
WRITE_GP32(MGP_PAT_COLOR_0, planemask);
1538
WRITE_GP32(MGP_SRC_COLOR_FG, fg);
1539
WRITE_GP32(MGP_STRIDE, dstPitch);
1544
amd_gx_exa_Solid(PixmapPtr pxMap, int x1, int y1, int x2, int y2)
1546
int bpp = (pxMap->drawable.bitsPerPixel + 7) / 8;
1547
int pitch = exaGetPixmapPitch(pxMap);
1548
unsigned int offset = exaGetPixmapOffset(pxMap) + pitch * y1 + bpp * x1;
1549
unsigned int size = ((x2 - x1) << 16) | (y2 - y1);
1551
//ErrorF("amd_gx_exa_Solid() at %d,%d %d,%d - offset=%d, bpp=%d\n", x1, y1, x2, y2, offset, bpp);
1554
WRITE_GP32(MGP_DST_OFFSET, offset);
1555
WRITE_GP32(MGP_WID_HEIGHT, size);
1556
WRITE_GP32(MGP_BLT_MODE, BLT_MODE);
1562
amd_gx_exa_PrepareCopy(PixmapPtr pxSrc, PixmapPtr pxDst, int dx, int dy,
1563
int alu, Pixel planemask)
1565
GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst);
1566
int dstPitch = exaGetPixmapPitch(pxDst);
1569
/* Punt if the color formats aren't the same */
1571
if (pxSrc->drawable.bitsPerPixel != pxDst->drawable.bitsPerPixel)
1574
//ErrorF("amd_gx_exa_PrepareCopy() dx%d dy%d alu %#x %#x\n",
1575
// dx, dy, alu, planemask);
1577
pGeode->cpySrcOffset = exaGetPixmapOffset(pxSrc);
1578
pGeode->cpySrcPitch = exaGetPixmapPitch(pxSrc);
1579
pGeode->cpySrcBpp = (pxSrc->drawable.bitsPerPixel + 7) / 8;
1582
ROP = amd_gx_BppToRasterMode(pxSrc->drawable.bitsPerPixel) |
1583
(planemask == ~0U ? SDfn[alu] : SDfn_PM[alu]);
1585
BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ?
1586
MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
1588
WRITE_GP32(MGP_RASTER_MODE, ROP);
1589
WRITE_GP32(MGP_PAT_COLOR_0, planemask);
1590
WRITE_GP32(MGP_SRC_COLOR_FG, ~0);
1591
WRITE_GP32(MGP_SRC_COLOR_BG, ~0);
1592
WRITE_GP32(MGP_STRIDE, (pGeode->cpySrcPitch << 16) | dstPitch);
1597
amd_gx_exa_Copy(PixmapPtr pxDst, int srcX, int srcY, int dstX, int dstY,
1600
GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst);
1601
int dstBpp = (pxDst->drawable.bitsPerPixel + 7) / 8;
1602
int dstPitch = exaGetPixmapPitch(pxDst);
1603
unsigned int srcOffset =
1604
pGeode->cpySrcOffset + (pGeode->cpySrcPitch * srcY) +
1605
(pGeode->cpySrcBpp * srcX);
1606
unsigned int dstOffset =
1607
exaGetPixmapOffset(pxDst) + (dstPitch * dstY) + (dstBpp * dstX);
1608
unsigned int size = (w << 16) | h;
1609
unsigned int blt_mode = BLT_MODE;
1611
//ErrorF("amd_gx_exa_Copy() from %d,%d to %d,%d %dx%d\n", srcX, srcY,
1612
// dstX, dstY, w, h);
1614
if (pGeode->cpyDx < 0) {
1615
srcOffset += w * pGeode->cpySrcBpp - 1;
1616
dstOffset += w * dstBpp - 1;
1617
blt_mode |= MGP_BM_NEG_XDIR;
1619
if (pGeode->cpyDy < 0) {
1620
srcOffset += (h - 1) * pGeode->cpySrcPitch;
1621
dstOffset += (h - 1) * dstPitch;
1622
blt_mode |= MGP_BM_NEG_YDIR;
1625
WRITE_GP32(MGP_SRC_OFFSET, srcOffset);
1626
WRITE_GP32(MGP_DST_OFFSET, dstOffset);
1627
WRITE_GP32(MGP_WID_HEIGHT, size);
1628
WRITE_GP16(MGP_BLT_MODE, blt_mode);
1634
#define DST_SRC MGP_RM_DEST_FROM_CHAN_A
1636
#define Aa_B0 MGP_RM_ALPHA_TIMES_A
1637
/* A*0 + B*(1-alpha) */
1638
#define A0_B1a MGP_RM_BETA_TIMES_B
1639
/* A*1 + B*(1-alpha) */
1640
#define A1_B1a MGP_RM_A_PLUS_BETA_B
1641
/* A*alpha + B*(1-alpha) */
1642
#define Aa_B1a MGP_RM_ALPHA_A_PLUS_BETA_B
1644
#define a_A MGP_RM_SELECT_ALPHA_A
1646
#define a_B MGP_RM_SELECT_ALPHA_B
1647
/* alpha from const */
1648
#define a_C MGP_RM_SELECT_ALPHA_R
1650
#define a_1 MGP_RM_SELECT_ALPHA_1
1652
#define MGP_RM_ALPHA_TO_ARGB (MGP_RM_ALPHA_TO_ALPHA | MGP_RM_ALPHA_TO_RGB)
1653
#define gxPictOpMAX PictOpAdd /* highest accelerated op */
1655
unsigned int amd_gx_exa_alpha_ops[] =
1656
/* A B OP AS const = 0 */
1658
(SRC_DST | Aa_B0 | a_C), 0, /* clear (src*0) */
1659
(SRC_DST | Aa_B0 | a_1), 0, /* src (src*1) */
1660
(DST_SRC | Aa_B0 | a_1), 0, /* dst (dst*1) */
1661
(SRC_DST | A1_B1a | a_A), 0, /* src-over (src*1 + dst(1-A)) */
1662
(DST_SRC | A1_B1a | a_A), 0, /* dst-over (dst*1 + src(1-B)) */
1663
(SRC_DST | Aa_B0 | a_B), 0, /* src-in (src*B) */
1664
(DST_SRC | Aa_B0 | a_B), 0, /* dst-in (dst*A) */
1665
(DST_SRC | A0_B1a | a_A), 0, /* src-out (src*(1-B)) */
1666
(SRC_DST | A0_B1a | a_A), 0, /* dst-out (dst*(1-A)) */
1667
/* pass1 (SRC=dst DST=scr=src), pass2 (SRC=src, DST=dst) */
1668
(DST_SRC | Aa_B0 | a_B), /* srcatop (src*B) */
1669
(SRC_DST | A0_B1a | a_A), /* + (dst(1-A)) */
1670
(SRC_DST | Aa_B0 | a_B), /* dstatop (dst*A) */
1671
(DST_SRC | A0_B1a | a_A), /* + (src(1-B) */
1672
(SRC_DST | A0_B1a | a_A), /* xor (src*(1-B) */
1673
(SRC_DST | A0_B1a | a_A), /* + (dst(1-A) */
1674
(SRC_DST | A1_B1a | a_C), 0, /* add (src*1 + dst*1) */
1684
amd_gx_exa_fmt_t amd_gx_exa_fmts[] = {
1685
{PICT_a8r8g8b8, 32, MGP_RM_BPPFMT_8888, 8},
1686
{PICT_x8r8g8b8, 32, MGP_RM_BPPFMT_8888, 0},
1687
{PICT_a4r4g4b4, 16, MGP_RM_BPPFMT_4444, 4},
1688
{PICT_a1r5g5b5, 16, MGP_RM_BPPFMT_1555, 1},
1689
{PICT_r5g6b5, 16, MGP_RM_BPPFMT_565, 0},
1690
{PICT_r3g3b2, 8, MGP_RM_BPPFMT_332, 0},
1693
static amd_gx_exa_fmt_t *
1694
amd_gx_exa_check_format(PicturePtr p)
1697
int bpp = p->pDrawable ? p->pDrawable->bitsPerPixel : 0;
1698
amd_gx_exa_fmt_t *fp = &amd_gx_exa_fmts[0];
1700
for (i = sizeof(amd_gx_exa_fmts) / sizeof(amd_gx_exa_fmts[0]); --i >= 0;
1706
if (fp->exa_fmt == p->format)
1709
return i < 0 ? NULL : fp;
1715
amd_gx_exa_CheckComposite(int op, PicturePtr pSrc, PicturePtr pMsk,
1718
GeodeRec *pGeode = GEODEPTR_FROM_PICTURE(pDst);
1720
if (op > gxPictOpMAX)
1724
if (usesPasses(op) && pGeode->exaBfrSz == 0)
1726
if (pSrc->filter != PictFilterNearest &&
1727
pSrc->filter != PictFilterFast &&
1728
pSrc->filter != PictFilterGood && pSrc->filter != PictFilterBest)
1732
if (pSrc->transform)
1738
amd_gx_exa_PrepareComposite(int op, PicturePtr pSrc, PicturePtr pMsk,
1739
PicturePtr pDst, PixmapPtr pxSrc, PixmapPtr pxMsk,
1744
GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst);
1745
amd_gx_exa_fmt_t *sfp, *dfp;
1747
//ErrorF("amd_gx_exa_PrepareComposite()\n");
1749
if ((sfp = amd_gx_exa_check_format(pSrc)) == NULL)
1751
if (sfp->alpha_bits == 0 && usesSrcAlpha(op))
1753
if ((dfp = amd_gx_exa_check_format(pDst)) == NULL)
1755
if (dfp->alpha_bits == 0 && usesDstAlpha(op))
1757
if (sfp->gx_fmt != dfp->gx_fmt)
1759
srcPitch = exaGetPixmapPitch(pxSrc);
1760
if (usesPasses(op) && srcPitch > pGeode->exaBfrSz)
1762
pGeode->cmpSrcPitch = srcPitch;
1764
pGeode->cmpSrcOffset = exaGetPixmapOffset(pxSrc);
1765
pGeode->cmpSrcBpp = (pxSrc->drawable.bitsPerPixel + 7) / 8;
1766
pGeode->cmpSrcFmt = sfp->gx_fmt;
1767
pGeode->cmpDstFmt = dfp->gx_fmt | (dfp->alpha_bits == 0 ?
1768
MGP_RM_ALPHA_TO_RGB :
1769
MGP_RM_ALPHA_TO_ARGB);
1774
amd_gx_exa_Composite(PixmapPtr pxDst, int srcX, int srcY, int maskX,
1775
int maskY, int dstX, int dstY, int width, int height)
1777
int op, current_line, max_lines, lines, pass, scratchPitch;
1778
unsigned int srcOffset, srcOfs = 0, srcPitch, srcPch = 0, srcBpp;
1779
unsigned int dstOffset, dstOfs = 0, dstPitch, dstPch = 0, dstBpp;
1780
unsigned int sizes, strides, blt_mode = 0, rop = 0;
1781
GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst);
1783
//ErrorF("amd_gx_exa_Composite() from %d,%d to %d,%d %dx%d\n",
1784
// srcX, srcY, dstX, dstY, width, height);
1787
if (usesPasses(op)) {
1788
int cacheLineSz = 32;
1790
(width * pGeode->cmpSrcBpp + cacheLineSz - 1) / cacheLineSz;
1791
scratchPitch = cachelines * cacheLineSz;
1792
if (scratchPitch > pGeode->cmpSrcPitch)
1793
scratchPitch = pGeode->cmpSrcPitch;
1794
max_lines = pGeode->exaBfrSz / scratchPitch;
1801
dstBpp = (pxDst->drawable.bitsPerPixel + 7) / 8;
1802
dstPitch = exaGetPixmapPitch(pxDst);
1803
dstOffset = exaGetPixmapOffset(pxDst) + dstPitch * dstY + dstBpp * dstX;
1804
srcBpp = pGeode->cmpSrcBpp;
1805
srcPitch = pGeode->cmpSrcPitch;
1806
srcOffset = pGeode->cmpSrcOffset + srcPitch * srcY + srcBpp * srcX;
1808
current_line = pass = 0;
1809
while (current_line < height) {
1810
if (usesPasses(op)) {
1811
lines = height - current_line;
1812
if (lines > max_lines)
1815
case 0: /* copy src to scratch */
1817
srcOfs = srcOffset + current_line * srcPch;
1818
dstPch = scratchPitch;
1819
dstOfs = pGeode->exaBfrOffset;
1820
rop = pGeode->cmpSrcFmt | MGP_RM_ALPHA_TO_ARGB;
1821
rop |= amd_gx_exa_alpha_ops[PictOpSrc * 2];
1822
blt_mode = usesChanB0(PictOpSrc) ?
1823
MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
1828
srcOfs = dstOffset + current_line * srcPch;
1829
dstPch = scratchPitch;
1830
dstOfs = pGeode->exaBfrOffset;
1831
rop = pGeode->cmpSrcFmt | MGP_RM_ALPHA_TO_ARGB;
1832
rop |= amd_gx_exa_alpha_ops[op * 2];
1833
blt_mode = usesChanB1(op) ?
1834
MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
1839
srcOfs = srcOffset + current_line * srcPch;
1841
dstOfs = dstOffset + current_line * dstPch;
1842
rop = pGeode->cmpSrcFmt | MGP_RM_ALPHA_TO_ARGB;
1843
rop |= amd_gx_exa_alpha_ops[op * 2 + 1];
1844
blt_mode = usesChanB2(op) ?
1845
MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
1849
srcPch = scratchPitch;
1850
srcOfs = pGeode->exaBfrOffset;
1852
dstOfs = dstOffset + current_line * dstPch;
1853
rop = pGeode->cmpDstFmt;
1854
rop |= amd_gx_exa_alpha_ops[PictOpAdd * 2];
1855
blt_mode = usesChanB0(PictOpAdd) ?
1856
MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
1857
current_line += lines;
1861
strides = (srcPch << 16) | dstPch;
1863
else { /* not multi pass */
1866
current_line = lines = height;
1867
strides = (srcPitch << 16) | dstPitch;
1868
rop = pGeode->cmpDstFmt | amd_gx_exa_alpha_ops[op * 2];
1869
blt_mode = usesChanB0(op) ?
1870
MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
1872
sizes = (width << 16) | lines;
1873
if (srcOfs < dstOfs) {
1874
srcOfs += (lines - 1) * srcPitch + width * srcBpp - 1;
1875
dstOfs += (lines - 1) * dstPitch + width * dstBpp - 1;
1876
blt_mode |= MGP_BM_NEG_XDIR | MGP_BM_NEG_YDIR;
1879
WRITE_GP32(MGP_RASTER_MODE, rop);
1880
WRITE_GP32(MGP_SRC_OFFSET, srcOfs);
1881
WRITE_GP32(MGP_DST_OFFSET, dstOfs);
1882
WRITE_GP32(MGP_WID_HEIGHT, sizes);
1883
WRITE_GP32(MGP_STRIDE, strides);
1884
WRITE_GP16(MGP_BLT_MODE, blt_mode);
1887
#endif /* #if XF86EXA */
1889
/*----------------------------------------------------------------------------
1892
* Description: This function sets up the supported acceleration routines and
1893
* appropriate flags.
1896
* pScrn: Screeen pointer structure.
1898
* Returns: TRUE on success and FALSE on Failure
1900
* Comments: This function is called in GXScreenInit in
1901
* geode_driver.c to set * the acceleration.
1902
*----------------------------------------------------------------------------
1905
GXAccelInit(ScreenPtr pScrn)
1907
ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
1908
GeodeRec *pGeode = GEODEPTR(pScrni);
1911
ExaDriverPtr pExa = pGeode->pExa;
1914
gu2_xshift = pScrni->bitsPerPixel >> 4;
1916
/* XXX - fixme - this will change - we'll need to update it */
1918
gu2_pitch = pGeode->Pitch;
1920
switch (pGeode->Pitch) {
1936
ACCEL_STRIDE = (pGeode->Pitch << 16) | pGeode->Pitch;
1937
BPP = amd_gx_BppToRasterMode(pScrni->bitsPerPixel);
1941
if (pExa && pGeode->useEXA) {
1942
pExa->exa_major = EXA_VERSION_MAJOR;
1943
pExa->exa_minor = EXA_VERSION_MINOR;
1946
pExa->WaitMarker = amd_gx_exa_WaitMarker;
1947
/* UploadToScreen */
1948
pExa->UploadToScreen = amd_gx_exa_UploadToScreen;
1949
pExa->DownloadFromScreen = amd_gx_exa_DownloadFromScreen;
1952
pExa->PrepareSolid = amd_gx_exa_PrepareSolid;
1953
pExa->Solid = amd_gx_exa_Solid;
1954
pExa->DoneSolid = amd_gx_exa_Done;
1957
pExa->PrepareCopy = amd_gx_exa_PrepareCopy;
1958
pExa->Copy = amd_gx_exa_Copy;
1959
pExa->DoneCopy = amd_gx_exa_Done;
1962
pExa->CheckComposite = amd_gx_exa_CheckComposite;
1963
pExa->PrepareComposite = amd_gx_exa_PrepareComposite;
1964
pExa->Composite = amd_gx_exa_Composite;
1965
pExa->DoneComposite = amd_gx_exa_Done;
1967
return exaDriverInit(pScrn, pGeode->pExa);
1973
/* Getting the pointer for acceleration Inforecord */
1974
pGeode->AccelInfoRec = localRecPtr = XAACreateInfoRec();
1975
if (!pGeode->AccelInfoRec)
1978
/* SET ACCELERATION FLAGS */
1979
localRecPtr->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER;
1981
/* HOOK SYNCRONIZARION ROUTINE */
1982
localRecPtr->Sync = GXAccelSync;
1984
#if GX_FILL_RECT_SUPPORT
1985
/* HOOK FILLED RECTANGLES */
1986
HOOK(SetupForSolidFill);
1987
HOOK(SubsequentSolidFillRect);
1988
localRecPtr->SolidFillFlags = 0;
1991
#if GX_MONO_8X8_PAT_SUPPORT
1992
/* Color expansion */
1993
HOOK(SetupForMono8x8PatternFill);
1994
HOOK(SubsequentMono8x8PatternFillRect);
1995
/* BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | NO_TRANSPARENCY | */
1996
localRecPtr->Mono8x8PatternFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST |
1997
HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN;
2000
#if GX_CLREXP_8X8_PAT_SUPPORT
2001
/* Color expansion */
2002
HOOK(SetupForColor8x8PatternFill);
2003
HOOK(SubsequentColor8x8PatternFillRect);
2004
/* BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | NO_TRANSPARENCY | */
2005
localRecPtr->Color8x8PatternFillFlags =
2006
BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD |
2007
HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_PROGRAMMED_ORIGIN;
2010
#if GX_SCR2SCRCPY_SUPPORT
2011
/* HOOK SCREEN TO SCREEN COPIES
2012
* Set flag to only allow copy if transparency is enabled.
2014
HOOK(SetupForScreenToScreenCopy);
2015
HOOK(SubsequentScreenToScreenCopy);
2016
localRecPtr->ScreenToScreenCopyFlags =
2017
BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD;
2020
#if GX_BRES_LINE_SUPPORT
2021
/* HOOK BRESENHAM SOLID LINES */
2022
localRecPtr->SolidLineFlags = NO_PLANEMASK;
2023
HOOK(SetupForSolidLine);
2024
HOOK(SubsequentSolidBresenhamLine);
2025
HOOK(SubsequentSolidHorVertLine);
2026
HOOK(SubsequentSolidTwoPointLine);
2027
localRecPtr->SolidBresenhamLineErrorTermBits = 15;
2030
#if GX_DASH_LINE_SUPPORT
2031
/* HOOK BRESENHAM DASHED LINES */
2032
HOOK(SetupForDashedLine);
2033
HOOK(SubsequentDashedBresenhamLine);
2034
HOOK(SubsequentDashedTwoPointLine);
2035
localRecPtr->DashedBresenhamLineErrorTermBits = 15;
2036
localRecPtr->DashPatternMaxLength = 64;
2037
localRecPtr->DashedLineFlags = NO_PLANEMASK | /* TRANSPARENCY_ONLY | */
2038
LINE_PATTERN_POWER_OF_2_ONLY | LINE_PATTERN_MSBFIRST_MSBJUSTIFIED;
2041
#if GX_SCR2SCREXP_SUPPORT
2042
/* Color expansion */
2043
HOOK(SetupForScreenToScreenColorExpandFill);
2044
HOOK(SubsequentScreenToScreenColorExpandFill);
2045
localRecPtr->ScreenToScreenColorExpandFillFlags =
2046
BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | NO_TRANSPARENCY;
2049
if (pGeode->AccelImageWriteBuffers) {
2050
#if GX_SCANLINE_SUPPORT
2051
localRecPtr->ScanlineImageWriteBuffers = pGeode->AccelImageWriteBuffers;
2052
localRecPtr->NumScanlineImageWriteBuffers = pGeode->NoOfImgBuffers;
2053
HOOK(SetupForScanlineImageWrite);
2054
HOOK(SubsequentScanlineImageWriteRect);
2055
HOOK(SubsequentImageWriteScanline);
2056
localRecPtr->ScanlineImageWriteFlags = NO_PLANEMASK | NO_GXCOPY |
2057
BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD;
2062
localRecPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES;
2065
if (pGeode->AccelColorExpandBuffers) {
2066
#if GX_CPU2SCREXP_SUPPORT
2067
/* Color expansion */
2068
localRecPtr->ScanlineColorExpandBuffers =
2069
pGeode->AccelColorExpandBuffers;
2070
localRecPtr->NumScanlineColorExpandBuffers =
2071
pGeode->NoOfColorExpandLines;
2072
HOOK(SetupForScanlineCPUToScreenColorExpandFill);
2073
HOOK(SubsequentScanlineCPUToScreenColorExpandFill);
2074
HOOK(SubsequentColorExpandScanline);
2075
localRecPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK |
2076
BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD;
2079
#if GX_WRITE_PIXMAP_SUPPORT
2080
pGeode->WritePixmap = localRecPtr->WritePixmap;
2084
return (XAAInit(pScrn, localRecPtr));